How Can I Manage User Permissions with the CLI?

Documentation: How Can I Manage User Permissions with the CLI?

How Can I Manage User Permissions with the CLI?

Question

How can I use the command line interface (CLI) to grant or revoke permissions for a single user, or update permissions for multiple users at once, without having to redefine the entire access list?

Environment

DSS 6

Answer

Replace all placeholders, such as <hub_name>, <user_name>, and <permission> with the correct values.

Manage permissions for a single user

To update permissions for a single user, use dsshubconfig with the User_Access property.

  • Grant a permission:
    dsshubconfig <hub_name> User_Access.<user_name>.<permission>=true
    
  • Revoke a permission:
    dsshubconfig <hub_name> User_Access.<user_name>.<permission>=
    
  • Remove all permissions:
    dsshubconfig <hub_name> User_Access.<user_name>=
    

Manage permissions for multiple users

To update permissions for multiple users, you must set the User_Access object in JSON format.

Option 1: Inline JSON

Provide the full User_Access object directly in the command as a JSON string:

dsshubconfig <hub_name> User_Access="{\"user1\":{\"permission1\":true},\"user2\":{\"permission2\":true}}"

Option 2: JSON file

  1. Export the current configuration:
    dsshubconfig -o <path>/hub_config.json <hub_name>
    
  2. Edit the User_Access section in the file.
  3. Re-import the file:
    dsshubconfig -i <path>/hub_config.json <hub_name>