Skip to content

Commit

Permalink
fix: root credentials should be able to create users (minio#12511)
Browse files Browse the repository at this point in the history
  • Loading branch information
harshavardhana authored Jun 16, 2021
1 parent 7722b91 commit 951877f
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions cmd/admin-handlers-users.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,16 @@ func (a adminAPIHandlers) GetUserInfo(w http.ResponseWriter, r *http.Request) {
return
}

accessKey := cred.AccessKey
if cred.ParentUser != "" {
accessKey = cred.ParentUser
accessKey := cred.ParentUser
if accessKey == "" {
accessKey = cred.AccessKey
}

// For temporary credentials always
// the temporary credentials to check
// policy without implicit permissions.
if cred.IsTemp() && cred.ParentUser == globalActiveCred.AccessKey {
accessKey = cred.AccessKey
}

implicitPerm := name == accessKey
Expand Down Expand Up @@ -434,6 +441,12 @@ func (a adminAPIHandlers) AddUser(w http.ResponseWriter, r *http.Request) {
if parentUser == "" {
parentUser = cred.AccessKey
}
// For temporary credentials always
// the temporary credentials to check
// policy without implicit permissions.
if cred.IsTemp() && cred.ParentUser == globalActiveCred.AccessKey {
parentUser = cred.AccessKey
}
if !globalIAMSys.IsAllowed(iampolicy.Args{
AccountName: parentUser,
Groups: cred.Groups,
Expand Down Expand Up @@ -1017,7 +1030,7 @@ func (a adminAPIHandlers) AccountInfoHandler(w http.ResponseWriter, r *http.Requ
if err != nil && !IsErrIgnored(err,
dns.ErrNoEntriesFound,
dns.ErrDomainMissing) {
writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL, guessIsBrowserReq(r))
writeErrorResponseJSON(ctx, w, toAdminAPIErr(ctx, err), r.URL)
return
}
for _, dnsRecords := range dnsBuckets {
Expand Down

0 comments on commit 951877f

Please sign in to comment.