mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
fix(keystone): allow delete sso imported non-local user
allow delete SSO imported non-local users
This commit is contained in:
+3582
-3702
File diff suppressed because it is too large
Load Diff
+186
-552
File diff suppressed because it is too large
Load Diff
@@ -757,7 +757,15 @@ func (user *SUser) ValidateDeleteCondition(ctx context.Context) error {
|
||||
return errors.Wrap(err, "getIdmappings")
|
||||
}
|
||||
if !user.IsLocal() && len(idMappings) > 0 {
|
||||
return httperrors.NewForbiddenError("cannot delete non-local user")
|
||||
for _, idmaping := range idMappings {
|
||||
idp, err := IdentityProviderManager.FetchIdentityProviderById(idmaping.IdpId)
|
||||
if err != nil && errors.Cause(err) == sql.ErrNoRows {
|
||||
return errors.Wrap(err, "IdentityProviderManager.FetchIdentityProviderById")
|
||||
}
|
||||
if idp != nil && idp.IsSso.IsFalse() {
|
||||
return httperrors.NewForbiddenError("cannot delete non-local non-sso user")
|
||||
}
|
||||
}
|
||||
}
|
||||
err = user.ValidatePurgeCondition(ctx)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user