Configuring user access using API
Learn how to configure user access using API.
Last updated
Was this helpful?
Learn how to configure user access using API.
Last updated
Was this helpful?
We can update user roles for a repository by using the API endpoint: ''. This endpoint allows us to assign roles to multiple users at the same time for the repository.
When assigning roles to multiple users, each user will receive the same set of roles for the specified repositories.
Let us consider a scenario where we want to assign the Company Admin role (roleId=6) to a repository (id=5) and remove the Repository Admin role (roleId=5) from the same repository (id=5). We intend to apply this change to multiple users, specifically user ID 1125.
In the payload of the API, there are 3 main sections:
userIds
An array of user IDs
All the users in the array will receive or lose the same set of role or repo mapping.
Access
Type: Array
This field can be used to provide role access to a certain repository.
Each array item will contain a repo ID and a role ID.
noAccess
Type: Array
This field can be used to revoke role access to a certain repository.
Each item in an array will contain a repoId and roleId.
Note:
To get the repository IDs, you can use the below API endpoint: api/{version}/open/repositories/get-repositories-names-links
To get the user ID, use /api/{version}/open/admin/users
To get the role ID, there is no endpoint at the moment. Refer the following table to get the ID:
Viewer
1
Repository Admin
5
Company Admin
6
Developer
2
Maintainer
4
Reviewer
3