diff --git a/src/main/java/info/bukova/isspst/security/WorkgroupAwareServiceEvaluator.java b/src/main/java/info/bukova/isspst/security/WorkgroupAwareServiceEvaluator.java index a5bd2e8d..8b1ff9e5 100644 --- a/src/main/java/info/bukova/isspst/security/WorkgroupAwareServiceEvaluator.java +++ b/src/main/java/info/bukova/isspst/security/WorkgroupAwareServiceEvaluator.java @@ -7,6 +7,7 @@ import info.bukova.isspst.data.PermissionType; import info.bukova.isspst.data.Role; import info.bukova.isspst.data.User; import info.bukova.isspst.data.Workgroup; +import info.bukova.isspst.services.Service; import info.bukova.isspst.services.workgroups.WorkgroupService; import java.util.List; @@ -42,13 +43,22 @@ public class WorkgroupAwareServiceEvaluator implements Evaluator { User user = (User)authentication.getPrincipal(); String moduleId = ""; + if (targetDomainObject instanceof Service) { + Service service = (Service)targetDomainObject; + Module mod = service.getModule(); + + if (mod != null) { + moduleId = mod.getId(); + } + } + // TODO - v master větvi je na toto pomocná třída - for (Module m : Constants.MODULES) { + /*for (Module m : Constants.MODULES) { if (m.getServiceClass() != null && m.getServiceClass().isAssignableFrom(targetDomainObject.getClass())) { moduleId = m.getId(); break; } - } + }*/ Permission appPermission = null; for (Permission p : Constants.SPECIAL_PERMISSIONS) { diff --git a/src/main/java/info/bukova/isspst/services/orders/ApprovedServiceImpl.java b/src/main/java/info/bukova/isspst/services/orders/ApprovedServiceImpl.java index 39834f49..a9039e0b 100644 --- a/src/main/java/info/bukova/isspst/services/orders/ApprovedServiceImpl.java +++ b/src/main/java/info/bukova/isspst/services/orders/ApprovedServiceImpl.java @@ -1,9 +1,13 @@ package info.bukova.isspst.services.orders; +import info.bukova.isspst.Constants; +import info.bukova.isspst.Module; import info.bukova.isspst.data.JoinedItem; import info.bukova.isspst.data.RequirementItem; import info.bukova.isspst.data.RequirementState; import info.bukova.isspst.data.Workgroup; +import info.bukova.isspst.reporting.Report; +import info.bukova.isspst.reporting.ReportType; import info.bukova.isspst.services.AbstractService; import info.bukova.isspst.services.users.UserService; import info.bukova.isspst.services.workgroups.WorkgroupService; @@ -55,4 +59,27 @@ public class ApprovedServiceImpl extends AbstractService implements return items; } + + @Override + public Module getModule() { + for (Module m : Constants.MODULES) { + if (m.getId() == Constants.MOD_REQUIREMENTS) { + return m; + } + } + + return null; + } + + @Override + public List getReports() { + Report rep = new Report(); + rep.setType(ReportType.DYNAMIC); + rep.setName(Constants.DYNAMIC_REPORT_NAME); + + List ret = new ArrayList(); + ret.add(rep); + + return ret; + } }