Repository navigation
[PAI-2148] feat: manage custom roles and permission schemes on the v2 client #86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
1c9188b
ded3117
7b8abbd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -446,6 +446,27 @@ slug and no primary key: | |
|
|
||
| ```python | ||
| client.v2.workspaces.permissions.me("acme") | ||
| client.v2.workspaces.teamspaces.my_permissions("acme", teamspace_id) | ||
| ``` | ||
|
|
||
| Custom roles are built from permission schemes. The catalogue lists the keys a | ||
| scheme may grant; the server adds each key's prerequisites on save: | ||
|
Comment on lines
+452
to
+453
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. State the prerequisites before the first write. The PR reports that older servers return
|
||
|
|
||
| ```python | ||
| from plane.models.v2 import CreatePermissionScheme, CreateRole, UpdateRole | ||
|
|
||
| ws = client.v2.workspaces | ||
| catalogue = ws.permissions.resources("acme", namespace="project") | ||
| scheme = ws.permission_schemes.create( | ||
| "acme", | ||
| CreatePermissionScheme(name="Triage", namespace="project", permissions=["workitem:edit"]), | ||
| ) | ||
| role = ws.roles.create( | ||
| "acme", CreateRole(name="Triager", namespace="project", permission_scheme_ids=[scheme.id]) | ||
| ) | ||
| ws.permission_schemes.impact("acme", scheme.id) # roles, users, projects a change reaches | ||
| ws.roles.update("acme", role.id, UpdateRole(status="inactive", reassign_to=other_role_id)) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Resolve the replacement role before creating the scheme and role. The example first uses
|
||
| ws.roles.delete("acme", role.id, reassign_to=other_role_id) # needed when it has members | ||
| ``` | ||
|
|
||
| `group_sync` groups three resources under one namespace without consuming a path | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Show where
teamspace_idcomes from.The example does not define
teamspace_id. A reader who has only set upclientgetsNameErrorbefore the SDK sends the request. Show a lookup such asteamspaces.find_by_name("acme", "Platform").id, or state that the reader must supply an existing teamspace ID. (raw.githubusercontent.com)