role_user_assignments
Creates, updates, deletes, gets or lists a role_user_assignments resource.
Overview
| Name | role_user_assignments |
| Type | Resource |
| Id | github.orgs.role_user_assignments |
Fields
The following fields are returned by SELECT queries:
- list_org_role_users
Response - List of assigned users
| Name | Datatype | Description |
|---|---|---|
id | integer | |
name | string | |
gravatar_id | string | (example: 41d064eb2195891e12d0413f63227ea7) |
node_id | string | (example: MDQ6VXNlcjE=) |
assignment | string | Determines if the user has a direct, indirect, or mixed relationship to a role (direct, indirect, mixed) (example: direct) |
avatar_url | string (uri) | (example: https://github.com/images/error/octocat_happy.gif) |
email | string | |
events_url | string | (example: https://api.github.com/users/octocat/events{/privacy}) |
followers_url | string (uri) | (example: https://api.github.com/users/octocat/followers) |
following_url | string | (example: https://api.github.com/users/octocat/following{/other_user}) |
gists_url | string | (example: https://api.github.com/users/octocat/gists{/gist_id}) |
html_url | string (uri) | (example: https://github.com/octocat) |
inherited_from | array | Team the user has gotten the role through |
login | string | (example: octocat) |
organizations_url | string (uri) | (example: https://api.github.com/users/octocat/orgs) |
received_events_url | string (uri) | (example: https://api.github.com/users/octocat/received_events) |
repos_url | string (uri) | (example: https://api.github.com/users/octocat/repos) |
site_admin | boolean | |
starred_at | string | (example: "2020-07-09T00:17:55Z") |
starred_url | string | (example: https://api.github.com/users/octocat/starred{/owner}{/repo}) |
subscriptions_url | string (uri) | (example: https://api.github.com/users/octocat/subscriptions) |
type | string | (example: User) |
url | string (uri) | (example: https://api.github.com/users/octocat) |
user_view_type | string | (example: public) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
list_org_role_users | select | org, role_id | per_page, page | Lists organization members that are assigned to an organization role. For more information on organization roles, see "Using organization roles." To use this endpoint, you must be an administrator for the organization. OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint. |
assign_user_to_org_role | replace | org, username, role_id | Assigns an organization role to a member of an organization. For more information on organization roles, see "Using organization roles." The authenticated user must be an administrator for the organization to use this endpoint. OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint. | |
revoke_org_role_user | delete | org, username, role_id | Remove an organization role from a user. For more information on organization roles, see "Using organization roles." The authenticated user must be an administrator for the organization to use this endpoint. OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint. | |
revoke_all_org_roles_user | delete | org, username | Revokes all assigned organization roles from a user. For more information on organization roles, see "Using organization roles." The authenticated user must be an administrator for the organization to use this endpoint. OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
org | string | The organization name. The name is not case sensitive. |
role_id | integer | The unique identifier of the role. |
username | string | The handle for the GitHub user account. |
page | integer | The page number of the results to fetch. For more information, see "Using pagination in the REST API." |
per_page | integer | The number of results per page (max 100). For more information, see "Using pagination in the REST API." |
SELECT examples
- list_org_role_users
Lists organization members that are assigned to an organization role. For more information on organization roles, see "Using organization roles."
To use this endpoint, you must be an administrator for the organization.
OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.
SELECT
id,
name,
gravatar_id,
node_id,
assignment,
avatar_url,
email,
events_url,
followers_url,
following_url,
gists_url,
html_url,
inherited_from,
login,
organizations_url,
received_events_url,
repos_url,
site_admin,
starred_at,
starred_url,
subscriptions_url,
type,
url,
user_view_type
FROM github.orgs.role_user_assignments
WHERE org = '{{ org }}' -- required
AND role_id = '{{ role_id }}' -- required
AND per_page = '{{ per_page }}'
AND page = '{{ page }}'
;
REPLACE examples
- assign_user_to_org_role
Assigns an organization role to a member of an organization. For more information on organization roles, see "Using organization roles."
The authenticated user must be an administrator for the organization to use this endpoint.
OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.
REPLACE github.orgs.role_user_assignments
SET
-- No updatable properties
WHERE
org = '{{ org }}' --required
AND username = '{{ username }}' --required
AND role_id = '{{ role_id }}' --required;
DELETE examples
- revoke_org_role_user
- revoke_all_org_roles_user
Remove an organization role from a user. For more information on organization roles, see "Using organization roles."
The authenticated user must be an administrator for the organization to use this endpoint.
OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.
DELETE FROM github.orgs.role_user_assignments
WHERE org = '{{ org }}' --required
AND username = '{{ username }}' --required
AND role_id = '{{ role_id }}' --required
;
Revokes all assigned organization roles from a user. For more information on organization roles, see "Using organization roles."
The authenticated user must be an administrator for the organization to use this endpoint.
OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.
DELETE FROM github.orgs.role_user_assignments
WHERE org = '{{ org }}' --required
AND username = '{{ username }}' --required
;