Source: https://dev-docs.nebula-graph.io/v5.3.2/server-admin/authorization/alter-owner/ Documentation version: v5.3.2 # ALTER OWNER `ALTER OWNER` transfers ownership of a resource in the current service group to another user. ## Prerequisites First [connect to the Graph service](https://dev-docs.nebula-graph.io/v5.3.2/get-started/first-query/#connect). Run the command in a GQL client. - To change the owner of a resource object, you must be the owner of the resource object or the user with the role `ADMIN` in the service group. - The user that you want to change the owner to is already created and invited to the current service group. For more information, see [Create users](https://dev-docs.nebula-graph.io/v5.3.2/server-admin/authentication/manage-users/#create_users) and [INVITE USER](https://dev-docs.nebula-graph.io/v5.3.2/database-gql-reference/data-admin/invite-user/). ## Syntax Syntax diagramBNF alter_owner_command ```` alter_owner_command ::= 'ALTER' 'OWNER' resource_object_type resource_object_reference 'TO' 'USER' user_name ```` ## Parameters ### `resource_object_type` The type of the resource object whose owner you want to change. Supported resource object types are `SCHEMA`, `GRAPH TYPE`, `GRAPH`, and `PROCEDURE`. Note The owner of the default schema in the path `/default_schema` cannot be changed. For more information, see [CREATE SCHEMA](https://dev-docs.nebula-graph.io/v5.3.2/database-gql-reference/ddl/schema/create/). When the owner of a schema changes, the new owner gains implicit `USAGE` on the schema. The former owner loses the implicit access provided by schema ownership. Any `USAGE` previously granted directly or through a role remains effective; otherwise, the former owner must be granted `USAGE` to continue accessing the schema. For more information, see [Schema access control](https://dev-docs.nebula-graph.io/v5.3.2/server-admin/authorization/schema-access-control/). For more information, see [Operations available to resource owners](https://dev-docs.nebula-graph.io/v5.3.2/server-admin/authorization/privilege-reference/#operations_available_to_resource_owners). ### `resource_object_reference` A reference identifies the resource to transfer. Use a name in the current schema or a reference that includes the schema path: | Resource type | Reference in the current schema | Reference with a schema path | `SCHEMA` | `schema_reference` | `schema_reference` | `GRAPH TYPE`, `GRAPH`, and `PROCEDURE` | `graph_type_name` `graph_name` `procedure_name(parameter_type, ...)` | `schema_reference/graph_type_name` `schema_reference/graph_name` ``schema_reference/procedure_name`(parameter_type, ...)` - Always use `schema_reference` for a `SCHEMA` object. - For other objects, omit the schema path only when the object is in the current schema. Include `schema_reference` for objects in another schema. To set or view the current schema, see [SESSION SET SCHEMA](https://dev-docs.nebula-graph.io/v5.3.2/database-gql-reference/sessions/set/) and [SHOW CURRENT_SCHEMA](https://dev-docs.nebula-graph.io/v5.3.2/database-gql-reference/data-admin/show/show-current-schema/). - `schema_reference` can be the absolute or relative path of the schema. For more information, see [CREATE SCHEMA](https://dev-docs.nebula-graph.io/v5.3.2/database-gql-reference/ddl/schema/create/#schema_reference). - If multiple UDP signatures have the same name, specify the parameter types in the UDP reference. ### `user_name` The name of the user who is the new owner of the resource object. ## Examples Run these examples independently. User `user1` must have joined the service group. The `movie_type` and `movie` examples require the [example dataset](https://dev-docs.nebula-graph.io/v5.3.2/database-gql-reference/overview/example-dataset/) to be loaded in `/default_schema`. ### Change the owner of a schema ```` ''' CREATE SCHEMA IF NOT EXISTS /my_schema // Create a schema ''' ''' ALTER OWNER SCHEMA /my_schema TO USER user1 ''' ```` As the new schema owner, `user1` gains implicit access to `/my_schema`. The former owner loses the implicit access provided by schema ownership, but any `USAGE` previously granted directly or through a role remains effective. ### Change the owner of a graph type in the current schema ```` ''' SESSION SET SCHEMA /default_schema ''' ''' ALTER OWNER GRAPH TYPE movie_type TO USER user1 ''' ```` ### Change the owner of a graph type in the specified schema ```` ''' // Create a schema CREATE SCHEMA IF NOT EXISTS /my_schema ''' ''' // Set the schema for the current session SESSION SET SCHEMA /my_schema ''' ''' // Create a graph type in the specified schema CREATE GRAPH TYPE IF NOT EXISTS /my_schema/my_graph_type AS {} ''' ''' // Change the owner of a graph type in the specified schema ALTER OWNER GRAPH TYPE /my_schema/my_graph_type TO USER user1 ''' ```` ### Change the owner of a graph in the current schema ```` ''' SESSION SET SCHEMA /default_schema ''' ''' ALTER OWNER GRAPH movie TO USER user1 ''' ```` As a user with `ADMIN`, run `SHOW OBJECTS FOR USER user1` and confirm that the resource appears in the new owner's list. Alternatively, log in as `user1` and run `SHOW OBJECTS` to inspect its own resources. See [SHOW OBJECTS](https://dev-docs.nebula-graph.io/v5.3.2/database-gql-reference/data-admin/show/show-objects/) for command details.