Get_users() and get_user() behave differently for isManager

I noticed that get_users() and get_user() behave differently for isManager :
get_users() always returns the isManager key.
get_user() returns the isManager key, only if isAdmin is False.

import ayon_api
curUser = ayon_api.get_user()
print(curUser["data"]["isManager"])      # Fails if the current user is an admin.
users = ayon_api.get_users()
for curUser in users:
    print(curUser["name"], curUser["isManager"], curUser["isAdmin"], curUser["isService"])

Example of get_users result :

   Name       isManager  isAdmin    isService
   admin      True       True       False            Note that an admin is both an admin and a manager.
   manager    True       False      False
   service    True       False      True             Note that a service is both a service and a manager.
   artist     False      False      False

It’s easy to deal with it, I was just wondering if it was done on purpose.

1 Like

I think it makes sense to have the service as manager because it can take actions in AYON. Any ways, I better leave it for @martin.wacker

Also, I found out that ayon_api.get_users() is based on graphql call which provides more roles: admin, developer, guest, manager, service.
which is a lot similar to this

While REST [get] /api/users/{username} returns “raw” data, GraphQL pre-processes these flags: admin implies manager, service implies admin and manager.

isGuest is slightly different as it is an additional flag and it is possible to have “guest manager”

Thanks for the clarification !