@@ -169,7 +169,7 @@ func (c *Checker) UserList(ctx context.Context, req *authz.UserListRequest) (*au
169169 }
170170 var ret []* authz.User
171171 for _ , user := range users {
172- ret = append (ret , newAzpbUser (user ))
172+ ret = append (ret , newUser (user ))
173173 }
174174 return & authz.UserListResponse {Users : ret }, nil
175175}
@@ -185,7 +185,7 @@ func (c *Checker) User(ctx context.Context, req *authz.UserRequest) (*authz.User
185185 if user == nil || err != nil {
186186 return nil , ErrUnauthorized
187187 }
188- return & authz.UserResponse {User : newAzpbUser (user )}, err
188+ return & authz.UserResponse {User : newUser (user )}, err
189189}
190190
191191// ///////////////////
@@ -434,13 +434,15 @@ func (c *Checker) ObjectPermissions(ctx context.Context, obj authz.ObjectRef) (*
434434 Actions : authz.ActionSet {},
435435 }
436436
437- // Check all actions relevant to this type
437+ // Check all actions relevant to this type; only include granted actions
438438 for _ , action := range actionsForType (obj .Type ) {
439- ret .Actions [action ], _ = c .checkAction (ctx , action , entKey , ctxTuples ... )
439+ if ok , _ := c .checkAction (ctx , action , entKey , ctxTuples ... ); ok {
440+ ret .Actions [action ] = true
441+ }
440442 }
441443 // Special case: CanSetTenant on groups is global-admin only
442- if obj .Type == GroupType {
443- ret .Actions [CanSetTenant ] = c . ctxIsGlobalAdmin ( ctx )
444+ if obj .Type == GroupType && c . ctxIsGlobalAdmin ( ctx ) {
445+ ret .Actions [CanSetTenant ] = true
444446 }
445447
446448 // Get tuples — subjects + parent
@@ -474,7 +476,6 @@ func (c *Checker) ObjectPermissions(ctx context.Context, obj authz.ObjectRef) (*
474476 c .hydrateObjectRefs (ctx , toHydrate )
475477 // Apply back
476478 ret .Ref .Name = toHydrate [0 ].Name
477- ret .Name = toHydrate [0 ].Name
478479 idx := 1
479480 if ret .Parent != nil {
480481 ret .Parent .Name = toHydrate [idx ].Name
@@ -912,6 +913,6 @@ func newEntityID(t ObjectType, id int64) EntityKey {
912913 return authz .NewEntityKey (t , strconv .Itoa (int (id )))
913914}
914915
915- func newAzpbUser (u authn.User ) * authz.User {
916+ func newUser (u authn.User ) * authz.User {
916917 return & authz.User {Id : u .ID (), Name : u .Name (), Email : u .Email ()}
917918}
0 commit comments