Skip to content

Commit 579e09e

Browse files
Merge branch 'main' into APL-475
2 parents 1c1f8ae + b9f1904 commit 579e09e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/components/User.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,14 @@ export const getUserUiSchema = (
2222
user: GetSessionApiResponse['user'],
2323
formData: GetUserApiResponse,
2424
teamId: string,
25+
hasEmail: boolean,
2526
): any => {
2627
const platformAdmin = formData?.isPlatformAdmin || false
2728
const uiSchema = {
2829
id: { 'ui:widget': 'hidden' },
2930
teamId: { 'ui:widget': 'hidden' },
3031
isTeamAdmin: platformAdmin && { 'ui:widget': 'hidden' },
32+
email: hasEmail && { 'ui:readonly': 'true' },
3133
teams: platformAdmin && { 'ui:widget': 'hidden' },
3234
initialPassword: { 'ui:widget': 'hidden' },
3335
}
@@ -52,17 +54,20 @@ export default function ({ user, teamId, teamIds, ...other }: Props): React.Reac
5254
defaultPlatformAdminEmail,
5355
} = useSession()
5456
const [data, setData] = useState<GetUserApiResponse>(user)
57+
const [hasEmail, setHasEmail] = useState(false)
5558
useEffect(() => {
59+
if (user?.email) setHasEmail(true)
5660
setData(user)
5761
}, [user])
62+
5863
// END HOOKS
5964
const formData = cloneDeep(data)
6065
if (formData?.isPlatformAdmin) {
6166
formData.isTeamAdmin = false
6267
formData.teams = []
6368
}
6469
const schema = getUserSchema(teamIds)
65-
const uiSchema = getUserUiSchema(sessionUser, formData, teamId)
70+
const uiSchema = getUserUiSchema(sessionUser, formData, teamId, hasEmail)
6671
if (hasExternalIDP) {
6772
return (
6873
<InformationBanner message='User management is only available when using the internal identity provider (IDP).' />

0 commit comments

Comments
 (0)