From 780edd5678d5203779f88b6d3e6aa4565eb4195d Mon Sep 17 00:00:00 2001 From: Josef Rokos Date: Sun, 18 Jan 2015 15:54:50 +0100 Subject: [PATCH] =?UTF-8?q?Opravena=20kontrola=20pr=C3=A1v=20v=20agend?= =?UTF-8?q?=C4=9B=20"Schv=C3=A1len=C3=A9=20polo=C5=BEky=20po=C5=BEadavk?= =?UTF-8?q?=C5=AF".=20refs=20#183?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WorkgroupAwareServiceEvaluator.java | 14 ++++++++-- .../services/orders/ApprovedServiceImpl.java | 27 +++++++++++++++++++ 2 files changed, 39 insertions(+), 2 deletions(-) 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; + } }