Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F995367
owner.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
945 B
Referenced Files
None
Subscribers
None
owner.ts
View Options
import
{
Policy
,
Context
,
Query
,
CollectionItem
}
from
"../../main.js"
;
import
DenyAll
from
"../../datastore/deny-all.js"
;
import
type
{
ItemMetadata
}
from
"../../chip-types/collection-item.js"
;
export
default
class
Owner
extends
Policy
{
static
type_name
=
"owner"
;
async
_getRestrictingQuery
(
context
:
Context
)
{
if
(
context
.
user_id
)
{
return
Query
.
fromSingleMatch
({
"_metadata.created_by"
:
{
$eq
:
context
.
user_id
},
});
}
return
new
DenyAll
();
}
async
checkerFunction
(
context
:
Context
,
item_getter
:
()
=>
Promise
<
CollectionItem
>
)
{
const
response
=
await
item_getter
();
if
(
context
.
user_id
&&
context
.
user_id
===
(
response
as
unknown
as
{
_metadata
:
ItemMetadata
;
}
).
_metadata
.
created_by
)
{
return
Policy
.
allow
(
context
.
app
.
i18n
(
"policy_owner_allow"
));
}
else
{
return
Policy
.
deny
(
context
.
app
.
i18n
(
"policy_owner_deny"
));
}
}
isItemSensitive
=
async
()
=>
true
;
}
File Metadata
Details
Attached
Mime Type
text/x-java
Expires
Mon, Dec 23, 01:57 (10 h, 12 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
555427
Default Alt Text
owner.ts (945 B)
Attached To
Mode
rS Sealious
Attached
Detach File
Event Timeline
Log In to Comment