Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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)

Property

MeaningDefault value
restrictions.rootRestricts whether the action is available for root, true means not restrictedfalse (restricted)
restrictions.propertiesRestricts whether the action is available for properties, true means not restrictedfalse (restricted)
restriction.nodeTypesAction is restricted if the selected node is not one of the node types in listempty (not restricted)
restriction.rolesAction is restricted if current user does not have one of the rolesempty (not restricted)

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

PropertyMeaningDefault value
availability.rootAction is available for root if truefalse (not available)
availability.propertiesAction is available for properties if truefalse (not available)
availability.nodesAction is available for nodes if truetrue (available)
availability.nodeTypesAction is available if empty or selected node is one of the node types in listempty (available)
availability.access.rolesAction is available if empty or current user has one of the rolesempty (available)
availability.ruleAction is available if empty or rule.isAvailable() returns trueempty (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)

...

Property

MeaningDefault value
restrictions.rootRestricts whether the section is shown for root, true means shownfalse (not shown)
restrictions.propertiesRestricts whether the action is available for properties, true means not restrictedfalse (not shown)
restriction.nodeTypesRestricts that the section is shown only for the node types in listempty (shown)

if (item is null && root) || (item.isProperty && properties) || (item.isNode && (nodeTypes.empty || item.nodeTypes in nodeTypes)

 

Proposal 2 - Availability

PropertyMeaningDefault value
availability.rootSection is shown for root if truefalse (not shown)
availability.propertiesSection is shown for properties if truefalse (not shown)
availability.nodesSection is shown for nodes if truetrue (shown)
availability.nodeTypesSection is shown if empty or selected node is one of the node types in listempty (shown)
availability.access.rolesSection is shown if user has one of the defined rolesempty (shown)
availability.ruleSection is shown if empty or rule.isAvailable() returns trueempty (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

Property

MeaningDefault value
restrictions.rootRestricts whether the section is shown for root, false means showntrue (not shown)
restrictions.propertiesRestricts whether the action is available for propertiestrue (not shown)
restriction.nodeTypesRestricts that the section is shown only for the node types in listempty (shown)

...

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.

...