Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F22393908
themselves.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
627 B
Referenced Files
None
Subscribers
None
themselves.ts
View Options
import
{
CollectionItem
,
Context
,
Policy
,
Query
}
from
"../../main"
;
export
default
class
Themselves
extends
Policy
{
static
type_name
=
"themselves"
;
isItemSensitive
=
async
(
_
:
Context
)
=>
true
;
async
_getRestrictingQuery
(
context
:
Context
)
{
return
Query
.
fromSingleMatch
({
id
:
{
$eq
:
context
.
user_id
},
});
}
async
checkerFunction
(
context
:
Context
,
item_getter
:
()
=>
Promise
<
CollectionItem
>
)
{
const
user_id
=
(
await
item_getter
()).
id
;
if
(
context
.
user_id
!==
user_id
)
{
return
Policy
.
deny
(
`you are not the user of id
${
user_id
}
.`
);
}
return
Policy
.
allow
(
"you are the user in question"
);
}
}
File Metadata
Details
Attached
Mime Type
application/javascript
Expires
Fri, Nov 27, 16:11 (1 d, 14 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1229059
Default Alt Text
themselves.ts (627 B)
Attached To
Mode
rS Sealious
Attached
Detach File
Event Timeline