Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F3010825
create-policies-with-complex-pipeline.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
882 B
Referenced Files
None
Subscribers
None
create-policies-with-complex-pipeline.ts
View Options
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
Details
Attached
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)
Attached To
Mode
rS Sealious
Attached
Detach File
Event Timeline
Log In to Comment