File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -133,6 +133,10 @@ const eruReadinessForm = customWrapRoute({
133133 context : {
134134 title : 'ERU Readiness Update Form' ,
135135 visibility : 'is-authenticated' ,
136+ permissions : ( {
137+ isRegionalOrCountryAdmin,
138+ isSuperUser,
139+ } ) => isSuperUser || isRegionalOrCountryAdmin ,
136140 } ,
137141} ) ;
138142
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ export interface Perms {
1616 isCountryAdmin : ( countryId : number | undefined ) => boolean ,
1717 isRegionPerAdmin : ( regionId : number | undefined ) => boolean ,
1818 isCountryPerAdmin : ( countryId : number | undefined ) => boolean ,
19+ isRegionalOrCountryAdmin : boolean ,
1920 isPerAdmin : boolean ,
2021 isIfrcAdmin : boolean ,
2122 isSuperUser : boolean ,
Original file line number Diff line number Diff line change @@ -38,13 +38,17 @@ function usePermissions() {
3838
3939 const isPerAdmin = ! isGuestUser
4040 && ( ( userMe ?. is_per_admin_for_countries . length ?? 0 ) > 0
41- || ( userMe ?. is_admin_for_regions . length ?? 0 ) > 0 ) ;
41+ || ( userMe ?. is_per_admin_for_regions . length ?? 0 ) > 0 ) ;
4242
4343 const isIfrcAdmin = ! isGuestUser
4444 && ( ! ! userMe ?. is_ifrc_admin || ! ! userMe ?. email ?. toLowerCase ( ) . endsWith ( '@ifrc.org' ) ) ;
4545
4646 const isSuperUser = ! isGuestUser && ! ! userMe ?. is_superuser ;
4747
48+ const isRegionalOrCountryAdmin = ! isGuestUser
49+ && ( ( userMe ?. is_admin_for_countries . length ?? 0 ) > 0
50+ || ( userMe ?. is_admin_for_regions . length ?? 0 ) > 0 ) ;
51+
4852 return {
4953 isDrefRegionalCoordinator,
5054 isRegionAdmin,
@@ -55,6 +59,7 @@ function usePermissions() {
5559 isIfrcAdmin,
5660 isSuperUser,
5761 isGuestUser,
62+ isRegionalOrCountryAdmin,
5863 } ;
5964 } ,
6065 [ userMe ] ,
You can’t perform that action at this time.
0 commit comments