Multi-graph management
The Lindorm graph engine lets you manage multiple isolated subgraphs within the same instance and control per-subgraph permissions for users and roles. This topic describes common operations for subgraph management, subgraph user management, and subgraph role management.
Permissions
Permission types
|
Permission |
Description |
|
|
Read permission. To query data, the user must have read permission on the target subgraph. |
|
|
Write permission. In the User Management module of the console, both |
|
|
A global |
Authorization scope
-
GLOBAL: Global grant and revoke. When a user is granted a global permission, the user has the corresponding operation permission on all data objects in the entire graph engine. For example, the global
READpermission lets the user query any subgraph. -
Subgraph scope (database): Grant and revoke at the database granularity. When a user is granted access to a subgraph (database), the user has the corresponding operation permission on all data objects inside that subgraph.
Multi-graph overview
The Lindorm graph engine supports a multi-graph management mode. In this mode, a single Lindorm Graph instance can host multiple logically isolated subgraphs. Each subgraph has its own schema and data, which is suitable for multi-tenant or multi-business data isolation scenarios.
-
Global
ADMIN: for example, the initial ROOT account, a console account that is granted globalADMIN, or an account granted globalADMINvia the grant API described in this topic. -
Role: defines a user's access permission on a specific subgraph, such as read-only or read/write.
Prerequisites
-
The Lindorm graph engine service is activated.
-
An access whitelist is configured based on your network environment so that your client can access the Lindorm instance.
Quick start: create and grant a read-only user
This section walks you through the full workflow of creating a read-only user. The example goal is: create a read-only user named graphreader for the subgraph default.
-
(Optional) Create a new subgraph.
If the defaultdefaultsubgraph does not meet your business needs, you can create a new subgraph using the primary account. If you use thedefaultsubgraph, skip this step. -
Create a user.
Use the primary account to call the Add a user API to create a user namedgraphreader. -
Grant a role to the user.
Use a globalADMINuser to call the Grant a role API to grant theREADERrole on thedefaultsubgraph to thegraphreaderuser.
The graphreader user can now use its credentials to perform read-only access on the default subgraph.
Subgraph management
Create a subgraph
-
Request URL:
POST /db/add -
Description: creates a new subgraph.
-
Required permission: can be called only by a global
ADMINaccount. -
Sample request:
curl -X POST 'http://{host}:{port}/db/add' \ -H 'Content-Type: application/json' \ -u 'root_user:root_password' \ -d '{ "db": "my_graph", "params": {} }' -
Parameters:
Field
Type
Required
Description
db
String
Yes
The subgraph name. Only lowercase letters (a-z), digits (0-9), and underscores (_) are allowed. Note:
usercannot be used as the name.params
JSON
No
Additional configuration parameters for the subgraph, provided as a JSON object.
-
Sample response:
{ "status": "200 OK", "payload": { "result": true } }
List subgraphs
-
Request URL:
GET /db/listorGET /db/list?db={dbName} -
Description: lists one or all subgraphs.
-
Required permission: any authenticated user can call this API.
-
Sample request:
# List all subgraphs curl -X GET 'http://{host}:{port}/db/list' \ -u 'root_user:root_password' # List a specific subgraph curl -X GET 'http://{host}:{port}/db/list?db=my_graph' \ -u 'root_user:root_password' -
Parameters:
Parameter
Type
Required
Description
db
String
No
The name of the subgraph to query. If left empty, all subgraphs in the current instance are returned.
-
Sample response:
{ "status": "200 OK", "payload": [ { "creationTime": 1670813317324, "dbName": "my_graph", "lastModified": 1670813317324, "params": "{}" }, { "creationTime": 1670813326798, "dbName": "my_graph_02", "lastModified": 1670813326798, "params": "{}" } ] }
Delete a subgraph
-
Request URL:
GET /db/del -
Description: deletes the specified subgraph and all data it contains.
-
Required permission: can be called only by a global
ADMINaccount. -
Sample request:
curl -X GET 'http://{host}:{port}/db/del?db=my_graph' \ -u 'root_user:root_password'NoteIf db is passed as default, the operation clears the database, but default still exists. If another schema is passed, the entire db is deleted.
-
Parameters:
Parameter
Type
Required
Description
db
String
Yes
The name of the subgraph to delete.
-
Sample response:
{ "status": "200 OK", "payload": { "result": true } }
User management
Accounts and passwords are shared across all engines in the same instance: deleting a user or changing a user's password affects every engine of the current instance. Perform these operations in the console.
Add a user
-
Request URL:
GET /user/add?user={name}&password={pwd} -
Description: creates a user for accessing subgraphs. Functionally equivalent to creating a user on the User Management page of the console.
-
Required permission: can be called only by a global
ADMINuser. -
Sample request:
curl -X GET 'http://{host}:{port}/user/add?user=sub_user_01&password=sub_pwd_01' \ -u 'root_user:root_password' -
Parameters:
Parameter
Type
Required
Description
user
String
Yes
The name of the new user.
password
String
Yes
The login password of the user.
-
Sample response:
{ "status": "200 OK", "payload": { "result": true } }
List users
-
Request URL:
GET /user/listorGET /user/list?user={name} -
Description: queries the information and role assignments of one or all users.
-
Required permission: can be called only by a global
ADMINuser. -
Sample request:
# List all users curl -X GET 'http://{host}:{port}/user/list' \ -u 'root_user:root_password' # List a specific user curl -X GET 'http://{host}:{port}/user/list?user=sub_user_01' \ -u 'root_user:root_password' -
Parameters:
Parameter
Type
Required
Description
user
String
No
The name of the user to query. If left empty, all users are returned.
-
Sample response:
NoteThe * below stands for global.
{ "payload": [ { "roles": { "test1": "WRITER", "test2": "WRITER", "test4": "WRITER" }, "user": "test_user" }, { "roles": { "*": "ADMIN" }, "user": "root" }, { "roles": { "*": "ADMIN" }, "user": "test_user_admin" } ], "status": "200 OK" }
Subgraph role management
Grant a role
-
Request URL:
GET /role/grant?db={dbName}&user={name}&role={role} -
Description: grants a specified user the role permissions to access a specific subgraph.
-
Required permission: a global
ADMINuser. -
Sample request:
curl -X GET 'http://{host}:{port}/role/grant?db=my_graph&user=sub_user_01&role=WRITER' \ -u 'root_user:root_password' -
Parameters:
Parameter
Type
Required
Description
db
String
Yes
The name of the target subgraph. Use * to grant GLOBAL permission.
user
String
Yes
The name of the target user.
role
String
Yes
The role name to grant. Must be uppercase.
-
READER: Read-only permission. The user can perform read operations only on the granted subgraphs. -
WRITER: Read/write permission. Includes allREADERpermissions plus write permission. -
ADMIN: When an account is granted globalADMIN, it can create subgraphs, create accounts, purge subgraphs, and so on. (In the User Management module of the console, READ, WRITE, and ADMIN must be granted together.)
-
-
Sample response:
{ "status": "200 OK", "payload": { "result": true } }
Revoke a role
-
Request URL:
GET /role/revoke?db={dbName}&user={name} -
Description: revokes all permissions of a specified user on a specific subgraph.
-
Required permission: global
ADMINuser. -
Sample request:
curl -X GET 'http://{host}:{port}/role/revoke?db=my_graph&user=sub_user_01' \ -u 'root_user:root_password'NoteYou cannot revoke your own ADMIN role.
-
Parameters:
Parameter
Type
Required
Description
db
String
Yes
The name of the target subgraph.
user
String
Yes
The name of the target user.
-
Sample response:
{ "status": "200 OK", "payload": { "result": true } }
List all role assignments
-
Request URL:
GET /role/all -
Description: lists all user-subgraph-role assignments in the current instance, for permission audit purposes.
-
Required permission: global
ADMINuser. -
Sample request:
curl -X GET 'http://{host}:{port}/role/all' \ -u 'root_user:root_password' -
Sample response:
{ "payload": [ { "dbName": "test1", "role": "WRITER", "user": "test_user" }, { "dbName": "test2", "role": "WRITER", "user": "test_user" }, { "dbName": "test3", "role": "WRITER", "user": "test_user" }, { "dbName": "*", "role": "ADMIN", "user": "test_user_admin" }, { "dbName": "*", "role": "ADMIN", "user": "root" } ], "status": "200 OK" }