Database user mutation examples
All database users must be connected to the same domain. Connecting a database user two two database from different domains should trow an exception.
A new user should always contain a password, an existing user can have an empty password. In this case the password will remain unchanged.
When referencing a database and the delete flag is set to true the connection to this database will be removed. When the last connection to a database for a user is removed the user is removed entirely. Database can be left empty to not make any changes in the database connections.
When database is left empty and delete flag is set to false the API should trow an exception. If the delete flag is set to true the user should be deleted entirely with all its connections.
Add / change database user
For all add / change examples we use the same CreateDatabaseUser query:
mutation CreateDatabaseUser($databaseUser: DatabaseUserInput!) {
DatabaseUser(entity: $databaseUser, delete: false) {
id
username
__typename
databases {
database
domain {
id
}
}
domain {
id
}
}
}
New user to database
var variables = {
"databaseUser": {
"username": "user1",
"databases": {
456,
}
"password": "password"
}
}
Existing user to database
var variables = {
"databaseUser": {
"id": 1234,
"databases": {
456
}
}
}
Change user password without changing database connections
var variables = {
"databaseUser": {
"id": 1234,
"password": "password"
}
}
Delete database user
For all delete examples we use the DeleteDatabaseUser query:
mutation DeleteDatabaseUser($databaseUser: DatabaseUserInput!) {
DatabaseUser(entity: $databaseUser, delete: true) {
id
__typename
}
}
Delete single connection
var variables = {
"databaseUser": {
"id": 1234,
"databases": {
456
}
}
}
Delete user with all connections
var variables = {
"databaseUser": {
"id": 1234
}
}