Skip to content

Commit cd4123b

Browse files
authored
docs: ownership updated (#1176)
* updated * Update 10-grant.md
1 parent af90510 commit cd4123b

File tree

3 files changed

+23
-12
lines changed

3 files changed

+23
-12
lines changed

docs/en/guides/56-security/access-control/03-ownership.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,22 @@
22
title: Ownership
33
---
44

5-
Ownership is a specialized privilege that signifies the exclusive rights and responsibilities a role holds over a specific data object (currently including a database, table, UDF, and stage) within Databend. The ownership of an object is automatically granted to the current role of the user who creates it.
5+
Ownership is a specialized privilege that signifies the exclusive rights and responsibilities a role holds over a specific data object (currently including a database, table, UDF, and stage) within Databend.
66

77
## Granting Ownership
88

9-
The ownership of an object can be granted from one role to another. Once it is granted from one role to another, the ownership is transferred to the new role.
9+
An object's ownership is automatically granted to the role of the user who creates it and can be transferred between roles using the [GRANT](/sql/sql-commands/ddl/user/grant) command:
1010

11-
- Granting ownership to the built-in role `public` is not recommended for security reasons. If a user is in the `public` role when creating a object, then all users will have ownership of the object because each Databend user has the `public` role by default. Databend recommends creating and assigning customized roles to users instead of using the `public` role for clarified ownership management. For information about the built-in roles, see [Built-in Roles](02-roles.md).
12-
- If a role that has ownership of an object is deleted, an account_admin can grant ownership of the object to another role.
11+
- Granting ownership of an object to a new role transfers full ownership to the new role, removing it from the previous role. For example, if Role A initially owns a table and you grant ownership to Role B, Role B will become the new owner, and Role A will no longer have ownership rights to that table.
12+
- Granting ownership to the built-in role `public` is not recommended for security reasons. If a user is in the `public` role when creating a object, then all users will have ownership of the object because each user has the `public` role by default. Databend recommends creating and assigning customized roles to users instead of using the `public` role for clarified ownership management. For information about the built-in roles, see [Built-in Roles](02-roles.md).
1313
- Ownership cannot be granted for tables in the `default` database, as it is owned by the built-in role `account_admin`.
1414

15-
Dropping an object will revoke ownership from the owner role. However, restoring (UNDROP, if available) a dropped object will NOT restore ownership. In this case, you will need an `account_admin` to grant ownership to a role again.
15+
## Revoking Ownership Not Allowed
16+
17+
Revoking ownership is *not* supported because every object must have an owner.
18+
19+
- If an object is dropped, it will not retain its ownership by the original role. If the object is restored (if possible), ownership will not be automatically reassigned, and an `account_admin` will need to manually reassign ownership to a role.
20+
- If a role that owns an object is deleted, an `account_admin` can transfer ownership of the object to another role.
1621

1722
## Examples
1823

docs/en/sql-reference/10-sql-commands/00-ddl/02-user/10-grant.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ import FunctionDescription from '@site/src/components/FunctionDescription';
66

77
<FunctionDescription description="Introduced or updated: v1.2.275"/>
88

9-
Grants privileges, roles, and ownership of a specific database object. This involves:
9+
Grants privileges, roles, and ownership for a specific database object. This includes:
1010

11-
- Granting privileges to a user or a role.
12-
- Granting a role to a user or a role.
13-
- Granting ownership to a role.
11+
- Granting privileges to users or roles.
12+
- Assigning roles to users or other roles.
13+
- Transferring ownership to a role.
1414

1515
See also:
1616

@@ -21,6 +21,8 @@ See also:
2121

2222
### Granting Privileges
2323

24+
To understand what a privilege is and how it works, see [Privileges](/guides/security/access-control/privileges).
25+
2426
```sql
2527
GRANT {
2628
schemaObjectPrivileges | ALL [ PRIVILEGES ] ON <privileges_level>
@@ -62,6 +64,8 @@ privileges_level ::=
6264

6365
### Granting Role
6466

67+
To understand what a role is and how it works, see [Roles](/guides/security/access-control/roles).
68+
6569
```sql
6670
-- Grant a role to a user
6771
GRANT ROLE <role_name> TO <user_name>
@@ -72,6 +76,8 @@ GRANT ROLE <role_name> TO ROLE <role_name>
7276

7377
### Granting Ownership
7478

79+
To understand what ownership is and how it works, see [Ownership](/guides/security/access-control/ownership).
80+
7581
```sql
7682
-- Grant ownership of a specific table within a database to a role
7783
GRANT OWNERSHIP ON <database_name>.<table_name> TO ROLE '<role_name>'

docs/en/sql-reference/10-sql-commands/00-ddl/02-user/11-revoke.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ import FunctionDescription from '@site/src/components/FunctionDescription';
66

77
<FunctionDescription description="Introduced or updated: v1.2.275"/>
88

9-
Revokes privileges, roles, and ownership of a specific database object. This involves:
9+
Revokes privileges, roles, and ownership of a specific database object. This includes:
1010

11-
- Revoking privileges from a user or a role.
12-
- Revoking a role from a user or a role.
11+
- Revoking privileges from users or roles.
12+
- Removing roles from users or other roles.
1313

1414
See also:
1515

0 commit comments

Comments
 (0)