Grant privileges to a role
PUT/metalakes/:metalake/permissions/roles/:role/:metadataObjectType/:metadataObjectFullName/grant
Grants privileges on a metadata object to a role and returns the updated role. The object must exist, and each privilege must be one that the object's type supports.
Sign in with a bearer token or a local user's password; see Authentication.
Request
Path Parameters
The name of the metalake
The name of the role
Possible values: [METALAKE, CATALOG, SCHEMA, FILESET, TABLE, VIEW, TOPIC, MODEL, TAG, POLICY, JOB_TEMPLATE, FUNCTION]
The type of the metadata object. The list is the set of types that at least one privilege can be bound to; granting or revoking a privilege on any other type fails with IllegalPrivilegeException. The server matches the value case-insensitively.
The full name of the metadata object
- application/json
Body
Array [
]
privileges
object[]
required
The privileges need to grant
Possible values: [create_catalog, use_catalog, create_schema, use_schema, create_table, modify_table, select_table, create_fileset, write_fileset, read_fileset, create_topic, produce_topic, consume_topic, manage_users, manage_groups, create_role, manage_grants, register_model, create_model, link_model_version, create_model_version, use_model, create_tag, apply_tag, create_policy, apply_policy, register_job_template, use_job_template, run_job, create_view, select_view, register_function, execute_function, modify_function, use_secrets, include_credential_secrets]
The name of the privilege, one of the values of Privilege.Name. Responses return the name in lowercase; requests accept any case. create_model and create_model_version are deprecated: the server still accepts them as aliases of register_model and link_model_version, and new requests should use the new names.
Possible values: [allow, deny]
The condition of the privilege, allow or deny. Responses return the value in lowercase; requests accept any case.
Responses
- 200
- 400
- 404
- 5xx
The role, with its securable objects and privileges after the grant.
- application/vnd.gravitino.v1+json
- Schema
- Example (from schema)
- RoleResponse
Schema
Array [
Array [
]
]
Possible values: [0]
Status code of the response
role
object
The name of the role
properties
object
nullable
A map of properties for the role
securableObjects
object[]
A list of securable objects
The full name of the securable object
Possible values: [metalake, catalog, schema, fileset, table, view, topic, model, tag, policy, job_template, function]
The type of the securable object. Only types that at least one privilege can be bound to are accepted, and each privilege in privileges must support the type. Responses return the value in lowercase; requests accept any case.
privileges
object[]
A list of privileges
Possible values: [create_catalog, use_catalog, create_schema, use_schema, create_table, modify_table, select_table, create_fileset, write_fileset, read_fileset, create_topic, produce_topic, consume_topic, manage_users, manage_groups, create_role, manage_grants, register_model, create_model, link_model_version, create_model_version, use_model, create_tag, apply_tag, create_policy, apply_policy, register_job_template, use_job_template, run_job, create_view, select_view, register_function, execute_function, modify_function, use_secrets, include_credential_secrets]
The name of the privilege, one of the values of Privilege.Name. Responses return the name in lowercase; requests accept any case. create_model and create_model_version are deprecated: the server still accepts them as aliases of register_model and link_model_version, and new requests should use the new names.
Possible values: [allow, deny]
The condition of the privilege, allow or deny. Responses return the value in lowercase; requests accept any case.
audit
object
Audit information for a Gravitino resource.
The user who created the resource
The time the resource was created
The user who last modified the resource
The time the resource was last modified
{
"code": 0,
"role": {
"name": "string",
"properties": {},
"securableObjects": [
{
"fullName": "string",
"type": "metalake",
"privileges": [
{
"name": "create_catalog",
"condition": "allow"
}
]
}
],
"audit": {
"creator": "string",
"createTime": "2024-07-29T15:51:28.071Z",
"lastModifier": "string",
"lastModifiedTime": "2024-07-29T15:51:28.071Z"
}
}
}
{
"code": 0,
"role": {
"name": "role1",
"properties": {
"k1": "v1"
},
"securableObjects": [
{
"fullName": "catalog1.schema1.table1",
"type": "table",
"privileges": [
{
"name": "select_table",
"condition": "allow"
}
]
}
]
}
}
A privilege is not supported by the object's type, or the same privilege is listed twice with different conditions.
- application/vnd.gravitino.v1+json
- Schema
- Example (from schema)
- IllegalPrivilegeException
Schema
Possible values: >= 1000 and <= 1100
HTTP response code
Internal type definition of the error
A human-readable message
Deprecated diagnostic stack trace. Enterprise omits it by default because it can expose internal implementation details. Operators can opt in for controlled diagnostics with gravitino.server.webserver.includeErrorStackTrace=true. See OWASP REST Security: Error handling and CWE-209.
{
"code": 1002,
"type": "string",
"message": "string"
}
{
"code": 1001,
"type": "IllegalPrivilegeException",
"message": "Doesn't support duplicated privilege name SELECT_TABLE with different condition",
"stack": [
"org.apache.gravitino.exceptions.IllegalPrivilegeException: Doesn't support duplicated privilege name SELECT_TABLE with different condition",
"..."
]
}
The metalake, the role or the metadata object does not exist.
- application/vnd.gravitino.v1+json
- Schema
- Example (from schema)
- NoSuchMetalakeException
- NoSuchMetadataObjectException
- NoSuchRoleException
Schema
Possible values: >= 1000 and <= 1100
HTTP response code
Internal type definition of the error
A human-readable message
Deprecated diagnostic stack trace. Enterprise omits it by default because it can expose internal implementation details. Operators can opt in for controlled diagnostics with gravitino.server.webserver.includeErrorStackTrace=true. See OWASP REST Security: Error handling and CWE-209.
{
"code": 1002,
"type": "string",
"message": "string"
}
{
"code": 1003,
"type": "NoSuchMetalakeException",
"message": "Failed to operate metalake(s) [test] operation [LOAD], reason [NoSuchMetalakeException]",
"stack": [
"org.apache.gravitino.exceptions.NoSuchMetalakeException: Metalake test does not exist",
"..."
]
}
{
"code": 1003,
"type": "NoSuchMetadataObjectException",
"message": "Metadata object does not exist",
"stack": [
"org.apache.gravitino.exceptions.NoSuchMetadataObjectException: Metadata object does not exist",
"..."
]
}
{
"code": 1003,
"type": "NoSuchRoleException",
"message": "Role does not exist",
"stack": [
"org.apache.gravitino.exceptions.NoSuchRoleException: Role does not exist",
"..."
]
}
The server hit an internal error that the client usually cannot fix by changing the request.
- application/vnd.gravitino.v1+json
- Schema
- Example (from schema)
- Example
Schema
Possible values: >= 1000 and <= 1100
HTTP response code
Internal type definition of the error
A human-readable message
Deprecated diagnostic stack trace. Enterprise omits it by default because it can expose internal implementation details. Operators can opt in for controlled diagnostics with gravitino.server.webserver.includeErrorStackTrace=true. See OWASP REST Security: Error handling and CWE-209.
{
"code": 1002,
"type": "string",
"message": "string"
}
{
"code": 1002,
"type": "RuntimeException",
"message": "Internal Server Error",
"stack": [
"java.lang.RuntimeException: Internal Server Error"
]
}