Skip to content
Snippets Groups Projects

Create Debusine Role

  • Clone with SSH
  • Clone with HTTPS
  • Embed
  • Share
    The snippet can be accessed without any authentication.
    Authored by Stefano Rivera
    Edited
    snippetfile1.txt 331 B
    from debusine.db.models import Workspace, Group
    from debusine.db.models.permissions import ROLES
    from debusine.db.models.workspaces import WorkspaceRole, WorkspaceRoles
    
    WorkspaceRole.objects.create(resource=Workspace.objects.get(name='private'), group=Group.objects.from_scoped_name('debusine/Admins'), role=WorkspaceRoles.OWNER)
    • Ends up creating something like this:

       id | role  | group_id | resource_id 
      ----+-------+----------+-------------
        1 | owner |        1 |           2

      Where resource_id is a workspace id.

    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or to comment