viewer/vueapp/src/components/users/UserService.js
/**
   * Determines whether a user has role to perform a specific task
   * @param {string} role The role in question.
   * @returns {boolean} true if all roles are included
   */
Determines whether a user has role to perform a specific task
@param {string} role The role in question.
@returns {boolean} true if all roles are included
Determines whether a user has role to perform a specific task @param { string } role The role in question . @returns { boolean } true if all roles are included
hasRole (role) {
    const user = store.state.user;
    if (!user) { return false; }
    const roles = role.split(',');
    for (let r of roles) {
      let reverse = false;
      if (r.startsWith('!')) {
        reverse = true;
        r = r.substr(1);
      }
      if ((!reverse && !user.roles.includes(r)) ||
        (reverse && user.roles.includes(r))) {
        return false;
      }
    }
    return true;
  }
hasRole ( role ) { const user = store . state . user ; if ( ! user ) { return false ; } const roles = role . split ( ',' ) ; for ( let r of roles ) { let reverse = false ; if ( r . startsWith ( '!' ) ) { reverse = true ; r = r . substr ( 1 ) ; } if ( ( ! reverse && ! user . roles . includes ( r ) ) || ( reverse && user . roles . includes ( r ) ) ) { return false ; } } return true ; }
Determines whether a user has role to perform a specific task
 @param {string} role The role in question.
Determines whether a user has role to perform a specific task @param { string } role The role in question .