role_assignments
Creates, updates, deletes, gets or lists a role_assignments resource.
Overview
| Name | role_assignments |
| Type | Resource |
| Id | openai_admin.users.role_assignments |
Fields
The following fields are returned by SELECT queries:
- list
User organization role assignments listed successfully.
| Name | Datatype | Description |
|---|---|---|
id | string | Identifier for the role. |
name | string | Name of the role. |
created_at | integer (unixtime) | When the role was created. |
created_by | string | Identifier of the actor who created the role. |
created_by_user_obj | object | User details for the actor that created the role, when available. |
description | string | Description of the role. |
metadata | object | Arbitrary metadata stored on the role. |
permissions | array | Permissions associated with the role. |
predefined_role | boolean | Whether the role is predefined by OpenAI. |
resource_type | string | Resource type the role applies to. |
updated_at | integer (int64) | When the role was last updated. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
list | select | user_id | limit, after, order | |
assign | insert | user_id, role_id | ||
unassign | delete | user_id, role_id |
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 |
|---|---|---|
role_id | string | The ID of the organization role to remove from the user. |
user_id | string | The ID of the user to modify. |
after | string | Cursor for pagination. Provide the value from the previous response's next field to continue listing organization roles. |
limit | integer | A limit on the number of organization role assignments to return. |
order | string | Sort order for the returned organization roles. |
SELECT examples
- list
User organization role assignments listed successfully.
SELECT
id,
name,
created_at,
created_by,
created_by_user_obj,
description,
metadata,
permissions,
predefined_role,
resource_type,
updated_at
FROM openai_admin.users.role_assignments
WHERE user_id = '{{ user_id }}' -- required
AND limit = '{{ limit }}'
AND after = '{{ after }}'
AND order = '{{ order }}'
;
INSERT examples
- assign
- Manifest
No description available.
INSERT INTO openai_admin.users.role_assignments (
role_id,
user_id
)
SELECT
'{{ role_id }}' /* required */,
'{{ user_id }}'
RETURNING
object,
role,
user
;
# Description fields are for documentation purposes
- name: role_assignments
props:
- name: user_id
value: "{{ user_id }}"
description: Required parameter for the role_assignments resource.
- name: role_id
value: "{{ role_id }}"
description: |
Identifier of the role to assign.
DELETE examples
- unassign
No description available.
DELETE FROM openai_admin.users.role_assignments
WHERE user_id = '{{ user_id }}' --required
AND role_id = '{{ role_id }}' --required
;