new RuleManager()
Creates a new rule manager object.
Members
-
noAccessBehavior :bo.rules.NoAccessBehavior
-
Defines the default behavior for unauthorized operations.
Type:
- Default Value:
-
- {bo.rules.NoAccessBehavior#throwError}
Methods
-
add(rule)
-
Adds a new rule to the business object model.
Parameters:
Name Type Description rule
bo.rules.ValidationRule | bo.rules.AuthorizationRule The rule to add.
Throws:
-
Argument error: The rule must be a Rule object.
-
Argument error: The rule is not initialized.
-
-
hasPermission(context)
-
Validates a property - executes all validation rules of the property.
Parameters:
Name Type Description context
bo.rules.AuthorizationContext The context of the action authorization.
Throws:
-
Argument error: The context must be a AuthorizationContext object.
-
Authorization error: The user has no permission to execute the action.
-
-
initialize(defaultBehavior)
-
Initializes the rule manager: sorts the rules by priority and sets the default behavior for unauthorized operations.
Parameters:
Name Type Description defaultBehavior
bo.rules.NoAccessBehavior The default behavior for unauthorized operations.
Throws:
Argument error: The severity must be a NoAccessBehavior item. -
validate(property, context)
-
Validates a property - executes all validation rules of the property.
Parameters:
Name Type Description property
bo.shared.PropertyInfo The model property to validate.
context
bo.rules.ValidationContext The context of the property validation.
Throws:
-
Argument error: The property must be a PropertyInfo object.
-
Argument error: The context must be a ValidationContext object.
-