Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F22420443
and.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
and.ts
View Options
import
Bluebird
from
"bluebird"
;
import
{
And
as
AndQuery
}
from
"../../datastore/query"
;
import
type
{
Context
,
CollectionItem
}
from
"../../main"
;
import
Policy
,
{
ReducingPolicy
}
from
"../../chip-types/policy"
;
export
default
class
And
extends
ReducingPolicy
{
static
type_name
=
"and"
;
async
_getRestrictingQuery
(
context
:
Context
)
{
const
queries
=
await
Bluebird
.
map
(
this
.
policies
,
(
strategy
)
=>
strategy
.
getRestrictingQuery
(
context
)
);
const
ret
=
new
AndQuery
(...
queries
);
return
ret
;
}
isItemSensitive
(
context
:
Context
)
{
return
Bluebird
.
map
(
this
.
policies
,
(
strategy
)
=>
strategy
.
isItemSensitive
(
context
)
).
reduce
((
a
,
b
)
=>
a
||
b
);
}
async
checkerFunction
(
context
:
Context
,
item_getter
:
()
=>
Promise
<
CollectionItem
>
)
{
const
results
=
await
this
.
checkAllPolicies
(
context
,
item_getter
);
const
negatives
=
results
.
filter
((
result
)
=>
result
?
.
allowed
===
false
);
if
(
negatives
.
length
>
0
)
{
return
Policy
.
deny
(
`
${
negatives
.
map
((
n
)
=>
n
?
.
reason
).
join
(
", "
)
}
`
);
}
return
Policy
.
allow
(
`
${
results
.
filter
((
r
)
=>
r
!==
null
)
.
map
((
r
)
=>
r
?
.
reason
)
.
join
(
", "
)
}
`
);
}
}
File Metadata
Details
Attached
Mime Type
application/javascript
Expires
Sat, Nov 28, 02:41 (1 d, 22 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1202674
Default Alt Text
and.ts (1 KB)
Attached To
Mode
rS Sealious
Attached
Detach File
Event Timeline