Page MenuHomeSealhub

create-policies-with-complex-pipeline.ts
No OneTemporary

create-policies-with-complex-pipeline.ts

import { Policy, Query, PolicyClass } from "../../main";
export default {
allowDeny: function (): PolicyClass[] {
const policies = ["complex-deny-pipeline", "complex-allow-pipeline"];
const ret: PolicyClass[] = [];
for (const strategy_name of policies) {
ret.push(
class extends Policy {
async _getRestrictingQuery() {
const query = new Query();
const id = query.lookup({
from: "numbers",
localField: "number",
foreignField: "id",
});
query.match({
[`${id}._id`]: {
$exists:
strategy_name === "complex-allow-pipeline",
},
});
return query;
}
async checkerFunction() {
return Policy.allow(
"I don't care about individual items, my goal is to test the filtering pipelines"
);
}
item_sensitive: true;
}
);
}
return ret;
},
};

File Metadata

Mime Type
text/x-java
Expires
Wed, May 7, 19:48 (1 d, 1 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
634374
Default Alt Text
create-policies-with-complex-pipeline.ts (882 B)

Event Timeline