@campxdev/shared 1.11.63 → 1.11.64
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -226,10 +226,10 @@ export const TimeLineComponent = ({
|
|
|
226
226
|
}}
|
|
227
227
|
>
|
|
228
228
|
<StyledAvatar>
|
|
229
|
-
{item?.
|
|
229
|
+
{item?.userName.charAt(0).toUpperCase()}
|
|
230
230
|
</StyledAvatar>
|
|
231
231
|
<Typography sx={{ fontSize: '13px', fontWeight: 900 }}>
|
|
232
|
-
{item?.
|
|
232
|
+
{item?.userName}
|
|
233
233
|
</Typography>
|
|
234
234
|
</Typography>
|
|
235
235
|
</Box>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
+
import { UserStore } from '../shared-state'
|
|
2
3
|
import {
|
|
3
4
|
EnrollPermissions,
|
|
4
5
|
Permission,
|
|
@@ -10,17 +11,30 @@ export default function ValidateAccess({
|
|
|
10
11
|
accessKey,
|
|
11
12
|
children,
|
|
12
13
|
checkForMasterSlave = false,
|
|
14
|
+
checkIsMasterInstitution = false,
|
|
13
15
|
}: {
|
|
14
16
|
accessKey: Permission | SquarePermissions | EnrollPermissions
|
|
15
17
|
children: React.ReactNode
|
|
16
18
|
checkForMasterSlave?: boolean
|
|
19
|
+
checkIsMasterInstitution?: boolean
|
|
17
20
|
}) {
|
|
18
|
-
const {
|
|
21
|
+
const {
|
|
22
|
+
permissions,
|
|
23
|
+
institutionType,
|
|
24
|
+
masterInstitutionUniqueId,
|
|
25
|
+
isMasterInstitution,
|
|
26
|
+
} = PermissionsStore.useState((s) => s)
|
|
27
|
+
|
|
28
|
+
const { user } = UserStore.useState((s) => s)
|
|
19
29
|
const hasAccess = checkHasAccess(
|
|
20
30
|
checkForMasterSlave,
|
|
21
31
|
accessKey,
|
|
22
32
|
institutionType,
|
|
23
33
|
permissions,
|
|
34
|
+
checkIsMasterInstitution,
|
|
35
|
+
isMasterInstitution,
|
|
36
|
+
masterInstitutionUniqueId,
|
|
37
|
+
user,
|
|
24
38
|
)
|
|
25
39
|
|
|
26
40
|
if (hasAccess) {
|
|
@@ -34,12 +48,22 @@ const checkHasAccess = (
|
|
|
34
48
|
accessKey,
|
|
35
49
|
institutionType,
|
|
36
50
|
permissions,
|
|
51
|
+
checkIsMasterInstitution,
|
|
52
|
+
masterInstitutionUniqueId,
|
|
53
|
+
isMasterInstitution,
|
|
54
|
+
user,
|
|
37
55
|
) => {
|
|
38
56
|
if (checkForMasterSlave) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
57
|
+
if (institutionType == 'MASTER_CHILD') {
|
|
58
|
+
if (checkIsMasterInstitution) {
|
|
59
|
+
return (
|
|
60
|
+
permissions[accessKey] &&
|
|
61
|
+
user.institutionIds.includes(masterInstitutionUniqueId) &&
|
|
62
|
+
isMasterInstitution
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
return accessKey ? permissions[accessKey] : true
|
|
66
|
+
}
|
|
44
67
|
}
|
|
68
|
+
return accessKey ? permissions[accessKey] : true
|
|
45
69
|
}
|