mirror of
https://github.com/minio/minio.git
synced 2025-01-24 05:03:16 -05:00
fix: reload LDAP users properly with latest mapping (#12137)
peer nodes would not update if policy is unset on a user, until policies reload every 5minutes. Make sure to reload the policies properly, if no policy is found make sure to delete such users and groups fixes #12074 Signed-off-by: Harshavardhana <harsha@minio.io>
This commit is contained in:
parent
93cdecaadd
commit
799691eded
20
cmd/iam.go
20
cmd/iam.go
@ -355,12 +355,24 @@ func (sys *IAMSys) LoadPolicyMapping(objAPI ObjectLayer, userOrGroup string, isG
|
||||
|
||||
if globalEtcdClient == nil {
|
||||
var err error
|
||||
if isGroup {
|
||||
err = sys.store.loadMappedPolicy(context.Background(), userOrGroup, regularUser, isGroup, sys.iamGroupPolicyMap)
|
||||
} else {
|
||||
err = sys.store.loadMappedPolicy(context.Background(), userOrGroup, regularUser, isGroup, sys.iamUserPolicyMap)
|
||||
userType := regularUser
|
||||
if sys.usersSysType == LDAPUsersSysType {
|
||||
userType = stsUser
|
||||
}
|
||||
|
||||
if isGroup {
|
||||
err = sys.store.loadMappedPolicy(context.Background(), userOrGroup, userType, isGroup, sys.iamGroupPolicyMap)
|
||||
} else {
|
||||
err = sys.store.loadMappedPolicy(context.Background(), userOrGroup, userType, isGroup, sys.iamUserPolicyMap)
|
||||
}
|
||||
|
||||
if err == errNoSuchPolicy {
|
||||
if isGroup {
|
||||
delete(sys.iamGroupPolicyMap, userOrGroup)
|
||||
} else {
|
||||
delete(sys.iamUserPolicyMap, userOrGroup)
|
||||
}
|
||||
}
|
||||
// Ignore policy not mapped error
|
||||
if err != nil && err != errNoSuchPolicy {
|
||||
return err
|
||||
|
Loading…
x
Reference in New Issue
Block a user