Managing Space Users via the Command Line
You can use the datasphere command line interface to add and remove users from spaces and to update user roles in spaces.
Prerequisites
-
Data Warehouse General (-R------) - To access SAP Datasphere.
-
Spaces (-RU-----) - To open and update your space in the Space Management tool.
-
Space Files (-R------) - To view objects in your space.
-
Scoped Role User Assignment (-------M) - To manage the users who can access your space.
-
Install the datasphere command line interface (see Install or Update the SAP Datasphere Command Line Interface).
-
Log in to your SAP Datasphere tenant (see Log into the Command Line Interface via an OAuth Client).
datasphere spaces usersFor general information about working with space users, see Control User Access to Your Space.
List Space Users
You can read a list of users in your space and optionally write it to a file.
datasphere spaces users read
--space <ID>
[--accept <format>]
[--output <file>.json]
|
Parameter |
Description |
|---|---|
|
--space <ID> |
Enter the ID of your space. |
|
--accept <format> |
[optional] Specify the format to return the list in. You can choose between:
|
|
--output <file>.json |
[optional] Enter a path to a .json file to write the output to. If you do not include this option, the output will be printed to the command line. |
Add Users to a Space
To add a user to your space, you must add them to a scoped role that includes your space as a scope and gives the appropriate privileges.
datasphere spaces users add
--space <ID>
--file-path <file>.json|--input '<stringified-json>'
|
Parameter |
Description |
|---|---|
|
--space <ID> |
Enter the ID of your space. |
|
--file-path <file>.json |
Enter a path to a file with a .json extension containing the list of users to add and the scoped roles you want to add them to: [
{
"id": "<UserID>",
"roles": "<RoleID[,RoleID...]>"
},
{
"id": "<UserID>",
"roles": "<RoleID[,RoleID...]>"
}
]
Each user must exist on your tenant and each scoped role that you assign them to must include your space as a scope. |
datasphere spaces users add --space SALES_US --file-path add.jsonWhere the file add.json contains the following (where <package> and <id> for the tenant are t and W respectively):
[
{
"id": "BBAXTER",
"roles": ["Sales_Admin","Sales_Modeler"]
},
{
"id": "JJONES",
"roles": ["Sales_Modeler"]
}
]
Update Space User Roles
You can update the roles that are assigned to users for your space. For example you may want to remove a user's modeling privileges and leave here only with viewing privileges
datasphere spaces users update
--space <ID>
--file-path <file>.json|--input '<stringified-json>'
|
Parameter |
Description |
|---|---|
|
--space <ID> |
Enter the ID of your space. |
|
--file-path <file>.json |
Enter a path to a file with a .json extension containing containing the list of users to update and the new scoped roles you want them to belong to [
{
"id": "<UserID>",
"roles": ["<RoleID>","<RoleID>"]
},
{
"id": "<UserID>",
"roles": ["<RoleID>","<RoleID>"]
}
]
|
datasphere spaces users update --space SALES_US --file-path update.jsonWhere the file update.json contains the following:
[
{
"id": "BBAXTER",
"roles": ["Sales_Modeler","Sales_Integrator"]
},
{
"id": "JJONES",
"roles": ["Sales_Space_Admin"]
}
]
Remove Users from a Space
You can remove users from your space.
datasphere spaces users remove
--space <ID>
--file-path <file>.json|--input '<stringified-json>'
|
Parameter |
Description |
|---|---|
|
--space <ID> |
Enter the ID of your space. |
|
--file-path <file>.json |
Enter a path to a file with a .json extension containing the list of users to remove and the scoped roles to remove them from: [
{
"id": "<UserID>",
"role": "<RoleID>"
},
{
"id": "<UserID>",
"role": "<RoleID>"
}
]
|
datasphere spaces users remove --space SALES_US --file-path remove.jsonWhere the file remove.json contains the following:
[
{
"id": "BBAXTER",
"role": "Sales_Modeler"
},
{
"id": "BBAXTER",
"role": "Sales_Integrator"
}
]