mirror of
https://github.com/minio/minio.git
synced 2025-11-28 21:18:10 -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:
@@ -129,6 +129,29 @@ func (statement Statement) Validate() error {
|
||||
return statement.isValid()
|
||||
}
|
||||
|
||||
// Equals checks if two statements are equal
|
||||
func (statement Statement) Equals(st Statement) bool {
|
||||
if statement.Effect != st.Effect {
|
||||
return false
|
||||
}
|
||||
if !statement.Actions.Equals(st.Actions) {
|
||||
return false
|
||||
}
|
||||
if !statement.Resources.Equals(st.Resources) {
|
||||
return false
|
||||
}
|
||||
if !statement.Conditions.Equals(st.Conditions) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// Clone clones Statement structure
|
||||
func (statement Statement) Clone() Statement {
|
||||
return NewStatement(statement.Effect, statement.Actions.Clone(),
|
||||
statement.Resources.Clone(), statement.Conditions.Clone())
|
||||
}
|
||||
|
||||
// NewStatement - creates new statement.
|
||||
func NewStatement(effect policy.Effect, actionSet ActionSet, resourceSet ResourceSet, conditions condition.Functions) Statement {
|
||||
return Statement{
|
||||
|
||||
Reference in New Issue
Block a user