check for permissions in block list editor

This commit is contained in:
Mads Rasmussen
2022-05-16 13:44:19 +02:00
parent 62525518c2
commit 9e51ad9cbf
2 changed files with 16 additions and 16 deletions

View File

@@ -15,14 +15,11 @@
show-inherit="vm.model.variants.length > 1 && !property.culture && !activeVariant.language.isDefault"
inherits-from="defaultVariant.language.name">
<div ng-class="{'o-40 cursor-not-allowed': vm.model.variants.length > 1 && !activeVariant.language.isDefault && !property.culture && !property.unlockInvariantValue}">
<umb-property-editor
model="property"
preview="vm.model.variants.length > 1 && !activeVariant.language.isDefault && !property.culture && !property.unlockInvariantValue"
ng-attr-readonly="{{vm.model.language.culture === 'da-DK' || undefined}}">
<!-- TODO: Update with correct check for readonly -->
</umb-property-editor>
</div>
<umb-property-editor
model="property"
preview="vm.model.variants.length > 1 && !activeVariant.language.isDefault && !property.culture && !property.unlockInvariantValue"
ng-attr-readonly="{{!vm.allowUpdate || undefined}}">
</umb-property-editor>
</umb-property>
</umb-box-content>
@@ -47,14 +44,11 @@
show-inherit="vm.model.variants.length > 1 && !property.culture && !activeVariant.language.isDefault"
inherits-from="defaultVariant.language.name">
<div ng-class="{'o-40 cursor-not-allowed': vm.model.variants.length > 1 && !activeVariant.language.isDefault && !property.culture && !property.unlockInvariantValue}">
<umb-property-editor
model="property"
preview="vm.model.variants.length > 1 && !activeVariant.language.isDefault && !property.culture && !property.unlockInvariantValue"
ng-attr-readonly="{{vm.model.language.culture === 'da-DK' || undefined}}">
<!-- TODO: Update with correct check for readonly -->
</umb-property-editor>
</div>
<umb-property-editor
model="property"
preview="vm.model.variants.length > 1 && !activeVariant.language.isDefault && !property.culture && !property.unlockInvariantValue"
ng-attr-readonly="{{!vm.allowUpdate || undefined}}">
</umb-property-editor>
</umb-property>
</div>

View File

@@ -42,6 +42,12 @@
}
});
$scope.$watchCollection('vm.model.variants', (newValue) => {
if (newValue && newValue.length > 0) {
vm.allowUpdate = newValue[0].allowedActions.includes('A');
}
});
function getScope() {
return $scope;
}