Skip to content

Commit

Permalink
add ErrRootRoleNotGranted error code
Browse files Browse the repository at this point in the history
Signed-off-by: Colin <[email protected]>
  • Loading branch information
LLiuJJ committed Feb 26, 2025
1 parent 6ecb6fb commit 3301e30
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion server/auth/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ var (
ErrNoPasswordUser = errors.New("auth: authentication failed, password was given for no password user")
ErrPermissionDenied = errors.New("auth: permission denied")
ErrRoleNotGranted = errors.New("auth: role is not granted to the user")
ErrRootRoleNotGranted = errors.New("auth: permission denied, root role is not granted to current user")
ErrPermissionNotGranted = errors.New("auth: permission is not granted to the role")
ErrAuthNotEnabled = errors.New("auth: authentication is not enabled")
ErrAuthOldRevision = errors.New("auth: revision in header is old")
Expand Down Expand Up @@ -927,7 +928,7 @@ func (as *authStore) IsAdminPermitted(authInfo *AuthInfo) error {
}

if !hasRootRole(u) {
return ErrPermissionDenied
return ErrRootRoleNotGranted
}

return nil
Expand Down

0 comments on commit 3301e30

Please sign in to comment.