Page MenuHomeSealhub

access-strategy.js
No OneTemporary

access-strategy.js

"use strict";
const locreq = require("locreq")(__dirname);
const Promise = require("bluebird");
const AccessStrategyType = locreq("lib/chip-types/access-strategy-type.js");
const AccessStrategy = function(app, declaration) {
if (declaration instanceof Array) {
this.type = new AccessStrategyType(app, declaration[0]);
this.params = declaration[1] || {};
} else if (
typeof declaration === "string" ||
declaration instanceof AccessStrategyType
) {
this.type = new AccessStrategyType(app, declaration);
this.params = {};
} else {
this.type = new AccessStrategyType(app, declaration.type);
this.params = declaration.params || {};
}
};
AccessStrategy.type_name = "AccessStrategy";
AccessStrategy.prototype.check = function(context, item) {
return Promise.resolve(this.type.check(context, this.params, item));
};
AccessStrategy.prototype.is_item_sensitive = function() {
return this.type.is_item_sensitive(this.params);
};
AccessStrategy.prototype.getRestrictingQuery = function(context) {
return this.type.getRestrictingQuery(context, this.params);
};
module.exports = AccessStrategy;

File Metadata

Mime Type
text/plain
Expires
Tue, Dec 24, 14:02 (1 d, 1 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
557131
Default Alt Text
access-strategy.js (1 KB)

Event Timeline