cont3xt/view.js
/**
   * GET - /api/views
   *
   * Returns views that the requesting user is allowed to view.
   * @name /views
   * @returns {Cont3xtView[]} views - An array of views that the logged in user can view
   * @returns {boolean} success - True if the request was successful, false otherwise
   */
/api/views
Returns views that the requesting user is allowed to view.
@name /views
@returns {Cont3xtView[]} views - An array of views that the logged in user can view
@returns {boolean} success - True if the request was successful, false otherwise
/ api / views Returns views that the requesting user is allowed to view . @name / views @returns { Cont3xtView [] } views - An array of views that the logged in user can view @returns { boolean } success - True if the request was successful false otherwise
static async apiGet (req, res, next) {
    const roles = await req.user.getRoles();
    const views = await Db.getMatchingViews(req.user.userId, [...roles]);
    for (const view of views) {
      view._editable = view.creator === req.user.userId || req.user.hasRole(view.editRoles);
      view._viewable = view.creator === req.user.userId || req.user.hasRole(view.viewRoles);
    }
    res.send({ success: true, views: views });
  }
static async apiGet ( req , res , next ) { const roles = await req . user . getRoles ( ) ; const views = await Db . getMatchingViews ( req . user . userId , [ ... roles ] ) ; for ( const view of views ) { view . _editable = view . creator === req . user . userId || req . user . hasRole ( view . editRoles ) ; view . _viewable = view . creator === req . user . userId || req . user . hasRole ( view . viewRoles ) ; } res . send ( { success : true , views : views } ) ; }
GET - /api/views
 Returns views that the requesting user is allowed to view.
GET - / api / views Returns views that the requesting user is allowed to view .
// Set editable on any views that the user is allowed to edit