new IsNotInRoleRule(action[, target], role, message[, priority][, stopsProcessing])

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

Parameters

Name Type Optional Description

action

bo.rules.AuthorizationAction

 

The action to be authorized.

target

(bo.shared.PropertyInfo, string, or null)

Yes

Eventual parameter of the authorization action.

role

string

 

The name of the role the user is not member of.

message

string

 

Human-readable description of the rule failure.

priority

number

Yes

The priority of the rule.

stopsProcessing

boolean

Yes

Indicates the rule behavior in case of failure.

Extends
bo.rules.AuthorizationRule
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 role must be a non-empty string.

Argument error: The message must be a non-empty string.

Properties

noAccessBehavior  bo.rules.NoAccessBehavior

The action to do when the rule fails.

Inherited from
bo.rules.AuthorizationRule#noAccessBehavior

read-only
role  string

The name of the role the user is not member of.

read-only
ruleName  string

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

Inherited from
bo.rules.RuleBase#ruleName

Methods

abstract
execute(userInfo) → (bo.rules.AuthorizationResult or undefined)

Checks if the user is not member of the defined role.

Parameter

Name Type Optional Description

userInfo

bo.system.UserInfo

 

Information about the current user.

Returns

(bo.rules.AuthorizationResult or undefined) Information about the failure.

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

Sets the properties of the rule.

Parameters

Name Type Optional Description

action

 

 

The action to be authorized.

target

 

Yes

Eventual parameter of the authorization action.

message

 

 

Human-readable description of the rule failure.

priority

 

Yes

The priority of the rule.

stopsProcessing

 

Yes

Indicates the rule behavior in case of failure.

Inherited from
bo.rules.AuthorizationRule#initialize
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 Optional Description

message

 

Yes

Human-readable description of the rule failure.

severity

 

 

The severity of the failed rule.

Inherited from
bo.rules.AuthorizationRule#result
Throws

Authorization error: The user has no permission to execute the action.

Returns

The result of the authorization rule.