@@ -416,7 +416,7 @@ func (api *API) userByName(rw http.ResponseWriter, r *http.Request) {
416
416
user := httpmw .UserParam (r )
417
417
organizationIDs , err := userOrganizationIDs (ctx , api , user )
418
418
419
- if ! api .Authorize (r , rbac .ActionRead , rbac . ResourceUser ) {
419
+ if ! api .Authorize (r , rbac .ActionRead , user ) {
420
420
httpapi .ResourceNotFound (rw )
421
421
return
422
422
}
@@ -457,7 +457,7 @@ func (api *API) putUserProfile(rw http.ResponseWriter, r *http.Request) {
457
457
defer commitAudit ()
458
458
aReq .Old = user
459
459
460
- if ! api .Authorize (r , rbac .ActionUpdate , rbac . ResourceUser ) {
460
+ if ! api .Authorize (r , rbac .ActionUpdate , user ) {
461
461
httpapi .ResourceNotFound (rw )
462
462
return
463
463
}
@@ -563,7 +563,7 @@ func (api *API) putUserStatus(status database.UserStatus) func(rw http.ResponseW
563
563
defer commitAudit ()
564
564
aReq .Old = user
565
565
566
- if ! api .Authorize (r , rbac .ActionDelete , rbac . ResourceUser ) {
566
+ if ! api .Authorize (r , rbac .ActionDelete , user ) {
567
567
httpapi .ResourceNotFound (rw )
568
568
return
569
569
}
@@ -640,7 +640,7 @@ func (api *API) putUserPassword(rw http.ResponseWriter, r *http.Request) {
640
640
defer commitAudit ()
641
641
aReq .Old = user
642
642
643
- if ! api .Authorize (r , rbac .ActionUpdate , rbac . ResourceUserData . WithOwner ( user .ID . String () )) {
643
+ if ! api .Authorize (r , rbac .ActionUpdate , user .UserDataRBACObject ( )) {
644
644
httpapi .ResourceNotFound (rw )
645
645
return
646
646
}
@@ -665,7 +665,7 @@ func (api *API) putUserPassword(rw http.ResponseWriter, r *http.Request) {
665
665
666
666
// admins can change passwords without sending old_password
667
667
if params .OldPassword == "" {
668
- if ! api .Authorize (r , rbac .ActionUpdate , rbac . ResourceUser ) {
668
+ if ! api .Authorize (r , rbac .ActionUpdate , user ) {
669
669
httpapi .Forbidden (rw )
670
670
return
671
671
}
@@ -753,7 +753,7 @@ func (api *API) userRoles(rw http.ResponseWriter, r *http.Request) {
753
753
ctx := r .Context ()
754
754
user := httpmw .UserParam (r )
755
755
756
- if ! api .Authorize (r , rbac .ActionRead , rbac . ResourceUserData . WithOwner ( user .ID . String () )) {
756
+ if ! api .Authorize (r , rbac .ActionRead , user .UserDataRBACObject ( )) {
757
757
httpapi .ResourceNotFound (rw )
758
758
return
759
759
}
@@ -832,7 +832,7 @@ func (api *API) putUserRoles(rw http.ResponseWriter, r *http.Request) {
832
832
return
833
833
}
834
834
835
- if ! api .Authorize (r , rbac .ActionRead , rbac . ResourceUser ) {
835
+ if ! api .Authorize (r , rbac .ActionRead , user ) {
836
836
httpapi .ResourceNotFound (rw )
837
837
return
838
838
}
0 commit comments