Change Password

Input error
Input error
Input error
Submit
v2.x

User and Privilege

Privilege and Policy

List Privilege

Example: List all privileges:

List<Table> tables = client.listPrivilege();

List Policy

Example: List all policies:

List<Table> tables = client.listPolicy();

Get Policy Detail

Example: Get detail of policy 'sales':

List<PairValue> values = client.getPolicy("sales");

Create Policy

Example: Create policy 'sales' that contains graphset privilege QUERY for graphset 'default':

CreatePolicyRequest request = new CreatePolicyRequest();
request.setName("sales");
Privilege privilege = new Privilege();
privilege.setGraphName("default");
privilege.setPrivileges(Arrays.asList("QUERY"));
request.setGraphPrivileges(Arrays.asList(privilege));
client.createPolicy(request);

Example: Create policy 'sales1' that contains graphset privilege INSERT for graphset 'default' and the policy 'sales' as sub-policy:

CreatePolicyRequest request = new CreatePolicyRequest();
request.setName("sales1");
Privilege privilege = new Privilege();
privilege.setGraphName("default");
privilege.setPrivileges(Arrays.asList("INSERT"));
request.setGraphPrivileges(Arrays.asList(privilege));
request.setPolicies(Arrays.asList("sales"));
client.createPolicy(request);

Update Policy

Example: Update policy 'salas' to contain graphset privileges QUERY and UPDATE for graphset 'default':

UpdatePolicyRequest request = new UpdatePolicyRequest();
request.setName("sales");
Privilege privilege = new Privilege();
privilege.setGraphName("default");
privilege.setPrivileges(Arrays.asList("QUERY", "UPDATE"));
request.setGraphPrivileges(Arrays.asList(privilege));
client.updatePolicy(request);

Delete Policy

Example: Delete policy 'sales1:

DeletePolicyRequest request = new DeletePolicyRequest();
request.setName("sales1");
client.deletePolicy(request);

User Management

List User

List<Table> tables = client.listUser();

Get User Detail

List<PairValue> values = client.getUser(username);

Get Self Info

Example: Get information of current user:

List<PairValue> values = client.getSelfInfo();

Create User

Example: Create user with username and password:

CreateUserRequest request = new CreateUserRequest();
request.setUsername(username);
request.setPassword(password);
client.createUser(request);

Example: Create user with username and password, grant policy 'sales', and grant graphset privileges QUERY and UPDATE for graphset 'default':

CreateUserRequest request = new CreateUserRequest();
request.setUsername(username);
request.setPassword(password);
Privilege privilege = new Privilege();
privilege.setGraphName("default");
privilege.setPrivileges(Arrays.asList("QUERY", "UPDATE"));
request.setGraphPrivileges(Arrays.asList(privilege));
request.setPolicies(Arrays.asList("sales"));
client.createUser(request);

Update User

Example: Update user's password:

UpdateUserRequest request = new UpdateUserRequest();
request.setUsername(username);
request.setPassword(newpassword);
client.updateUser(request);

Grant Privileges and/or Polices to User

Example: Grant user 'company' with graphset privileges QUERY and UPDATE for graphset 'default' and policy 'sales':

GrantRequest request = new GrantRequest();
request.setUsername("company");
Privilege privilege = new Privilege();
privilege.setGraphName("default");
privilege.setPrivileges(Arrays.asList("QUERY", "UPDATE"));
request.setGraphPrivileges(Arrays.asList(privilege));
request.setPolicies(Arrays.asList("sales"));
client.grant(request);

Revoke Privileges and/or Polices from User

Example: Revoke graphset privileges QUERY and UPDATE for graphset 'default' and policy 'sales' from user 'company':

RevokeRequest request = new RevokeRequest();
request.setUsername("company");
Privilege privilege = new Privilege();
privilege.setGraphName("default");
privilege.setPrivileges(Arrays.asList("QUERY", "UPDATE"));
request.setGraphPrivileges(Arrays.asList(privilege));
request.setPolicies(Arrays.asList("sales"));
client.revoke(request);

Delete User

client.deleteUser(username);