File tree Expand file tree Collapse file tree 3 files changed +15
-6
lines changed
Common/Hooks/UseGetUserRoles
Shared/Components/ReactSelect Expand file tree Collapse file tree 3 files changed +15
-6
lines changed Original file line number Diff line number Diff line change 16
16
17
17
import { useEffect , useState } from 'react'
18
18
import { getUserRole } from '../../Common.service'
19
- import { useGetUserRolesType } from './types'
19
+ import { UseGetUserRolesType } from './types'
20
20
import { showError } from '../../Helper'
21
21
22
22
/**
23
23
* @description It will return isSuperAdmin and would be set to false by default, might need few optimizations like dep, etc
24
- * @returns {useGetUserRolesType } isSuperAdmin, canManageAllAccess
24
+ * @returns {UseGetUserRolesType } isSuperAdmin, canManageAllAccess
25
25
*/
26
- const useGetUserRoles = ( ) : useGetUserRolesType => {
27
- const [ result , setResult ] = useState < useGetUserRolesType > ( { isSuperAdmin : false , canManageAllAccess : false } )
26
+ const useGetUserRoles = ( ) : UseGetUserRolesType => {
27
+ const [ result , setResult ] = useState < UseGetUserRolesType > ( {
28
+ isSuperAdmin : false ,
29
+ canManageAllAccess : false ,
30
+ hasManagerPermissions : false ,
31
+ } )
28
32
29
33
useEffect ( ( ) => {
30
34
getUserRole ( )
31
35
. then ( ( { result : apiResult } ) => {
36
+ const hasManagerPermissions = apiResult . roles . some ( ( role ) => role . startsWith ( 'role:manager' ) )
37
+
32
38
setResult ( {
33
39
isSuperAdmin : apiResult . superAdmin ?? false ,
34
40
canManageAllAccess : apiResult . canManageAllAccess ?? false ,
41
+ hasManagerPermissions,
35
42
} )
36
43
} )
37
44
. catch ( ( error ) => {
Original file line number Diff line number Diff line change 14
14
* limitations under the License.
15
15
*/
16
16
17
- export interface useGetUserRolesType {
17
+ export interface UseGetUserRolesType {
18
18
isSuperAdmin : boolean
19
19
/**
20
20
* User can give access to all other users
21
21
*/
22
22
canManageAllAccess ?: boolean
23
+ hasManagerPermissions : boolean
23
24
}
Original file line number Diff line number Diff line change @@ -39,9 +39,10 @@ export const getCommonSelectStyle = (styleOverrides = {}): StylesConfig => ({
39
39
...base ,
40
40
minHeight : '32px' ,
41
41
boxShadow : 'none' ,
42
- backgroundColor : state . isDisabled ? 'var(--N100)' : 'var(--bg-secondary)' ,
42
+ backgroundColor : 'var(--bg-secondary)' ,
43
43
border : '1px solid var(--N200)' ,
44
44
cursor : state . isDisabled ? 'not-allowed' : 'pointer' ,
45
+ opacity : state . isDisabled ? 0.5 : 1 ,
45
46
46
47
'&:hover' : {
47
48
borderColor : 'var(--N300)' ,
You can’t perform that action at this time.
0 commit comments