-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #329 from dhis2/schemas
schemas: implement schemas
- Loading branch information
Showing
39 changed files
with
1,315 additions
and
613 deletions.
There are no files selected for viewing
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
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
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
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,17 @@ | ||
import i18n from '@dhis2/d2-i18n' | ||
import React from 'react' | ||
import { Outlet } from 'react-router-dom' | ||
import { useSectionHandle } from '../../lib' | ||
import { useIsSectionAuthorizedPredicate } from '../../lib/sections' | ||
|
||
export const CheckAuthorityForSection = () => { | ||
const section = useSectionHandle() | ||
const isSectionAllowed = useIsSectionAuthorizedPredicate() | ||
|
||
if (section && !isSectionAllowed(section)) { | ||
throw new Error( | ||
i18n.t('You do not have the authority to view this page.') | ||
) | ||
} | ||
return <Outlet /> | ||
} |
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
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
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
Oops, something went wrong.