Skip to main content

Adding Users to Usersets

Creating Usersets#

Usersets can be used to represent groups or teams within your platform. When usersets are granted permissions (both actions or roles) on resource objects, all of the users in that userset inherit those permissions.

Usersets can be created in the following way:

vc.usersets.create('userset_id', 'customer_org_id')
vc.usersets.grant_action('userset_id', 'action', 'resource_type', 'resource_object_id')

Inheritance#

When a userset is created, you can specify a parent userset to inherit from. All of the permissions granted on the parent userset are also granted to the new child userset.

The following shows how nested usersets could be used:

# create parent usersetv.usersets.create('organization', 'customer_org_id')
# create children usersetsv.usersets.create('administration', ['organization'], 'customer_org_id')v.usersets.create('school_staff', ['organization'], 'customer_org_id')
v.usersets.create('board', ['administration'], 'customer_org_id')v.usersets.create('finance', ['administration'], 'customer_org_id')v.usersets.create('operations', ['administration'], 'customer_org_id')v.usersets.create('hr', ['administration'], 'customer_org_id')
v.usersets.create('teachers', ['school_staff'], 'customer_org_id')v.usersets.create('parents', ['school_staff'], 'customer_org_id')v.usersets.create('students', ['school_staff'], 'customer_org_id')

In our example, we've created a heirarchy of groups within an edtech platform for an entire school - each would inherit permissions from their parent.

Adding Users to Usersets#

Users can be added to usersets in the following way:

v.users.assign_to_userset('user_id', 'userset_id')