Merge branch 'Verze_1.0'
Conflicts: src/main/java/info/bukova/isspst/Constants.java
This commit is contained in:
@@ -108,16 +108,19 @@ public class Constants {
|
|||||||
public final static String PERM_SHOW_ALL_REQ = "PERM_SHOW_ALL_REQ";
|
public final static String PERM_SHOW_ALL_REQ = "PERM_SHOW_ALL_REQ";
|
||||||
public final static String PERM_EDIT_NEW = "PERM_EDIT_NEW";
|
public final static String PERM_EDIT_NEW = "PERM_EDIT_NEW";
|
||||||
public final static String PERM_EDIT_OWN = "PERM_EDIT_OWN";
|
public final static String PERM_EDIT_OWN = "PERM_EDIT_OWN";
|
||||||
|
public final static String PERM_DELETE_NEW = "PERM_DELETE_NEW";
|
||||||
public final static String PERM_SEARCH = "PERM_SEARCH";
|
public final static String PERM_SEARCH = "PERM_SEARCH";
|
||||||
|
|
||||||
public final static Permission SPECIAL_PERMISSIONS[] = {
|
public final static Permission SPECIAL_PERMISSIONS[] = {
|
||||||
new Permission(PERM_EDIT_NEW, "Upravit neschválené", MOD_REQUIREMENTS, PermissionType.GLOBAL),
|
new Permission(PERM_EDIT_NEW, "Upravit neschválené", MOD_REQUIREMENTS, PermissionType.GLOBAL),
|
||||||
|
new Permission(PERM_DELETE_NEW, "Mazat neschválené", MOD_REQUIREMENTS, PermissionType.GLOBAL),
|
||||||
new Permission(PERM_SHOW_WORKGROUP_REQ, "Zobrazení požadavků komise", MOD_REQUIREMENTS, PermissionType.WORKGROUP),
|
new Permission(PERM_SHOW_WORKGROUP_REQ, "Zobrazení požadavků komise", MOD_REQUIREMENTS, PermissionType.WORKGROUP),
|
||||||
new Permission(PERM_SHOW_CENTRE_REQ, "Zobrazení požadavků střediska", MOD_REQUIREMENTS, PermissionType.CENTRE),
|
new Permission(PERM_SHOW_CENTRE_REQ, "Zobrazení požadavků střediska", MOD_REQUIREMENTS, PermissionType.CENTRE),
|
||||||
new Permission(PERM_SHOW_ALL_REQ, "Zobrazení všech požadavků", MOD_REQUIREMENTS, PermissionType.GLOBAL),
|
new Permission(PERM_SHOW_ALL_REQ, "Zobrazení všech požadavků", MOD_REQUIREMENTS, PermissionType.GLOBAL),
|
||||||
new Permission(PERM_APPROVE, "Schválení", MOD_REQUIREMENTS, PermissionType.WORKGROUP),
|
new Permission(PERM_APPROVE, "Schválení", MOD_REQUIREMENTS, PermissionType.WORKGROUP),
|
||||||
|
|
||||||
new Permission(PERM_EDIT_NEW, "Upravit neschválené", MOD_TRIPREQUIREMENTS, PermissionType.GLOBAL),
|
new Permission(PERM_EDIT_NEW, "Upravit neschválené", MOD_TRIPREQUIREMENTS, PermissionType.GLOBAL),
|
||||||
|
new Permission(PERM_DELETE_NEW, "Mazat neschválené", MOD_TRIPREQUIREMENTS, PermissionType.GLOBAL),
|
||||||
new Permission(PERM_SHOW_WORKGROUP_REQ, "Zobrazení požadavků komise", MOD_TRIPREQUIREMENTS, PermissionType.WORKGROUP),
|
new Permission(PERM_SHOW_WORKGROUP_REQ, "Zobrazení požadavků komise", MOD_TRIPREQUIREMENTS, PermissionType.WORKGROUP),
|
||||||
new Permission(PERM_SHOW_CENTRE_REQ, "Zobrazení požadavků střediska", MOD_TRIPREQUIREMENTS, PermissionType.CENTRE),
|
new Permission(PERM_SHOW_CENTRE_REQ, "Zobrazení požadavků střediska", MOD_TRIPREQUIREMENTS, PermissionType.CENTRE),
|
||||||
new Permission(PERM_SHOW_ALL_REQ, "Zobrazení všech požadavků", MOD_TRIPREQUIREMENTS, PermissionType.GLOBAL),
|
new Permission(PERM_SHOW_ALL_REQ, "Zobrazení všech požadavků", MOD_TRIPREQUIREMENTS, PermissionType.GLOBAL),
|
||||||
|
|||||||
@@ -30,6 +30,10 @@ public abstract class AbstractRequirementEvaluator extends AbstractModuleEvaluat
|
|||||||
return req.getState() == RequirementState.NEW;
|
return req.getState() == RequirementState.NEW;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (permission.equals(Constants.PERM_DELETE_NEW)) {
|
||||||
|
return req.getState() == RequirementState.NEW;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package info.bukova.isspst.security;
|
package info.bukova.isspst.security;
|
||||||
|
|
||||||
import info.bukova.isspst.Constants;
|
import info.bukova.isspst.Constants;
|
||||||
|
import info.bukova.isspst.Module;
|
||||||
import info.bukova.isspst.data.Permission;
|
import info.bukova.isspst.data.Permission;
|
||||||
import info.bukova.isspst.data.PermissionType;
|
import info.bukova.isspst.data.PermissionType;
|
||||||
import info.bukova.isspst.data.Role;
|
import info.bukova.isspst.data.Role;
|
||||||
@@ -39,11 +40,22 @@ public class WorkgroupAwareServiceEvaluator implements Evaluator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
User user = (User)authentication.getPrincipal();
|
User user = (User)authentication.getPrincipal();
|
||||||
|
String moduleId = "";
|
||||||
|
|
||||||
|
// TODO - v master větvi je na toto pomocná třída
|
||||||
|
for (Module m : Constants.MODULES) {
|
||||||
|
if (m.getServiceClass() != null && m.getServiceClass().isAssignableFrom(targetDomainObject.getClass())) {
|
||||||
|
moduleId = m.getId();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Permission appPermission = null;
|
Permission appPermission = null;
|
||||||
for (Permission p : Constants.SPECIAL_PERMISSIONS) {
|
for (Permission p : Constants.SPECIAL_PERMISSIONS) {
|
||||||
if (p.getAuthority().equals(permission)) {
|
if (p.getAuthority().equals(permission)
|
||||||
|
&& p.getModule().equals(moduleId)) {
|
||||||
appPermission = p;
|
appPermission = p;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,7 +78,8 @@ public class WorkgroupAwareServiceEvaluator implements Evaluator {
|
|||||||
|
|
||||||
for (Role r : wgRoles) {
|
for (Role r : wgRoles) {
|
||||||
for (Permission p : r.getPermissions()) {
|
for (Permission p : r.getPermissions()) {
|
||||||
if (p.getAuthority().equals(appPermission.getAuthority())) {
|
if (p.getAuthority().equals(appPermission.getAuthority())
|
||||||
|
&& p.getModule().equals(appPermission.getModule())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,6 +59,10 @@ public abstract class AbstractService<T extends DataModel> implements Service<T>
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getDeleteEntityPermission() {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@PreAuthorize("hasPermission(this, 'PERM_ADD')")
|
@PreAuthorize("hasPermission(this, 'PERM_ADD')")
|
||||||
public final T create() {
|
public final T create() {
|
||||||
@@ -101,7 +105,7 @@ public abstract class AbstractService<T extends DataModel> implements Service<T>
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
@PreAuthorize("hasPermission(this, 'PERM_DELETE')")
|
@PreAuthorize("hasPermission(this, 'PERM_DELETE') or hasPermission(#entity, this.getDeleteEntityPermission())")
|
||||||
public void delete(T entity) {
|
public void delete(T entity) {
|
||||||
if (dao == null) {
|
if (dao == null) {
|
||||||
throw new IsspstException("DAO is null");
|
throw new IsspstException("DAO is null");
|
||||||
|
|||||||
@@ -7,9 +7,11 @@ import info.bukova.isspst.services.AbstractOwnedService;
|
|||||||
import info.bukova.isspst.services.LazyLoader;
|
import info.bukova.isspst.services.LazyLoader;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.hibernate.Hibernate;
|
import org.hibernate.Hibernate;
|
||||||
import org.hibernate.Query;
|
import org.hibernate.Query;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
public class InvoicingServiceImpl extends AbstractOwnedService<Invoicing> implements
|
public class InvoicingServiceImpl extends AbstractOwnedService<Invoicing> implements
|
||||||
@@ -54,4 +56,13 @@ public class InvoicingServiceImpl extends AbstractOwnedService<Invoicing> implem
|
|||||||
invoicing.setTotalInvoiced(total);
|
invoicing.setTotalInvoiced(total);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
@PreAuthorize("hasPermission(this, 'PERM_READ')")
|
||||||
|
public List<Invoicing> getAll() {
|
||||||
|
Query q = dao.getQuery("select inv from Invoicing as inv join fetch inv.requirement rq join fetch rq.ownedBy order by rq.numser");
|
||||||
|
return q.list();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -181,6 +181,7 @@ public class OrderServiceImpl extends AbstractOwnedService<Order> implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
|
@PreAuthorize("hasPermission(this, 'PERM_EDIT') or hasPermission(#entity, this.getUpdateEntityPermission())")
|
||||||
public void updateApprovedItems(Order order, boolean orderedChanged)
|
public void updateApprovedItems(Order order, boolean orderedChanged)
|
||||||
{
|
{
|
||||||
if (orderedChanged)
|
if (orderedChanged)
|
||||||
|
|||||||
@@ -382,5 +382,10 @@ public abstract class RequirementBaseServiceImpl<T extends RequirementBase> exte
|
|||||||
public String getUpdateEntityPermission() {
|
public String getUpdateEntityPermission() {
|
||||||
return Constants.PERM_EDIT_NEW;
|
return Constants.PERM_EDIT_NEW;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDeleteEntityPermission() {
|
||||||
|
return Constants.PERM_DELETE_NEW;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -349,6 +349,7 @@ InvoicingInvoiceNumber=Číslo faktury
|
|||||||
InvoicingAmount=Částka
|
InvoicingAmount=Částka
|
||||||
InvoicingDescription=Popis
|
InvoicingDescription=Popis
|
||||||
InvoicingInvoiced=Fakturováno
|
InvoicingInvoiced=Fakturováno
|
||||||
|
InvoicingApplicant=Žadatel
|
||||||
|
|
||||||
HandleComboKeyFilter=#del
|
HandleComboKeyFilter=#del
|
||||||
HandleComboKey=$#del
|
HandleComboKey=$#del
|
||||||
|
|||||||
@@ -29,6 +29,9 @@
|
|||||||
label="${labels.RequirementsGridWorkgroup}"
|
label="${labels.RequirementsGridWorkgroup}"
|
||||||
width="180px"/>
|
width="180px"/>
|
||||||
<listheader
|
<listheader
|
||||||
|
label="${labels.InvoicingApplicant}"
|
||||||
|
width="180px"/>
|
||||||
|
<listheader
|
||||||
label="${labels.InvoicingDescription}"
|
label="${labels.InvoicingDescription}"
|
||||||
width=""/>
|
width=""/>
|
||||||
<listheader
|
<listheader
|
||||||
@@ -161,6 +164,7 @@
|
|||||||
<listcell label="@load(each.requirement.reqDate) @converter('formatedDate', format=labels.DateFormat)" />
|
<listcell label="@load(each.requirement.reqDate) @converter('formatedDate', format=labels.DateFormat)" />
|
||||||
<listcell label="@load(each.requirement.centre)" />
|
<listcell label="@load(each.requirement.centre)" />
|
||||||
<listcell label="@load(each.requirement.workgroup)" />
|
<listcell label="@load(each.requirement.workgroup)" />
|
||||||
|
<listcell label="@load(each.requirement.ownedBy)" />
|
||||||
<listcell label="@load(each.requirement.description)" />
|
<listcell label="@load(each.requirement.description)" />
|
||||||
<listcell label="@load(each.requirement.sumTotal) @converter(vm.standardBigDecimalConverter)" />
|
<listcell label="@load(each.requirement.sumTotal) @converter(vm.standardBigDecimalConverter)" />
|
||||||
<listcell label="@load(each.totalInvoiced) @converter(vm.standardBigDecimalConverter)"
|
<listcell label="@load(each.totalInvoiced) @converter(vm.standardBigDecimalConverter)"
|
||||||
|
|||||||
Reference in New Issue
Block a user