Page MenuHomeSealhub

user-referenced-in-field.js
No OneTemporary

user-referenced-in-field.js

module.exports = app => ({
name: "user-referenced-in-field",
getRestrictingQuery: async (context, field_name) => {
if (!context.user_id) return new app.Query.DenyAll();
return app.Query.fromSingleMatch({
[field_name]: context.user_id,
});
},
checker_function: async (context, field_name, sealious_response) => {
if (!context.user_id) return Promise.reject("You're not logged in!");
if (context.user_id !== sealious_response[field_name])
return Promise.reject("Access not allowed for this user");
},
item_sensitive: true,
});

File Metadata

Mime Type
text/plain
Expires
Tue, Dec 24, 14:02 (17 h, 49 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
557227
Default Alt Text
user-referenced-in-field.js (547 B)

Event Timeline