lib/secureAccessMethods.js
function readSecure(user, options) {
    // jscs:disable
    // jshint -W040
    const self = this;
    // jshint +W040
    // jscs:enable
    const shield = self.constructor.shield;
    const action = 'read';
    const rules = shield.getApplicableRules(action);
    return shield._fetch.call(self, options)
        .then(function runShieldRules(result) {
            // TODO: investigate what happens if fetch returns nothing (err?)
            return applyRules(rules, self, user)
                .then(function resolveResult() {
                    return result;
                });
        });
}
function readSecure(user, options) {
    // jscs:disable
    // jshint -W040
    const self = this;
    // jshint +W040
    // jscs:enable
    const shield = self.constructor.shield;
    const action = 'read';
    const rules = shield.getApplicableRules(action);
    return shield._fetch.call(self, options)
        .then(function runShieldRules(result) {
            // TODO: investigate what happens if fetch returns nothing (err?)
            return applyRules(rules, self, user)
                .then(function resolveResult() {
                    return result;
                });
        });
}
function readSecure ( user , options ) { // jscs:disable // jshint -W040 const self = this ; // jshint +W040 // jscs:enable const shield = self . constructor . shield ; const action = 'read' ; const rules = shield . getApplicableRules ( action ) ; return shield . _fetch . call ( self , options ) . then ( function runShieldRules ( result ) { // TODO: investigate what happens if fetch returns nothing (err?) return applyRules ( rules , self , user ) . then ( function resolveResult ( ) { return result ; } ) ; } ) ; }
Fetch a record from DB, then verify permissions
@param {object} user is the user credentials
@param {object} options are options to be passed to destroy call
@return {Promise} resolves to fetch result or rejects with auth error
Fetch a record from DB then verify permissions