@@ -3,7 +3,7 @@ import { useTranslation } from 'react-i18next';
33
44import { Button , ButtonWithConfirmation , Header , ListEmptyMessage , Modal , Pagination , SpaceBetween , Table } from 'components' ;
55
6- import { useCollection , useNotifications , usePermissionGuard } from 'hooks' ;
6+ import { useAppSelector , useCollection , useNotifications , usePermissionGuard } from 'hooks' ;
77import { getServerError } from 'libs' ;
88import {
99 useDeleteSecretsMutation ,
@@ -13,6 +13,9 @@ import {
1313} from 'services/secrets' ;
1414import { GlobalUserRole , ProjectUserRole } from 'types' ;
1515
16+ import { selectUserData } from 'App/slice' ;
17+
18+ import { getProjectRoleByUserName } from '../utils' ;
1619import { SecretForm } from './Form' ;
1720
1821import { IProps , TFormValues } from './types' ;
@@ -21,13 +24,16 @@ import styles from './styles.module.scss';
2124
2225export const ProjectSecrets : React . FC < IProps > = ( { project, loading } ) => {
2326 const { t } = useTranslation ( ) ;
27+ const userData = useAppSelector ( selectUserData ) ;
28+ const userName = userData ?. username ?? '' ;
2429 const [ initialFormValues , setInitialFormValues ] = useState < TFormValues | undefined > ( ) ;
2530 const projectName = project ?. project_name ?? '' ;
2631 const [ pushNotification ] = useNotifications ( ) ;
2732
2833 const [ hasPermissionForSecretsManaging ] = usePermissionGuard ( {
2934 allowedProjectRoles : [ ProjectUserRole . ADMIN ] ,
3035 allowedGlobalRoles : [ GlobalUserRole . ADMIN ] ,
36+ projectRole : project ? ( getProjectRoleByUserName ( project , userName ) ?? undefined ) : undefined ,
3137 } ) ;
3238
3339 const { data, isLoading, isFetching } = useGetAllSecretsQuery (
0 commit comments