Package org.fenixedu.academic.service.services.exceptions

Examples of org.fenixedu.academic.service.services.exceptions.NotAuthorizedException


    @Atomic
    public static Boolean run(Person person) throws NotAuthorizedException {
        /* start chain */
        Person requester = AccessControl.getPerson();
        if ((requester == null) || !requester.hasRole(RoleType.DEPARTMENT_CREDITS_MANAGER)) {
            throw new NotAuthorizedException();
        }
        if (person.getTeacher() != null) {
            final Person requesterPerson = requester;
            Department teacherDepartment = person.getTeacher().getDepartment();
            Collection departmentsWithAccessGranted = requesterPerson.getManageableDepartmentCreditsSet();
            if (!departmentsWithAccessGranted.contains(teacherDepartment)) {
                throw new NotAuthorizedException();
            }
        }
        /* end chain */
        return true;
    }
View Full Code Here


            selectedProfessorship = person.getProfessorshipByExecutionCourse(executionCourse);

            if ((loggedPerson == null) || (selectedProfessorship == null) || !loggedPerson.hasRole(RoleType.TEACHER)
                    || isSamePersonAsBeingRemoved(loggedPerson, selectedProfessorship.getPerson())
                    || selectedProfessorship.getResponsibleFor()) {
                throw new NotAuthorizedException();
            }
        } catch (RuntimeException e) {
            throw new NotAuthorizedException();
        }

        Professorship professorshipToDelete = person.getProfessorshipByExecutionCourse(executionCourse);

        Collection shiftProfessorshipList = professorshipToDelete.getAssociatedShiftProfessorshipSet();
View Full Code Here

        if (!userView.getPerson().hasRole(RoleType.RESOURCE_ALLOCATION_MANAGER)) {

            final WrittenEvaluation writtenEvaluation = readWrittenEvaluation(writtenEvaluationId);

            if (writtenEvaluation.getWrittenEvaluationSpaceOccupationsSet().size() > 0) {
                throw new NotAuthorizedException("written.evaluation.has.allocated.rooms");
            }
        }
    }
View Full Code Here

    public void execute(String executionDegreeId) throws NotAuthorizedException {
        User id = Authenticate.getUser();
        try {
            if ((id == null) || !id.getPerson().hasRole(getRoleType()) || !isCoordinatorOfExecutionDegree(id, executionDegreeId)) {
                throw new NotAuthorizedException();
            }
        } catch (RuntimeException e) {
            throw new NotAuthorizedException();
        }
    }
View Full Code Here

    abstract protected RoleType getRoleType();

    public void execute() throws NotAuthorizedException {
        User userView = Authenticate.getUser();
        if (((userView != null && !userView.getPerson().hasRole(getRoleType()))) || (userView == null)) {
            throw new NotAuthorizedException();
        }

    }
View Full Code Here

            deny();
        }
    }

    public void deny() throws NotAuthorizedException {
        throw new NotAuthorizedException();
    }
View Full Code Here

            User userViewLogged = Authenticate.getUser();

            boolean executionCourseResponsibleLogged = professorshipLogged.isResponsibleFor();

            if (userViewLogged == null || professorshipLogged == null) {
                throw new NotAuthorizedException("error.summary.not.authorized");
            }
            if (executionCourseResponsibleLogged
                    && (summary.getProfessorship() != null && (!summary.getProfessorship().equals(professorshipLogged)))) {
                throw new NotAuthorizedException("error.summary.not.authorized");

            } else if (!executionCourseResponsibleLogged
                    && (summary.getProfessorship() == null || (!summary.getProfessorship().equals(professorshipLogged)))) {
                throw new NotAuthorizedException("error.summary.not.authorized");
            }

        } catch (RuntimeException ex) {
            throw new NotAuthorizedException("error.summary.not.authorized");
        }
    }
View Full Code Here

            abort();
        }
    }

    private void abort() throws NotAuthorizedException {
        throw new NotAuthorizedException();
    }
View Full Code Here

    public void execute(String infoExecutionDegreeId) throws NotAuthorizedException {
        User id = Authenticate.getUser();
        try {
            if ((id == null) || !id.getPerson().hasRole(getRoleType())
                    || !isCoordinatorOfCurrentExecutionDegree(id, infoExecutionDegreeId)) {
                throw new NotAuthorizedException();
            }
        } catch (RuntimeException e) {
            throw new NotAuthorizedException();
        }
    }
View Full Code Here

            boolean isNew = externalId == null;

            if (((id != null && !id.getPerson().hasRole(getRoleType()))) || (id == null)
                    || ((!isNew) && (!verifyCondition(id, externalId)))) {
                throw new NotAuthorizedException();
            }
        } catch (RuntimeException e) {
            logger.error(e.getMessage(), e);
            throw new NotAuthorizedException(e.getMessage());
        }
    }
View Full Code Here

TOP

Related Classes of org.fenixedu.academic.service.services.exceptions.NotAuthorizedException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.