-
Notifications
You must be signed in to change notification settings - Fork 12k
feat: assign custom roles #22662
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
Merged
+400
−65
Merged
feat: assign custom roles #22662
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
7137a4e
feat: assign custom roles
sean-brydon a559571
enable new flow to work for orgs + teams
sean-brydon e9b20ef
correctly display role on members list
sean-brydon 95d2a49
fix factued values
sean-brydon 95793d6
fix filtering
sean-brydon 221d3a2
fix duplicate roles
sean-brydon 3630a01
remove logs
sean-brydon f4b7eb2
fix: resolve TypeScript errors in custom roles functionality
devin-ai-integration[bot] 5ce0e89
fix: correct role validation logic in PBACRoleManager
devin-ai-integration[bot] a28d3a4
fix role state optimistic cache
sean-brydon 3dc8959
move to using repo
sean-brydon 15bb0b5
fix assingment
sean-brydon b93caa1
handle input for default roles
sean-brydon b680ba6
Merge branch 'main' into fix/assigning-child-team-custom-roles
sean-brydon d78cfd3
add todo
sean-brydon b676159
Merge remote-tracking branch 'refs/remotes/origin/fix/assigning-child…
sean-brydon beff29d
Merge branch 'main' into fix/assigning-child-team-custom-roles
sean-brydon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| "use client"; | ||
|
|
||
| import { useState } from "react"; | ||
|
|
||
| import { checkAdminOrOwner } from "@calcom/features/auth/lib/checkAdminOrOwner"; | ||
| import LicenseRequired from "@calcom/features/ee/common/components/LicenseRequired"; | ||
| import { MemberInvitationModalWithoutMembers } from "@calcom/features/ee/teams/components/MemberInvitationModal"; | ||
| import MemberList from "@calcom/features/ee/teams/components/MemberList"; | ||
| import { useLocale } from "@calcom/lib/hooks/useLocale"; | ||
| import type { RouterOutputs } from "@calcom/trpc/react"; | ||
|
|
||
| interface TeamMembersViewProps { | ||
| team: NonNullable<RouterOutputs["viewer"]["teams"]["get"]>; | ||
| facetedTeamValues?: { | ||
| roles: { id: string; name: string }[]; | ||
| teams: RouterOutputs["viewer"]["teams"]["get"][]; | ||
| attributes: { | ||
| id: string; | ||
| name: string; | ||
| options: { | ||
| value: string; | ||
| }[]; | ||
| }[]; | ||
| }; | ||
| attributes?: any[]; | ||
| } | ||
|
|
||
| export const TeamMembersView = ({ team, facetedTeamValues }: TeamMembersViewProps) => { | ||
| const { t } = useLocale(); | ||
| const [showMemberInvitationModal, setShowMemberInvitationModal] = useState(false); | ||
| const [showInviteLinkSettingsModal, setShowInviteLinkSettingsModal] = useState(false); | ||
|
|
||
| const isTeamAdminOrOwner = checkAdminOrOwner(team.membership.role); | ||
| const canLoggedInUserSeeMembers = !team.isPrivate || isTeamAdminOrOwner; | ||
|
|
||
| return ( | ||
| <LicenseRequired> | ||
| <div> | ||
| {canLoggedInUserSeeMembers && ( | ||
| <div className="mb-6"> | ||
| <MemberList | ||
| team={team} | ||
| isOrgAdminOrOwner={false} | ||
| setShowMemberInvitationModal={setShowMemberInvitationModal} | ||
| facetedTeamValues={facetedTeamValues} | ||
| /> | ||
| </div> | ||
| )} | ||
| {!canLoggedInUserSeeMembers && ( | ||
| <div className="border-subtle rounded-xl border p-6" data-testid="members-privacy-warning"> | ||
| <h2 className="text-default">{t("only_admin_can_see_members_of_team")}</h2> | ||
| </div> | ||
| )} | ||
| {showMemberInvitationModal && team && team.id && ( | ||
| <MemberInvitationModalWithoutMembers | ||
| hideInvitationModal={() => setShowMemberInvitationModal(false)} | ||
| showMemberInvitationModal={showMemberInvitationModal} | ||
| teamId={team.id} | ||
| token={team.inviteToken?.token} | ||
| onSettingsOpen={() => setShowInviteLinkSettingsModal(true)} | ||
| /> | ||
| )} | ||
| </div> | ||
| </LicenseRequired> | ||
| ); | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Populate the filters via server side