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
HVR 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 hvrhubconfig with the User_Access property.
- Grant a permission:
hvrhubconfig <hub_name> User_Access.<user_name>.<permission>=true
- Revoke a permission:
hvrhubconfig <hub_name> User_Access.<user_name>.<permission>=
- Remove all permissions:
hvrhubconfig <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:
hvrhubconfig <hub_name> User_Access="{\"user1\":{\"permission1\":true},\"user2\":{\"permission2\":true}}"
Option 2: JSON file
- Export the current configuration:
hvrhubconfig -o <path>/hub_config.json <hub_name>
- Edit the
User_Access
section in the file. - Re-import the file:
hvrhubconfig -i <path>/hub_config.json <hub_name>