Merge branch 'main' into feature/peer-approval

This commit is contained in:
pascal-fischer
2023-12-01 18:12:59 +01:00
committed by GitHub
16 changed files with 409 additions and 112 deletions

View File

@@ -41,7 +41,7 @@ func (h *AccountsHandler) GetAllAccounts(w http.ResponseWriter, r *http.Request)
return
}
if !user.IsAdmin() {
if !user.HasAdminPower() {
util.WriteError(status.Errorf(status.PermissionDenied, "the user has no permission to access account data"), w)
return
}

View File

@@ -53,7 +53,7 @@ func (a *AccessControl) Handler(h http.Handler) http.Handler {
return
}
if !user.IsAdmin() {
if !user.HasAdminPower() {
switch r.Method {
case http.MethodDelete, http.MethodPost, http.MethodPatch, http.MethodPut:
@@ -63,7 +63,7 @@ func (a *AccessControl) Handler(h http.Handler) http.Handler {
return
}
util.WriteError(status.Errorf(status.PermissionDenied, "only admin can perform this operation"), w)
util.WriteError(status.Errorf(status.PermissionDenied, "only users with admin power can perform this operation"), w)
return
}
}