mirror of
https://github.com/minio/minio.git
synced 2025-02-25 12:29:15 -05:00
fix: do not allow removal of inbuilt policies unless they are already persisted (#17264)
Dont allow removal of inbuilt policies such as `readwrite, readonly, writeonly and diagnostics`
This commit is contained in:
parent
3d6b88a60e
commit
35d71682f6
@ -532,6 +532,14 @@ func (sys *IAMSys) DeletePolicy(ctx context.Context, policyName string, notifyPe
|
|||||||
return errServerNotInitialized
|
return errServerNotInitialized
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for _, v := range iampolicy.DefaultPolicies {
|
||||||
|
if v.Name == policyName {
|
||||||
|
if err := checkConfig(ctx, globalObjectAPI, getPolicyDocPath(policyName)); err != nil && err == errConfigNotFound {
|
||||||
|
return fmt.Errorf("inbuilt policy `%s` not allowed to be deleted", policyName)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
err := sys.store.DeletePolicy(ctx, policyName)
|
err := sys.store.DeletePolicy(ctx, policyName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
Loading…
x
Reference in New Issue
Block a user