Class: IsNotInAnyRoleRule

bo.commonRules. IsNotInAnyRoleRule

The rule ensures that the user is not member of any role from a group.

new IsNotInAnyRoleRule(action, target, roles, message, priority, stopsProcessing)

Creates a new is-not-in-any-role rule object.

Parameters:
Name Type Argument Default Description
action bo.rules.AuthorizationAction

The action to be authorized.

target bo.shared.PropertyInfo | string | null <optional>

Eventual parameter of the authorization action.

roles Array.<string>

The names of the roles the user cannot be member of.

message string

Human-readable description of the rule failure.

priority number <optional>
100

The priority of the rule.

stopsProcessing boolean <optional>
false

Indicates the rule behavior in case of failure.

Throws:
  • Argument error: The action must be a AuthorizationAction item.
  • Argument error: The target must be a PropertyInfo object in case of property read or write.
  • Argument error: The target must be a non-empty string in case of method execution.
  • Argument error: The target must be null in case of model actions.
  • Argument error: The roles must be an array of string values.
  • Argument error: The message must be a non-empty string.

Extends

Members

<readonly> message :string

Human-readable description of the rule failure.

Type:
  • string
Inherited From:

noAccessBehavior :bo.rules.NoAccessBehavior

The action to do when the rule fails.

Type:
Inherited From:

<readonly> priority :number

The priority of the rule. Higher number means higher priority.

Type:
  • number
Inherited From:
Default Value:
  • 10

<readonly> roles :Array.<string>

The names of the roles the user cannot be member of.

Type:
  • Array.<string>

<readonly> ruleId :string

The identifier of the authorization action. Generally it is the action value, or when target is not empty, the action value and the target name separated by a dot, respectively.

Type:
  • string
Inherited From:

<readonly> ruleName :string

The name of the rule type. The default value usually the name of the constructor, without the Rule suffix.

Type:
  • string
Inherited From:

<readonly> stopsProcessing :boolean

Indicates whether processing of the rules for a property stops when the rule fails.

Type:
  • boolean
Inherited From:
Default Value:
  • false

Methods

<virtual> execute(userInfo) → {bo.rules.AuthorizationResult|undefined}

Checks if the user is not member of any role from the defined group.

Parameters:
Name Type Description
userInfo bo.system.UserInfo

Information about the current user.

Returns:

Information about the failure.

Type
bo.rules.AuthorizationResult | undefined

initialize(action, target, message, priority, stopsProcessing)

Sets the properties of the rule.

Parameters:
Name Type Argument Default Description
action bo.rules.AuthorizationAction

The action to be authorized.

target bo.shared.PropertyInfo | string | null <optional>

Eventual parameter of the authorization action.

message string

Human-readable description of the rule failure.

priority number <optional>
100

The priority of the rule.

stopsProcessing boolean <optional>
false

Indicates the rule behavior in case of failure.

Inherited From:
Throws:
  • Argument error: The action must be a AuthorizationAction item.
  • Argument error: The target must be a PropertyInfo object in case of property read or write.
  • Argument error: The target must be a non-empty string in case of method execution.
  • Argument error: The target must be null in case of model actions.
  • Argument error: The message must be a non-empty string.

result(message, severity) → {bo.rules.AuthorizationResult}

Returns the result of the rule executed. If the rule fails and the noAccessBehavior property is bo.rules.NoAccessBehavior#throwError, throws an authorization error.

Parameters:
Name Type Argument Description
message string <optional>

Human-readable description of the rule failure.

severity bo.rules.RuleSeverity

The severity of the failed rule.

Inherited From:
Throws:
Authorization error: The user has no permission to execute the action.
Returns:

The result of the authorization rule.

Type
bo.rules.AuthorizationResult
If you find bugs or have feature requests, please let us know.

JavaScript business objects ♦ Copyright © 2014-2016 Logikum, Ltd.
Documentation generated by JSDoc 3.2.2 on 2015. December 31. using the DocStrap template.