refactoring & moving rbac.ts to "common"

Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
Roman committed 2020-07-29 16:05:08 +03:00
1 parent 3a115ae485
commit 39316e1a54
15 files changed
+62 -52

No files matched your search

-16
View File
@@ -1,16 +0,0 @@
import { getHostedCluster } from "../../common/cluster-store";
// todo: refactor / move to cluster-store.ts?
export function isAllowedResource(resources: string | string[]) {
if (!Array.isArray(resources)) {
resources = [resources];
}
const { allowedResources = [] } = getHostedCluster() || {};
for (const resource of resources) {
if (!allowedResources.includes(resource)) {
return false;
}
}
return true;
}