[permissions] Update updateRole logic + disallow self role-assignment (#10476)
In this PR - updateWorkspaceMemberRole api was changed to stop allowing null as a valid value for roleId. it is not possible anymore to just unassign a role from a user. instead it is only possible to assign a different role to a user, which will unassign them from their previous role. For this reason in the FE the bins icons next to the workspaceMember on a role page were removed - updateWorkspaceMemberRole will throw if a user attempts to update their own role - tests tests tests!
This commit is contained in:
@ -1085,7 +1085,7 @@ export type MutationUpdateWorkspaceFeatureFlagArgs = {
|
||||
|
||||
|
||||
export type MutationUpdateWorkspaceMemberRoleArgs = {
|
||||
roleId?: InputMaybe<Scalars['String']>;
|
||||
roleId: Scalars['String'];
|
||||
workspaceMemberId: Scalars['String'];
|
||||
};
|
||||
|
||||
@ -2368,7 +2368,7 @@ export type RoleFragmentFragment = { __typename?: 'Role', id: string, label: str
|
||||
|
||||
export type UpdateWorkspaceMemberRoleMutationVariables = Exact<{
|
||||
workspaceMemberId: Scalars['String'];
|
||||
roleId?: InputMaybe<Scalars['String']>;
|
||||
roleId: Scalars['String'];
|
||||
}>;
|
||||
|
||||
|
||||
@ -4229,7 +4229,7 @@ export type UpdateLabPublicFeatureFlagMutationHookResult = ReturnType<typeof use
|
||||
export type UpdateLabPublicFeatureFlagMutationResult = Apollo.MutationResult<UpdateLabPublicFeatureFlagMutation>;
|
||||
export type UpdateLabPublicFeatureFlagMutationOptions = Apollo.BaseMutationOptions<UpdateLabPublicFeatureFlagMutation, UpdateLabPublicFeatureFlagMutationVariables>;
|
||||
export const UpdateWorkspaceMemberRoleDocument = gql`
|
||||
mutation UpdateWorkspaceMemberRole($workspaceMemberId: String!, $roleId: String) {
|
||||
mutation UpdateWorkspaceMemberRole($workspaceMemberId: String!, $roleId: String!) {
|
||||
updateWorkspaceMemberRole(
|
||||
workspaceMemberId: $workspaceMemberId
|
||||
roleId: $roleId
|
||||
|
||||
Reference in New Issue
Block a user