Page History
This concept page describes both how to control when an action is available shown and how to restrict access to such actions.
...
The availability is based on the selection although specific exceptions exists. For instance not all actions operate on a selected nodeselected item.
Both in the actionbar and in the context menu we want to show actions as enabled or disabled. We do not want to replicate the configuration in both places. Therefore we will configure it on the actions themselves.
...
If no node types are specified the action is available for all nodes.
Access control
Determining wether the current user has access to an action should be based on roles. We need to configure the required roles on the action definition.
If the user does not have access we will show the action as disabled in the actionbar.
If no roles are specified on the action definition it is assumed to mean that everybody has access.
This should follow the configuration style implemented in
Jira | ||||
---|---|---|---|---|
|
Mixins can also be used in node types.
Configuration and naming
Two proposal, either using the term restrictions or the term availability.
Default values need to limit the amount of configuration necessary.
Proposal 1 - Restrictions (implemented)
Property | Meaning | Default value |
---|---|---|
restrictions.root | Restricts whether the action is available for root, true means not restricted | false (restricted) |
restrictions.properties | Restricts whether the action is available for properties, true means not restricted | false (restricted) |
restriction.nodeTypes | Action is restricted if the selected node is not one of the node types in list | empty (not restricted) |
restriction.roles | Action is restricted if current user does not have one of the roles | empty (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
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.nodeTypes | Action is available if empty or selected node is one of the node types in list | empty (available) |
availability.roles | Action is available if empty or current user has one of the roles | empty (available) |
if (roles.empty || item.role in roles) && ((item is null && root) || (item.isProperty && properties) || (item.isNode && (nodeTypes.empty || item.nodeTypes in nodeTypes))
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.
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:
...
If no node types are specified the section is not shown for nodes.
If more than one section applies the first one is used.
Access Control
Determining wether the current user has access to an action should be based on roles. We need to configure the required roles on the action definition.
If the user does not have access we will show the action as disabled in the actionbar.
If no roles are specified on the action definition it is assumed to mean that everybody has access.
Proposal 1 - Restrictions (implemented)
Property | Meaning | Default value |
---|---|---|
restrictions.root | Restricts whether the section is shown for root, true means shown | false (not shown) |
restrictions.properties | Restricts whether the action is available for properties, true means not restricted | false (not shown) |
restriction.nodeTypes | Restricts that the section is shown only for the node types in list | empty (shown) |
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.nodeTypes | Section is shown if empty or selected node is one of the node types in list | empty (shown) |
if (item is null && root) || (item.isProperty && properties) || (item.isNode && (nodeTypes.empty || item.nodeTypes in nodeTypes)
Proposal 3 - Restrictions, meanings inverted
Property | Meaning | Default value |
---|---|---|
restrictions.root | Restricts whether the section is shown for root, false means shown | true (not shown) |
restrictions.properties | Restricts whether the action is available for properties | true (not shown) |
restriction.nodeTypes | Restricts that the section is shown only for the node types in list | empty (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.This should follow the configuration style implemented in Jira
We control availability by hiding sections and disabling groups or individual actions.
...