[Actions] Restrict mutating actions
Restrict actions which cause mutation of domain objects to types of domain objects which can be created. (This does not include Packet or Telemetry Point, WTD-723.)
This commit is contained in:
@@ -70,9 +70,14 @@ define(
|
||||
* context.
|
||||
*/
|
||||
PropertiesAction.appliesTo = function (context) {
|
||||
return (context || {}).domainObject &&
|
||||
(context || {}).domainObject.hasCapability("type") &&
|
||||
(context || {}).domainObject.hasCapability("persistence");
|
||||
var domainObject = (context || {}).domainObject,
|
||||
type = domainObject && domainObject.getCapability('type'),
|
||||
creatable = type && type.hasFeature('creation');
|
||||
|
||||
// Only allow creatable types to be edited
|
||||
return domainObject &&
|
||||
domainObject.hasCapability("persistence") &&
|
||||
creatable;
|
||||
};
|
||||
|
||||
return PropertiesAction;
|
||||
|
||||
Reference in New Issue
Block a user