Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: Role assign ui fixes#3521

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

Merged
Emyrk merged 14 commits intomainfromstevenmasley/assign_roles_ui
Aug 16, 2022
Merged

fix: Role assign ui fixes#3521

Emyrk merged 14 commits intomainfromstevenmasley/assign_roles_ui
Aug 16, 2022

Conversation

Emyrk
Copy link
Member

@EmyrkEmyrk commentedAug 15, 2022
edited
Loading

What this does

Roles you cannot assign are disabled

Screenshot from 2022-08-15 16-09-40

Fixes

User admin also needs the ability to create organization_members to create a new user. Creating a new user assigns them to the single org atm.

ntimo and Kira-Pilot reacted with heart emoji
Comment on lines +126 to +129
ResourceRoleAssignment: {ActionCreate, ActionRead, ActionUpdate, ActionDelete},
ResourceUser: {ActionCreate, ActionRead, ActionUpdate, ActionDelete},
// Full perms to manage org members
ResourceOrganizationMember: {ActionCreate, ActionRead, ActionUpdate, ActionDelete},
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Needs org_member role to create new users
RoleAssignment to assign roles. They can only assign org_member and member roles right now.

@EmyrkEmyrk marked this pull request as ready for reviewAugust 15, 2022 21:18
@EmyrkEmyrk requested a review froma team as acode ownerAugust 15, 2022 21:18
export const getSiteRoles = async (): Promise<Array<TypesGen.Role>> => {
const response = await axios.get<Array<TypesGen.Role>>(`/api/v2/users/roles`)
export const getSiteRoles = async (): Promise<Array<TypesGen.AssignableRoles>> => {
const response = await axios.get<Array<TypesGen.AssignableRoles>>(`/api/v2/users/roles`)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Eventually, it would be nice differentiate the tworoles endpoints by label a bit more. In the network tab, all I see is "roles" and it's hard to filter or figure out what I'm looking at.

Emyrk reacted with thumbs up emoji
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Not a bad idea

@Kira-Pilot
Copy link
Member

Kira-Pilot commentedAug 15, 2022
edited
Loading

Nice job! Do you mind adding two tests?

  1. a new story inRoleSelect.stories.tsx that showcases the disabled state. You can make a new test entity for assignable roles insite/src/testHelpers/entities.ts.
  2. a new test in a new file:site/src/components/RoleSelect/RoleSelect.test.tsx that ensures non-assignable roles are disabled. You can use your new test entity here, too. You should be able to test for disabled state by doing something like:
    expect(stevensListItem).toHaveProperty('disabled', true)

LMK if you need help!

@Emyrk
Copy link
MemberAuthor

Nice job! Do you mind adding two tests?

  1. a new story inRoleSelect.stories.tsx that showcases the disabled state. You can make a new test entity for assignable roles insite/src/testHelpers/entities.ts.
  2. a new test in a new file:site/src/components/RoleSelect/RoleSelect.test.tsx that ensures non-assignable roles are disabled. You can use your new test entity here, too. You should be able to test for disabled state by doing something like:
    expect(stevensListItem).toHaveProperty('disabled', true)

LMK if you need help!

Will get on this tomorrow 👍

Kira-Pilot reacted with hooray emoji

@@ -251,8 +251,8 @@ func TestRolePermissions(t *testing.T) {
Actions: []rbac.Action{rbac.ActionCreate, rbac.ActionUpdate, rbac.ActionDelete},
Resource: rbac.ResourceRoleAssignment,
AuthorizeMap: map[bool][]authSubject{
true: {admin},
false: {orgAdmin, orgMemberMe, otherOrgAdmin, otherOrgMember, memberMe, templateAdmin, userAdmin},
true: {admin, userAdmin},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I thought we got rid ofadmin?

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

admin is just the name of theowner user. Forgot to rename the var 👍

johnstcn reacted with thumbs up emoji
export const MockSiteRoles = [MockUserAdminRole, MockAuditorRole]
export const MockAssignableSiteRoles = [MockAssignableOwnerRole, MockAssignableUserAdminRole, MockAssignableAuditorRole]

export function assignableRole(role: TypesGen.Role, assignable: boolean): TypesGen.AssignableRoles {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

😍

Emyrk reacted with laugh emoji
MockOwnerRole, MockTemplateAdminRole,
MockUserAdminRole,
render
} from "../../testHelpers/renderHelpers"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Suggested change
}from"../../testHelpers/renderHelpers"
}from"testHelpers/renderHelpers"

We're trying to favor absolute paths when we're not in the same directory as whatever we're importing.

Emyrk reacted with thumbs up emoji
Copy link
Member

@Kira-PilotKira-Pilot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Looking great once CI passes. Thanks for adding those tests.

Emyrk reacted with thumbs up emoji
@EmyrkEmyrk changed the titlefix: Role asign uifix: Role assign ui fixesAug 16, 2022
@EmyrkEmyrk merged commit4be61d9 intomainAug 16, 2022
@EmyrkEmyrk deleted the stevenmasley/assign_roles_ui branchAugust 16, 2022 15:39
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@johnstcnjohnstcnjohnstcn approved these changes

@Kira-PilotKira-PilotKira-Pilot approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@Emyrk@Kira-Pilot@johnstcn

[8]ページ先頭

©2009-2025 Movatter.jp