Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F995959
and.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
and.ts
View Options
import
Bluebird
from
"bluebird"
;
import
{
And
as
AndQuery
}
from
"../../datastore/query.js"
;
import
type
{
Context
,
CollectionItem
}
from
"../../main.js"
;
import
Policy
,
{
ReducingPolicy
}
from
"../../chip-types/policy.js"
;
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
text/x-java
Expires
Tue, Dec 24, 03:23 (23 h, 29 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
557018
Default Alt Text
and.ts (1 KB)
Attached To
Mode
rS Sealious
Attached
Detach File
Event Timeline
Log In to Comment