This commit is contained in:
1 parent
00f3283a4a
commit
583b9e88b7
7 files changed
+190
-1
No files matched your search
@@ -23,6 +23,7 @@ var managementEndpoints = []Endpoint{
|
||||
{Method: "POST", Path: "/api/user/create", Capability: CapabilityUserCreate},
|
||||
{Method: "POST", Path: "/api/user/profile", Capability: CapabilityProfileWriteOwn},
|
||||
{Method: "POST", Path: "/api/user/edit", Capability: CapabilityUserManage},
|
||||
{Method: "POST", Path: "/api/user/delete", Capability: CapabilityUserManage},
|
||||
{Method: "*", Path: "/api/user/security/", Capability: CapabilityUserSecurityManage},
|
||||
{Method: "POST", Path: "/api/user/info", Capability: CapabilityUserRead},
|
||||
{Method: "POST", Path: "/api/user/list", Capability: CapabilityUserRead},
|
||||
@@ -51,6 +52,7 @@ var managementEndpoints = []Endpoint{
|
||||
{Method: "POST", Path: "/api/v1/user/create", Capability: CapabilityUserCreate},
|
||||
{Method: "POST", Path: "/api/v1/user/profile", Capability: CapabilityProfileWriteOwn},
|
||||
{Method: "POST", Path: "/api/v1/user/edit", Capability: CapabilityUserManage},
|
||||
{Method: "POST", Path: "/api/v1/user/delete", Capability: CapabilityUserManage},
|
||||
{Method: "*", Path: "/api/v1/user/security/", Capability: CapabilityUserSecurityManage},
|
||||
{Method: "POST", Path: "/api/v1/user/info", Capability: CapabilityUserRead},
|
||||
{Method: "POST", Path: "/api/v1/user/list", Capability: CapabilityUserRead},
|
||||
|
||||
@@ -411,6 +411,20 @@ func (r *Repository) AbandonPending(userID, id int) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *Repository) Delete(userID, id int) error {
|
||||
if r == nil || r.engine == nil || userID <= 0 || id <= 0 {
|
||||
return ErrInvalidBinding
|
||||
}
|
||||
affected, err := r.engine.Where("id = ? AND user_id = ?", id, userID).Delete(&models.ExternalEmail{})
|
||||
if err != nil {
|
||||
return fmt.Errorf("delete external email binding: %w", err)
|
||||
}
|
||||
if affected == 0 {
|
||||
return ErrBindingOwnership
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *Repository) Disable(userID, id int) error {
|
||||
if r == nil || r.engine == nil || userID <= 0 || id <= 0 {
|
||||
return ErrInvalidBinding
|
||||
|
||||
Reference in new issue
Block a user