CEC-464 can filters forms (#118)

* can filters forms and lists

* unit tests

* updating warnings and tests

* merge develop

* fixed snapshots

* update jest mocks

* updating tests
This commit is contained in:
Drew Taylor
2022-03-03 11:33:07 -08:00
committed by GitHub
parent 3b9252097a
commit b7223b8bc6
37 changed files with 6673 additions and 944 deletions

View File

@@ -1,17 +1,18 @@
import { parsePayload } from "./jwt";
export const Roles = {
CREATE: "efcc3025-e2d8-4212-8227-805c7be39d2c",
READ: "a729bbd4-2038-4649-9127-16782bb1e701",
CREATE: "efcc3025-e2d8-4212-8227-805c7be39d2c",
DELETE: "8f78dce7-f5f9-4033-a10c-c9c7408bfcfe"
}
export const hasRoleToken = (roles, token) => {
if (!roles || roles.length === 0) return true;
const groups = getGroups(token);
if (!groups) return false;
return hasRole(roles, groups);
}
@@ -26,7 +27,7 @@ export const getGroups = (token) => {
export const hasRole = (roles, groups) => {
if (!roles || roles.length === 0) return true;
if (!groups) return false;
for (let role of roles) {
if (groups.indexOf(role) > -1) return true;
}