cont3xt/linkGroup.js
// Verify the link group, returns error msg on failure
Verify the link group, returns error msg on failure
Verify the link group returns error msg on failure
static verifyLinkGroup (lg) {
    if (typeof (lg.name) !== 'string') {
      return 'Missing name';
    }
    if (!Array.isArray(lg.links)) {
      return 'Missing list of links';
    }
    if (lg.viewRoles !== undefined && !Array.isArray(lg.viewRoles)) {
      return 'viewRoles must be array';
    }
    if (lg.editRoles !== undefined && !Array.isArray(lg.editRoles)) {
      return 'editRoles must be array';
    }
    for (const link of lg.links) {
      if (typeof (link.name) !== 'string') {
        return 'Link missing name';
      }
      if (typeof (link.url) !== 'string') {
        return 'Link missing url';
      }
      if (!Array.isArray(link.itypes)) {
        return 'Link missing itypes';
      }
    }
    return null;
  }
static verifyLinkGroup ( lg ) { if ( typeof ( lg . name ) !== 'string' ) { return 'Missing name' ; } if ( ! Array . isArray ( lg . links ) ) { return 'Missing list of links' ; } if ( lg . viewRoles !== undefined && ! Array . isArray ( lg . viewRoles ) ) { return 'viewRoles must be array' ; } if ( lg . editRoles !== undefined && ! Array . isArray ( lg . editRoles ) ) { return 'editRoles must be array' ; } for ( const link of lg . links ) { if ( typeof ( link . name ) !== 'string' ) { return 'Link missing name' ; } if ( typeof ( link . url ) !== 'string' ) { return 'Link missing url' ; } if ( ! Array . isArray ( link . itypes ) ) { return 'Link missing itypes' ; } } return null ; }
Verify the link group, returns error msg on failure
Verify the link group returns error msg on failure
// TODO: Check roles