feat(rbac): put back condition matcher for workspace permission check and added migration function

This commit is contained in:
Akhil Mohan
2023-09-08 21:22:36 +05:30
parent c91a93ef2a
commit 38c044f9a7
4 changed files with 38 additions and 29 deletions
+1 -6
View File
@@ -28,11 +28,6 @@ const glob: JsInterpreter<FieldCondition<string>> = (node, object, context) => {
const secretPath = context.get(object, node.field);
const permissionSecretGlobPath = node.value;
if (!secretPath) return false;
// console.log(
// secretPath,
// picomatch.isMatch(secretPath, permissionSecretGlobPath, { strictSlashes: false }),
// permissionSecretGlobPath
// );
return picomatch.isMatch(secretPath, permissionSecretGlobPath, { strictSlashes: false });
};
@@ -102,7 +97,7 @@ export const useGetUserProjectPermissions = ({ workspaceId }: TGetUserProjectPer
enabled: Boolean(workspaceId),
select: (data) => {
const rule = unpackRules<RawRuleOf<MongoAbility<ProjectPermissionSet>>>(data);
const ability = createMongoAbility<ProjectPermissionSet>(rule);
const ability = createMongoAbility<ProjectPermissionSet>(rule, { conditionsMatcher });
return ability;
}
});