diff --git a/src/roles/All.tsx b/src/roles/All.tsx new file mode 100644 index 0000000000000000000000000000000000000000..2e94b3d9d38081471a3a3148808222095cbf2164 --- /dev/null +++ b/src/roles/All.tsx @@ -0,0 +1,12 @@ +import { withAuthorization } from 'components/Authorization/Authorization'; +import { Roles } from 'roles/userRoles'; + +/** + * Wrapper for pages that can be accessed by all roles. + */ +export const All = withAuthorization([ + Roles.admin, + Roles.operator, + Roles.senior, + Roles.driver, +]); diff --git a/src/roles/Operator.tsx b/src/roles/Operator.tsx new file mode 100644 index 0000000000000000000000000000000000000000..c5ba47a1c57966cdd4a1e3da8420472ad8f96cc3 --- /dev/null +++ b/src/roles/Operator.tsx @@ -0,0 +1,7 @@ +import { withAuthorization } from 'components/Authorization/Authorization'; +import { Roles } from 'roles/userRoles'; + +/** + * Wrapper for pages that can be accessed by operators. + */ +export const Operator = withAuthorization([Roles.operator]); diff --git a/src/roles/Senior.tsx b/src/roles/Senior.tsx new file mode 100644 index 0000000000000000000000000000000000000000..8de0533fbb673e71fe65f263b69faa72e2ac3ebf --- /dev/null +++ b/src/roles/Senior.tsx @@ -0,0 +1,7 @@ +import { withAuthorization } from 'components/Authorization/Authorization'; +import { Roles } from 'roles/userRoles'; + +/** + * Wrapper for pages that can be accessed by seniors. + */ +export const Senior = withAuthorization([Roles.senior]); diff --git a/src/roles/userRoles.ts b/src/roles/userRoles.ts new file mode 100644 index 0000000000000000000000000000000000000000..9a6b847e37c11a34ca1cee679480bae62c57b7d4 --- /dev/null +++ b/src/roles/userRoles.ts @@ -0,0 +1,12 @@ +/** + * User roles of the application. + */ +export enum Roles { + /** Website visitor, is not logged. Can access to NonAuthRoutes */ + visitor = '', + /** Can access to routes wrapped by withAuthorization. */ + senior = 'senior', + admin = 'admin', + operator = 'operator', + driver = 'driver', +}