-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(restricted): fix minimum rights display for US
ref: MANAGER-16677 PRB0041985 Signed-off-by: David Arsène <[email protected]>
- Loading branch information
Showing
3 changed files
with
33 additions
and
9 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
packages/manager/apps/restricted/src/hooks/useMinimalRights/constants.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
type RIGHT = { | ||
urn: string; | ||
subsidiariesExcluded?: string[]; | ||
}; | ||
|
||
export const MINIMUM_RIGHTS: RIGHT[] = [ | ||
{ urn: 'account:apiovh:me/get' }, | ||
{ | ||
urn: 'account:apiovh:me/supportLevel/get', | ||
subsidiariesExcluded: ['US'], | ||
}, | ||
{ urn: 'account:apiovh:me/certificates/get' }, | ||
{ urn: 'ccount:apiovh:me/tag/get' }, | ||
] as const; |
11 changes: 11 additions & 0 deletions
11
packages/manager/apps/restricted/src/hooks/useMinimalRights/useMinimalRights.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { useContext } from 'react'; | ||
import Context from '@/context'; | ||
import { MINIMUM_RIGHTS } from './constants'; | ||
|
||
export default function useMinimalRights() { | ||
const { ovhSubsidiary } = useContext(Context); | ||
return MINIMUM_RIGHTS.filter( | ||
({ subsidiariesExcluded }) => | ||
!subsidiariesExcluded || !subsidiariesExcluded.includes(ovhSubsidiary), | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters