- Notifications
You must be signed in to change notification settings - Fork913
feat: implement WorkspaceCreationBan org role#16686
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
36d9f5d
1b998d0
41148d9
a3f3837
59e1eb1
b415ee4
3fef4ef
5178cbd
2525852
024a8ba
b1c77ca
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -112,6 +112,7 @@ func TestRolePermissions(t *testing.T) { | ||
// Subjects to user | ||
memberMe := authSubject{Name: "member_me", Actor: rbac.Subject{ID: currentUser.String(), Roles: rbac.RoleIdentifiers{rbac.RoleMember()}}} | ||
orgMemberMe := authSubject{Name: "org_member_me", Actor: rbac.Subject{ID: currentUser.String(), Roles: rbac.RoleIdentifiers{rbac.RoleMember(), rbac.ScopedRoleOrgMember(orgID)}}} | ||
orgMemberMeBanWorkspace := authSubject{Name: "org_member_me_workspace_ban", Actor: rbac.Subject{ID: currentUser.String(), Roles: rbac.RoleIdentifiers{rbac.RoleMember(), rbac.ScopedRoleOrgMember(orgID), rbac.ScopedRoleOrgWorkspaceCreationBan(orgID)}}} | ||
groupMemberMe := authSubject{Name: "group_member_me", Actor: rbac.Subject{ID: currentUser.String(), Roles: rbac.RoleIdentifiers{rbac.RoleMember(), rbac.ScopedRoleOrgMember(orgID)}, Groups: []string{groupID.String()}}} | ||
owner := authSubject{Name: "owner", Actor: rbac.Subject{ID: adminID.String(), Roles: rbac.RoleIdentifiers{rbac.RoleMember(), rbac.RoleOwner()}}} | ||
@@ -181,20 +182,30 @@ func TestRolePermissions(t *testing.T) { | ||
Actions: []policy.Action{policy.ActionRead}, | ||
Resource: rbac.ResourceWorkspace.WithID(workspaceID).InOrg(orgID).WithOwner(currentUser.String()), | ||
AuthorizeMap: map[bool][]hasAuthSubjects{ | ||
true: {owner, orgMemberMe, orgAdmin, templateAdmin, orgTemplateAdmin, orgMemberMeBanWorkspace}, | ||
false: {setOtherOrg, memberMe, userAdmin, orgAuditor, orgUserAdmin}, | ||
}, | ||
}, | ||
{ | ||
Name: "UpdateMyWorkspaceInOrg", | ||
Emyrk marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
// When creating the WithID won't be set, but it does not change the result. | ||
Actions: []policy.Action{policy.ActionUpdate}, | ||
Resource: rbac.ResourceWorkspace.WithID(workspaceID).InOrg(orgID).WithOwner(currentUser.String()), | ||
AuthorizeMap: map[bool][]hasAuthSubjects{ | ||
true: {owner, orgMemberMe, orgAdmin}, | ||
false: {setOtherOrg, memberMe, userAdmin, templateAdmin, orgTemplateAdmin, orgUserAdmin, orgAuditor}, | ||
}, | ||
}, | ||
{ | ||
Name: "CreateDeleteMyWorkspaceInOrg", | ||
// When creating the WithID won't be set, but it does not change the result. | ||
Actions: []policy.Action{policy.ActionCreate, policy.ActionDelete}, | ||
Resource: rbac.ResourceWorkspace.WithID(workspaceID).InOrg(orgID).WithOwner(currentUser.String()), | ||
AuthorizeMap: map[bool][]hasAuthSubjects{ | ||
true: {owner, orgMemberMe, orgAdmin}, | ||
false: {setOtherOrg, memberMe, userAdmin, templateAdmin, orgTemplateAdmin, orgUserAdmin, orgAuditor, orgMemberMeBanWorkspace}, | ||
}, | ||
}, | ||
{ | ||
Name: "MyWorkspaceInOrgExecution", | ||
// When creating the WithID won't be set, but it does not change the result. | ||
@@ -951,6 +962,7 @@ func TestListRoles(t *testing.T) { | ||
fmt.Sprintf("organization-auditor:%s", orgID.String()), | ||
fmt.Sprintf("organization-user-admin:%s", orgID.String()), | ||
fmt.Sprintf("organization-template-admin:%s", orgID.String()), | ||
fmt.Sprintf("organization-workspace-creation-ban:%s", orgID.String()), | ||
}, | ||
orgRoleNames) | ||
} | ||
Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.