mirror of
https://github.com/minio/minio.git
synced 2025-11-22 18:47:43 -05:00
feat: introduce listUsers, listPolicies for any bucket (#12372)
Bonus change LDAP settings such as user, group mappings are now listed as part of `mc admin user list` and `mc admin group list` Additionally this PR also deprecates the `/v2` API that is no longer in use.
This commit is contained in:
@@ -97,6 +97,16 @@ type Policy struct {
|
||||
Statements []Statement `json:"Statement"`
|
||||
}
|
||||
|
||||
// MatchResource matches resource with match resource patterns
|
||||
func (iamp Policy) MatchResource(resource string) bool {
|
||||
for _, statement := range iamp.Statements {
|
||||
if statement.Resources.MatchResource(resource) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// IsAllowed - checks given policy args is allowed to continue the Rest API.
|
||||
func (iamp Policy) IsAllowed(args Args) bool {
|
||||
// Check all deny statements. If any one statement denies, return false.
|
||||
|
||||
@@ -48,7 +48,12 @@ func (r Resource) IsValid() bool {
|
||||
return r.Pattern != ""
|
||||
}
|
||||
|
||||
// Match - matches object name with resource pattern.
|
||||
// MatchResource matches object name with resource pattern only.
|
||||
func (r Resource) MatchResource(resource string) bool {
|
||||
return r.Match(resource, nil)
|
||||
}
|
||||
|
||||
// Match - matches object name with resource pattern, including specific conditionals.
|
||||
func (r Resource) Match(resource string, conditionValues map[string][]string) bool {
|
||||
pattern := r.Pattern
|
||||
for _, key := range condition.CommonKeys {
|
||||
|
||||
@@ -99,6 +99,16 @@ func (resourceSet ResourceSet) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(resources)
|
||||
}
|
||||
|
||||
// MatchResource matches object name with resource patterns only.
|
||||
func (resourceSet ResourceSet) MatchResource(resource string) bool {
|
||||
for r := range resourceSet {
|
||||
if r.MatchResource(resource) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// Match - matches object name with anyone of resource pattern in resource set.
|
||||
func (resourceSet ResourceSet) Match(resource string, conditionValues map[string][]string) bool {
|
||||
for r := range resourceSet {
|
||||
|
||||
Reference in New Issue
Block a user