class staticbo.rules. RuleManager
Source: rules/
Provides methods to manage the rules of a business object model.
Property
new RuleManager()
Creates a new rule manager object.
Property
noAccessBehavior bo.rules.NoAccessBehavior
Defines the default behavior for unauthorized operations.
- Default value
Methods
add(rule)
Adds a new rule to the business object model.
Parameter
Name | Type | Optional | Description |
---|---|---|---|
rule |
|
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.
Parameter
Name | Type | Optional | Description |
---|---|---|---|
context |
|
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.
Parameter
Name | Type | Optional | Description |
---|---|---|---|
defaultBehavior |
|
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 | Optional | Description |
---|---|---|---|
property |
|
The model property to validate. |
|
context |
|
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.