package pt.iscte.ci.zas; import net.sourceforge.fenixedu.applicationTier.IUserView; import net.sourceforge.fenixedu.dataTransferObject.person.CollaboratorBean; import net.sourceforge.fenixedu.domain.person.RoleType; import net.sourceforge.zas.aop.bridge.IAOPMetaData; public class ManageCollaboratorsDecider extends FenixDefaultDecider { @Override public boolean internalHasAccess(IUserView subject, String protectedObjectAbstractAccessModes, IAOPMetaData aopMetaData) { if (subject.hasRoleType(RoleType.OPERATOR)) { return true; } else { final CollaboratorBean collaboratorBean = (CollaboratorBean) aopMetaData.getJoinPoint().getArgs()[1]; return subject.getPerson().getCurrentWorkingPlace() != null && subject.getPerson().getCurrentWorkingPlace() == collaboratorBean.getWorkingUnit(); } } }