ynput / ayon-python-api

Apache License 2.0
8 stars 3 forks source link

Users: Add project filtering #163

Closed iLLiCiTiT closed 2 months ago

iLLiCiTiT commented 2 months ago

Description

Add project name filter for users fetch and added helper function to get one user using GraphQl.

Additional information

Only admin and manager users can fetch all users from server. Other users have to specify project name filter otherwise error is thrown. At the same time users endpoint does not return the same information as graphql does, so it was necessary to add new method that gives option to get users data using graphql and project name filter.

Testing notes

  1. Create artist user and assign him to some projects.
  2. Log into server using ServerAPI as the artist user.
  3. Try to call get_users without any arguments > it should raise error.
  4. Try to call get_users with project name filter > it should return users for the project if user is assigned to the project.

NOTE: There is known bug on server that it will return users of project even if the user is not assigned to it so step 4. will work for any project now.

kalisp commented 2 months ago

get_users without any arguments doesn't fail for me and returns all users (even service ones) on the server.

get_users with project_name filter works as expected. (not returning service accounts)

iLLiCiTiT commented 2 months ago

get_users without any arguments doesn't fail for me and returns all users (even service ones) on the server.

Did you login as the artist user?