mirror of
https://github.com/minio/minio.git
synced 2025-11-24 19:46:16 -05:00
policy: Add Merge API (#11793)
This commit adds a new API in pkg/bucket/policy package called Merge to merge multiple policies of a user or a group into one policy document.
This commit is contained in:
@@ -66,6 +66,42 @@ func (functions Functions) Keys() KeySet {
|
||||
return keySet
|
||||
}
|
||||
|
||||
// Clone clones Functions structure
|
||||
func (functions Functions) Clone() Functions {
|
||||
funcs := []Function{}
|
||||
|
||||
for _, f := range functions {
|
||||
vfn := conditionFuncMap[f.name()]
|
||||
for key, values := range f.toMap() {
|
||||
function, _ := vfn(key, values.Clone())
|
||||
funcs = append(funcs, function)
|
||||
}
|
||||
}
|
||||
|
||||
return funcs
|
||||
}
|
||||
|
||||
// Equals returns true if two Functions structures are equal
|
||||
func (functions Functions) Equals(funcs Functions) bool {
|
||||
if len(functions) != len(funcs) {
|
||||
return false
|
||||
}
|
||||
for _, fi := range functions {
|
||||
fistr := fi.String()
|
||||
found := false
|
||||
for _, fj := range funcs {
|
||||
if fistr == fj.String() {
|
||||
found = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// MarshalJSON - encodes Functions to JSON data.
|
||||
func (functions Functions) MarshalJSON() ([]byte, error) {
|
||||
nm := make(map[name]map[Key]ValueSet)
|
||||
|
||||
Reference in New Issue
Block a user