File tree Expand file tree Collapse file tree 4 files changed +20
-4
lines changed
Modals/ReachedLimitForwardingModal
components/containers/addresses Expand file tree Collapse file tree 4 files changed +20
-4
lines changed Original file line number Diff line number Diff line change 1
1
import { c , msgid } from 'ttag' ;
2
2
3
+ import { useUser } from '@proton/account/user/hooks' ;
3
4
import { MAX_SYNC_PAID_USER } from '@proton/activation/src/constants' ;
4
5
import { Button } from '@proton/atoms' ;
5
6
import { Prompt } from '@proton/components' ;
6
7
import type { ModalStateProps } from '@proton/components/components/modalTwo/useModalState' ;
8
+ import { isAdmin } from '@proton/shared/lib/user/helpers' ;
7
9
import { useFlag } from '@proton/unleash/index' ;
8
10
9
11
const getModalText = ( hasAccessToBYOE : boolean ) => {
@@ -27,7 +29,9 @@ const getModalText = (hasAccessToBYOE: boolean) => {
27
29
interface Props extends ModalStateProps { }
28
30
29
31
const ReachedLimitForwardingModal = ( { ...rest } : Props ) => {
30
- const hasAccessToBYOE = useFlag ( 'InboxBringYourOwnEmail' ) ;
32
+ const [ user ] = useUser ( ) ;
33
+ // Only admins can access to BYOE for now, this will change later
34
+ const hasAccessToBYOE = useFlag ( 'InboxBringYourOwnEmail' ) && isAdmin ( user ) ;
31
35
32
36
return (
33
37
< Prompt
Original file line number Diff line number Diff line change 1
1
import { c } from 'ttag' ;
2
2
3
+ import { useUser } from '@proton/account/user/hooks' ;
3
4
import ConnectGmailButton from '@proton/activation/src/components/SettingsArea/ConnectGmailButton' ;
4
5
import { type APP_NAMES , MAIL_APP_NAME } from '@proton/shared/lib/constants' ;
6
+ import { isAdmin } from '@proton/shared/lib/user/helpers' ;
5
7
import { useFlag } from '@proton/unleash' ;
6
8
7
9
const getFeatureDescription = ( hasAccessToBYOE : boolean ) => {
@@ -26,7 +28,9 @@ interface Props {
26
28
}
27
29
28
30
const GmailForwarding = ( { app } : Props ) => {
29
- const hasAccessToBYOE = useFlag ( 'InboxBringYourOwnEmail' ) ;
31
+ const [ user ] = useUser ( ) ;
32
+ // Only admins can access to BYOE for now, this will change later
33
+ const hasAccessToBYOE = useFlag ( 'InboxBringYourOwnEmail' ) && isAdmin ( user ) ;
30
34
31
35
return (
32
36
< >
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import { useEffect } from 'react';
3
3
import { c } from 'ttag' ;
4
4
5
5
import { createBYOEAddress } from '@proton/account/addresses/actions' ;
6
+ import { useUser } from '@proton/account/user/hooks' ;
6
7
import {
7
8
G_OAUTH_SCOPE_DEFAULT ,
8
9
G_OAUTH_SCOPE_MAIL_FULL_SCOPE ,
@@ -16,10 +17,13 @@ import { getAllSync } from '@proton/activation/src/logic/sync/sync.selectors';
16
17
import useNotifications from '@proton/components/hooks/useNotifications' ;
17
18
import { useDispatch } from '@proton/redux-shared-store/sharedProvider' ;
18
19
import { getEmailParts } from '@proton/shared/lib/helpers/email' ;
20
+ import { isAdmin } from '@proton/shared/lib/user/helpers' ;
19
21
import { useFlag } from '@proton/unleash/index' ;
20
22
21
23
const useSetupGmailBYOEAddress = ( ) => {
22
- const hasAccessToBYOE = useFlag ( 'InboxBringYourOwnEmail' ) ;
24
+ const [ user ] = useUser ( ) ;
25
+ // Only admins can access to BYOE for now, this will change later
26
+ const hasAccessToBYOE = useFlag ( 'InboxBringYourOwnEmail' ) && isAdmin ( user ) ;
23
27
const isInMaintenance = useFlag ( 'MaintenanceImporter' ) ;
24
28
const easySwitchDispatch = useEasySwitchDispatch ( ) ;
25
29
const allSyncs = useEasySwitchSelector ( getAllSync ) ;
Original file line number Diff line number Diff line change 1
1
import { useOrganization } from '@proton/account/organization/hooks' ;
2
+ import { useUser } from '@proton/account/user/hooks' ;
2
3
import Loader from '@proton/components/components/loader/Loader' ;
3
4
import SettingsSectionWide from '@proton/components/containers/account/SettingsSectionWide' ;
5
+ import { isAdmin } from '@proton/shared/lib/user/helpers' ;
4
6
import { useFlag } from '@proton/unleash/index' ;
5
7
6
8
import Addresses from './Addresses' ;
@@ -10,8 +12,10 @@ interface Props {
10
12
}
11
13
12
14
const AddressesSection = ( { isOnlySelf } : Props ) => {
15
+ const [ user ] = useUser ( ) ;
13
16
const [ organization , loadingOrganization ] = useOrganization ( ) ;
14
- const hasAccessToBYOE = useFlag ( 'InboxBringYourOwnEmail' ) ;
17
+ // Only admins can access to BYOE for now, this will change later
18
+ const hasAccessToBYOE = useFlag ( 'InboxBringYourOwnEmail' ) && isAdmin ( user ) ;
15
19
16
20
return (
17
21
< SettingsSectionWide >
You can’t perform that action at this time.
0 commit comments