Skip to content

Commit

Permalink
feat(admin): Base Org Admin role (#9194)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmtaber129 authored Nov 16, 2023
1 parent a147fa3 commit 0fdef2d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import lazyPreload from '../../../../utils/lazyPreload'
import withMutationProps, {WithMutationProps} from '../../../../utils/relay/withMutationProps'
import {OrgMemberRow_organization$key} from '../../../../__generated__/OrgMemberRow_organization.graphql'
import {OrgMemberRow_organizationUser$key} from '../../../../__generated__/OrgMemberRow_organizationUser.graphql'
import BaseTag from '../../../../components/Tag/BaseTag'

const AvatarBlock = styled('div')({
display: 'none',
Expand Down Expand Up @@ -132,6 +133,7 @@ const OrgMemberRow = (props: Props) => {
const {orgId, isViewerBillingLeader} = organization
const {newUserUntil, user, role} = organizationUser
const isBillingLeader = role === 'BILLING_LEADER'
const isOrgAdmin = role === 'ORG_ADMIN'
const {email, inactive, picture, preferredName, userId} = user
const isViewerLastBillingLeader =
isViewerBillingLeader && isBillingLeader && billingLeaderCount === 1
Expand Down Expand Up @@ -159,7 +161,8 @@ const OrgMemberRow = (props: Props) => {
<RowInfoHeader>
<RowInfoHeading>{preferredName}</RowInfoHeading>
{isBillingLeader && <RoleTag>{'Billing Leader'}</RoleTag>}
{inactive && !isBillingLeader && <InactiveTag>{'Inactive'}</InactiveTag>}
{isOrgAdmin && <BaseTag className='bg-gold-500 text-white'>{'Org Admin'}</BaseTag>}
{inactive && !isBillingLeader && !isOrgAdmin && <InactiveTag>{'Inactive'}</InactiveTag>}
{new Date(newUserUntil) > new Date() && <EmphasisTag>{'New'}</EmphasisTag>}
</RowInfoHeader>
<RowInfoLink href={`mailto:${email}`} title='Send an email'>
Expand All @@ -168,7 +171,7 @@ const OrgMemberRow = (props: Props) => {
</StyledRowInfo>
<RowActions>
<ActionsBlock>
{!isBillingLeader && viewerId === userId && (
{!isBillingLeader && !isOrgAdmin && viewerId === userId && (
<StyledFlatButton onClick={toggleLeave} onMouseEnter={LeaveOrgModal.preload}>
Leave Organization
</StyledFlatButton>
Expand Down
2 changes: 1 addition & 1 deletion packages/server/database/types/OrganizationUser.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import generateUID from '../../generateUID'
import {TierEnum} from './Invoice'

export type OrgUserRole = 'BILLING_LEADER'
export type OrgUserRole = 'BILLING_LEADER' | 'ORG_ADMIN'
interface Input {
orgId: string
userId: string
Expand Down
3 changes: 2 additions & 1 deletion packages/server/graphql/types/OrgUserRole.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ const OrgUserRole = new GraphQLEnumType({
description: 'The role of the org user',
values: {
// graphql only supports enum values at runtime, the value here is the text value
BILLING_LEADER: {}
BILLING_LEADER: {},
ORG_ADMIN: {}
}
})

Expand Down

0 comments on commit 0fdef2d

Please sign in to comment.