@pathmaker-digital/pmd-utilities - v2.2.6
    Preparing search index...

    Function hasRole

    • Checks if a user has the required role.

      Parameters

      • userRoles: string[]

        The roles assigned to the user.

      • requiredRole: string

        The role required for the action.

      Returns boolean

      True if the user has the required role, false otherwise.

      hasRole(["admin", "editor"], "admin"); // true
      hasRole(["viewer"], "editor"); // false