Page MenuHomeSealhub

owner.js
No OneTemporary

owner.js

"use strict";
const Promise = require("bluebird");
const Query = require("../../../datastore/query.js");
module.exports = {
name: "owner",
getRestrictingQuery: async function(context, params) {
if (context.user_id) {
return Query.fromSingleMatch({
"created_context.user_id": { $eq: context.user_id },
});
}
return new Query.DenyAll();
},
checker_function: function(context, params, item) {
if (
context.user_id &&
context.user_id === item.created_context.user_id
) {
return Promise.resolve();
} else {
return Promise.reject(
"Only the owner of this resource can perform this operation on this item."
);
}
},
item_sensitive: true,
};

File Metadata

Mime Type
text/plain
Expires
Tue, Dec 24, 14:04 (12 h, 33 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
557278
Default Alt Text
owner.js (683 B)

Event Timeline