Page History
...
Mixins can also be used in node types.
Configuration and naming
Two proposal, either using the term restrictions or the term availability. Proposal 2 is used.
Default values need to limit the amount of configuration necessary.
Proposal 1 - Restrictions (implemented)
| ||
---|---|---|
if (roles.empty || item.role in roles) && ((item is null && root) || (item.isProperty && properties) || (item.isNode && (nodeTypes.empty || item.nodeTypes in nodeTypes))
Proposal 2 - Availability
Property | Meaning | Default value |
---|---|---|
availability.root | Action is available for root if true | false (not available) |
availability.properties | Action is available for properties if true | false (not available) |
availability.nodes | Action is available for nodes if true | true (available) |
availability.nodeTypes | Action is available if empty or selected node is one of the node types in list | empty (available) |
availability.access.roles | Action is available if empty or current user has one of the roles | empty (available) |
availability.rule | Action is available if empty or rule.isAvailable() returns true | empty (available) |
if (roles.empty || item.role in roles) && ((item is null && root) || (item.isProperty && properties) || (item.isNode && nodes) || (item.isNode && (nodeTypes.empty || item.nodeTypes in nodeTypes)) && (rule is null || rule.isAvailable(item))
Proposal commentary
The term gets a bit confusing, restrictions.root sounds like it makes the action available for only root. But its really available for root AND by node types.
Rules
To allow use of advanced logic in the access evaluation without making the configuration too complicated and confusing, a new interface AvailabilityRule
is introduced. The interface defines just one boolean isAvailable(javax.jcr.Item item)
method. The availability definition can have a rule subnode, where the implementing class is defined (as the class
property). If the rule is defined, the result of the isAvailable
method is used in a logical conjunction with the result of the default availability definition evaluation.
The implementing classes may define their own configuration.
Some proposed rules:
IsDeletedRule
- returns true only if the item has been marked for deletion (i.e. has the mgnl:deleted mixin node type).AllNodeTypesRule
- as the default availability nodeTypes configuration uses disjunction (OR) to evaluate, this rule will return true only if the node has all the node types (e.g. mixins) defined in the rule configuration.ActivationStatusRule
- according to its configuration, the rule will return true only if the item has / has not been yet activated, alternatively if it has been (not) changed since the last activation.AbstractAggregateRule
- an abstract rule, to process more rules at a time (e.g. IsDeletedRule and ActivationStatusRule); the descendant classes will specify the logic:AndAggregateRule
- logical conjunction, i.e. all 'sub-rules' must return true;OrAggregateRule
- logical disjunction, i.e. at least one 'sub-rule' must return true;- ...
Actionbar appearance
The actionbar should only show one section at a time. The section to show depends on the selected node. Therefore we need to configure:
...
Configuration and naming
Proposal 2 (Availability) is used.
Proposal 1 - Restrictions (implemented)
...
| ||
---|---|---|
if (item is null && root) || (item.isProperty && properties) || (item.isNode && (nodeTypes.empty || item.nodeTypes in nodeTypes)
Proposal 2 - Availability
Property | Meaning | Default value |
---|---|---|
availability.root | Section is shown for root if true | false (not shown) |
availability.properties | Section is shown for properties if true | false (not shown) |
availability.nodes | Section is shown for nodes if true | true (shown) |
availability.nodeTypes | Section is shown if empty or selected node is one of the node types in list | empty (shown) |
availability.access.roles | Section is shown if user has one of the defined roles | empty (shown) |
availability.rule | Section is shown if empty or rule.isAvailable() returns true | empty (shown) |
if (item is null && root) || (item.isProperty && properties) || (item.isNode && nodes) || (item.isNode && (nodeTypes.empty || item.nodeTypes in nodeTypes) && (rule is null || rule.isAvailable(item))
Proposal 3 - Restrictions, meanings inverted
| ||
---|---|---|
...
Proposal commentary
The term restrictions seems to make more sense here since we're only gonna pick one. It's more about excluding the one not to shown.
...