Opravena editace globálního nastavení- pokud uživatel nemá práva k

editaci, vidí nastavení jako read only. 
closes #141
multitenant
Josef Rokos 10 years ago
parent 1367dc9cdf
commit e16786eda4

@ -1,5 +1,6 @@
package info.bukova.isspst.ui.settings;
import info.bukova.isspst.Constants;
import info.bukova.isspst.data.Address;
import info.bukova.isspst.data.Requirement;
import info.bukova.isspst.data.SettingsData;
@ -8,6 +9,7 @@ import info.bukova.isspst.mail.MailMessage;
import info.bukova.isspst.services.settings.GlobalSettingsService;
import info.bukova.isspst.sort.ReflectionTools;
import info.bukova.isspst.ui.LocaleConverter;
import info.bukova.isspst.ui.SecurityHelper;
import java.util.ArrayList;
import java.util.Collections;
@ -52,7 +54,7 @@ public class GlobalSettingsVM {
}
public boolean isCanSave() {
return true;
return SecurityHelper.isAllGranted(Constants.ROLE_ADMIN);
}
public LocaleConverter getLocConverter() {

@ -8,37 +8,37 @@
<rows>
<row>
<label value="${labels.SuppliersFormCompany}"/>
<textbox value="@bind(vm.settings.mainAddress.company)" width="100%"/>
<textbox value="@bind(vm.settings.mainAddress.company)" width="100%" readonly="@load(not vm.canSave)"/>
</row>
<row>
<label value="${labels.SuppliersFormIC}"/>
<textbox value="@bind(vm.settings.mainAddress.ic)"/>
<textbox value="@bind(vm.settings.mainAddress.ic)" readonly="@load(not vm.canSave)"/>
</row>
<row>
<label value="${labels.SuppliersFormDIC}"/>
<textbox value="@bind(vm.settings.mainAddress.dic)"/>
<textbox value="@bind(vm.settings.mainAddress.dic)" readonly="@load(not vm.canSave)"/>
</row>
<row>
<label value="${labels.SuppliersFormStreet}"/>
<textbox value="@bind(vm.settings.mainAddress.street)" width="100%"/>
<textbox value="@bind(vm.settings.mainAddress.street)" width="100%" readonly="@load(not vm.canSave)"/>
</row>
<row>
<label value="${labels.SuppliersFormNo}"/>
<textbox value="@bind(vm.settings.mainAddress.houseNumber)"/>
<textbox value="@bind(vm.settings.mainAddress.houseNumber)" readonly="@load(not vm.canSave)"/>
</row>
<row>
<label value="${labels.SuppliersFormCity}"/>
<textbox value="@bind(vm.settings.mainAddress.city)" width="100%"/>
<textbox value="@bind(vm.settings.mainAddress.city)" width="100%" readonly="@load(not vm.canSave)"/>
</row>
<row>
<label value="${labels.SuppliersFormZIP}"/>
<textbox value="@bind(vm.settings.mainAddress.zipCode)"/>
<textbox value="@bind(vm.settings.mainAddress.zipCode)" readonly="@load(not vm.canSave)"/>
</row>
</rows>
</grid>
<vbox>
<label value="${labels.ShippingAddresses}"/>
<button label="${labels.AddItem}" onClick="@command('addAddress')"/>
<button label="${labels.AddItem}" onClick="@command('addAddress')" disabled="@load(not vm.canSave)"/>
<listbox model="@load(vm.settings.shippingAddrs)">
<listhead>
<listheader label="${labels.SuppliersFormStreet}"/>
@ -50,19 +50,19 @@
<template name="model">
<listitem>
<listcell>
<textbox inplace="true" value="@bind(each.street)"></textbox>
<textbox inplace="true" value="@bind(each.street)" readonly="@load(not vm.canSave)"></textbox>
</listcell>
<listcell>
<textbox inplace="true" value="@bind(each.houseNumber)"></textbox>
<textbox inplace="true" value="@bind(each.houseNumber)" readonly="@load(not vm.canSave)"></textbox>
</listcell>
<listcell>
<textbox inplace="true" value="@bind(each.city)"></textbox>
<textbox inplace="true" value="@bind(each.city)" readonly="@load(not vm.canSave)"></textbox>
</listcell>
<listcell>
<textbox inplace="true" value="@bind(each.zipCode)"></textbox>
<textbox inplace="true" value="@bind(each.zipCode)" readonly="@load(not vm.canSave)"></textbox>
</listcell>
<listcell>
<button label="${labels.RemoveItem }" onClick="@command('removeAddress', addr=each)"/>
<button label="${labels.RemoveItem }" onClick="@command('removeAddress', addr=each)" disabled="@load(not vm.canSave)"/>
</listcell>
</listitem>
</template>

@ -8,15 +8,15 @@
<rows>
<row>
<label value="${labels.BankName}"/>
<textbox value="@bind(vm.settings.bankName)" width="100%"/>
<textbox value="@bind(vm.settings.bankName)" width="100%" readonly="@load(not vm.canSave)"/>
</row>
<row>
<label value="${labels.AccountNumber}"/>
<textbox value="@bind(vm.settings.accountNumber)"/>
<textbox value="@bind(vm.settings.accountNumber)" readonly="@load(not vm.canSave)"/>
</row>
<row>
<label value="${labels.BankCode}"/>
<textbox value="@bind(vm.settings.bankCode)"/>
<textbox value="@bind(vm.settings.bankCode)" readonly="@load(not vm.canSave)"/>
</row>
</rows>
</grid>

@ -15,12 +15,13 @@
</columns>
<rows>
<row>
<label value="${labels.MailSubject}"/> <textbox value="@bind(vm.settings.newReqTemplate.subject)" width="100%"/>
<label value="${labels.MailSubject}"/> <textbox value="@bind(vm.settings.newReqTemplate.subject)" width="100%" readonly="@load(not vm.canSave)"/>
</row>
<row spans="2">
<vbox>
<ckeditor toolbar="Basic" value="@bind(vm.settings.newReqTemplate.text)" width="460px" height="180px"/>
<button label="${labels.InsertField}" popup="fieldsNew, position=after_start"/>
<ckeditor toolbar="Basic" value="@bind(vm.settings.newReqTemplate.text)" width="460px" height="180px" if="${vm.canSave}"/>
<html content="@load(vm.settings.newReqTemplate.text)" width="460px" height="180px" if="${not vm.canSave}"/>
<button label="${labels.InsertField}" popup="fieldsNew, position=after_start" disabled="@load(not vm.canSave)"/>
</vbox>
</row>
</rows>
@ -34,12 +35,13 @@
</columns>
<rows>
<row>
<label value="${labels.MailSubject}"/> <textbox value="@bind(vm.settings.authReqTemplate.subject)" width="100%"/>
<label value="${labels.MailSubject}"/> <textbox value="@bind(vm.settings.authReqTemplate.subject)" width="100%" readonly="@load(not vm.canSave)"/>
</row>
<row spans="2">
<vbox>
<ckeditor toolbar="Basic" value="@bind(vm.settings.authReqTemplate.text)" width="460px" height="180px"/>
<button label="${labels.InsertField}" popup="fieldsAuth, position=after_start"/>
<ckeditor toolbar="Basic" value="@bind(vm.settings.authReqTemplate.text)" width="460px" height="180px" if="${vm.canSave}" />
<html content="@load(vm.settings.authReqTemplate.text)" width="460px" height="180px" if="${not vm.canSave}"/>
<button label="${labels.InsertField}" popup="fieldsAuth, position=after_start" disabled="@load(not vm.canSave)"/>
</vbox>
</row>
</rows>
@ -53,12 +55,13 @@
</columns>
<rows>
<row>
<label value="${labels.MailSubject}"/> <textbox value="@bind(vm.settings.confReqTemplate.subject)" width="100%"/>
<label value="${labels.MailSubject}"/> <textbox value="@bind(vm.settings.confReqTemplate.subject)" width="100%" readonly="@load(not vm.canSave)"/>
</row>
<row spans="2">
<vbox>
<ckeditor toolbar="Basic" value="@bind(vm.settings.confReqTemplate.text)" width="460px" height="180px"/>
<button label="${labels.InsertField}" popup="fieldsConfirm, position=after_start"/>
<ckeditor toolbar="Basic" value="@bind(vm.settings.confReqTemplate.text)" width="460px" height="180px" if="${vm.canSave}" />
<html content="@load(vm.settings.confReqTemplate.text)" width="460px" height="180px" if="${not vm.canSave}"/>
<button label="${labels.InsertField}" popup="fieldsConfirm, position=after_start" disabled="@load(not vm.canSave)"/>
</vbox>
</row>
</rows>

@ -23,10 +23,10 @@
<template name="model">
<row>
<label value="@load(each)"/>
<textbox value="@bind(vm.settings.refunds[each][0])" inplace="true"/>
<textbox value="@bind(vm.settings.refunds[each][1])" inplace="true"/>
<textbox value="@bind(vm.settings.refunds[each][2])" inplace="true"/>
<textbox value="@bind(vm.settings.refunds[each][3])" inplace="true"/>
<textbox value="@bind(vm.settings.refunds[each][0])" inplace="true" readonly="@load(not vm.canSave)"/>
<textbox value="@bind(vm.settings.refunds[each][1])" inplace="true" readonly="@load(not vm.canSave)"/>
<textbox value="@bind(vm.settings.refunds[each][2])" inplace="true" readonly="@load(not vm.canSave)"/>
<textbox value="@bind(vm.settings.refunds[each][3])" inplace="true" readonly="@load(not vm.canSave)"/>
</row>
</template>
@ -35,7 +35,7 @@
</tabpanel>
<tabpanel>
<vbox>
<button label="${labels.AddItem}" onClick="@command('addVehicle')" sclass="nicebutton"/>
<button label="${labels.AddItem}" onClick="@command('addVehicle')" sclass="nicebutton" disabled="@load(not vm.canSave)"/>
<grid model="@load(vm.settings.vehicles)">
<columns>
<column label="${labels.code}"/>
@ -45,9 +45,9 @@
<rows>
<template name="model">
<row>
<textbox inplace="true" value="@bind(each.code)"/>
<textbox inplace="true" value="@bind(each.description)"/>
<button label="${labels.RemoveItem}" onClick="@command('removeVehicle', vehicle=each)"/>
<textbox inplace="true" value="@bind(each.code)" readonly="@load(not vm.canSave)"/>
<textbox inplace="true" value="@bind(each.description)" readonly="@load(not vm.canSave)"/>
<button label="${labels.RemoveItem}" onClick="@command('removeVehicle', vehicle=each)" disabled="@load(not vm.canSave)"/>
</row>
</template>
</rows>

@ -28,7 +28,7 @@
<div>
<checkbox
label="${labels.EnableRequirements}"
checked="@bind(vm.settings.enableRequirements)" />
checked="@bind(vm.settings.enableRequirements)" disabled="@load(not vm.canSave)" />
</div>
</tabpanel>
<tabpanel>

Loading…
Cancel
Save