@@ -4,6 +4,7 @@ import {useHistory} from 'react-router-dom';
44
55import routes , { createHref } from '../../../routes' ;
66import { authenticationApi } from '../../../store/reducers/authentication/authentication' ;
7+ import { useAccessTotallyRestricted } from '../../../store/reducers/capabilities/hooks' ;
78import { cn } from '../../../utils/cn' ;
89import { useDatabaseFromQuery } from '../../../utils/hooks/useDatabaseFromQuery' ;
910import i18n from '../i18n' ;
@@ -14,6 +15,7 @@ const b = cn('kv-ydb-internal-user');
1415
1516export function YdbInternalUser ( { login} : { login ?: string } ) {
1617 const [ logout ] = authenticationApi . useLogoutMutation ( ) ;
18+ const isForbidded = useAccessTotallyRestricted ( ) ;
1719 const database = useDatabaseFromQuery ( ) ;
1820
1921 const history = useHistory ( ) ;
@@ -30,6 +32,17 @@ export function YdbInternalUser({login}: {login?: string}) {
3032 logout ( undefined ) ;
3133 } ;
3234
35+ const renderLoginButton = ( ) => {
36+ if ( isForbidded ) {
37+ return null ;
38+ }
39+ return (
40+ < Button view = "flat-secondary" title = { i18n ( 'account.login' ) } onClick = { handleLoginClick } >
41+ < Icon data = { ArrowRightToSquare } />
42+ </ Button >
43+ ) ;
44+ } ;
45+
3346 return (
3447 < div className = { b ( ) } >
3548 < div className = { b ( 'user-info-wrapper' ) } >
@@ -41,13 +54,7 @@ export function YdbInternalUser({login}: {login?: string}) {
4154 < Icon data = { ArrowRightFromSquare } />
4255 </ Button >
4356 ) : (
44- < Button
45- view = "flat-secondary"
46- title = { i18n ( 'account.login' ) }
47- onClick = { handleLoginClick }
48- >
49- < Icon data = { ArrowRightToSquare } />
50- </ Button >
57+ renderLoginButton ( )
5158 ) }
5259 </ div >
5360 ) ;
0 commit comments