server/controllers/portfolio.js
/**
   * Default findOne action
   *
   * Record is preloaded in context loader by default and is avaible as res.locals.data
   *
   * @param  {Object} req express.js request
   * @param  {Object} res express.js response
   *
   * @api [get] /portfolio/{portfolioId}
   * description: "Find one portfolio by id"
   * responses:
   *   "200":
   *     description: "Find portfolio by id success"
   *     schema:
   *       type: object
   *       properties:
   *         portfolio:
   *           $ref: "#/definitions/portfolio"
   */
Default findOne action
Record is preloaded in context loader by default and is avaible as res.locals.data

@param  {Object} req express.js request
@param  {Object} res express.js response


Default findOne action Record is preloaded in context loader by default and is avaible as res . locals . data @param { Object } req express . js request @param { Object } res express . js response
findOne(req, res, next) {
    if (!res.locals.data) return next();
    if (!res.locals.data.published) {
      if (!req.we.acl.canStatic('access_portfolio_unpublished', req.userRoleNames)) {
        return res.forbidden();
      }
    }
    req.we.hooks.trigger('we:after:send:ok:response', {
      res: res, req: req
    }, (err)=> {
      if (err) return res.serverError(err);
      return res.ok();
    });
  }
findOne ( req , res , next ) { if ( ! res . locals . data ) return next ( ) ; if ( ! res . locals . data . published ) { if ( ! req . we . acl . canStatic ( 'access_portfolio_unpublished' , req . userRoleNames ) ) { return res . forbidden ( ) ; } } req . we . hooks . trigger ( 'we:after:send:ok:response' , { res : res , req : req } , ( err ) => { if ( err ) return res . serverError ( err ) ; return res . ok ( ) ; } ) ; }
Default findOne action
 Record is preloaded in context loader by default and is avaible as res.locals.data
Default findOne action Record is preloaded in context loader by default and is avaible as res . locals . data
// check if can access contents unpublished