Examples of ESecurity


Examples of framework.generic.ESecurity

            }
        }

        //сравниваем
        if (createMask(rts) != mask){
            throw new ESecurity("Попытка установить невозможную комбинацию прав: " + mask);
        }

        return rts;
    }
View Full Code Here

Examples of framework.generic.ESecurity

    @Override
    public JasperPrint getReport(Map<String, Object> params) throws ESecurity, ClipsServerException, JRException {
        ReportDefinition entity = getExistentEntity();
        if (entity.getId() == ReportDefinition.REPORT_CLIENT_SIDE_REPORTS) {
            throw new ESecurity("Невозможно выполнить на сервере отчеты клиента!");
        }
        try {
            checkCommandAccessibility(COMMAND_READ_REPORT);
            try {
                ReportBaseConstant.initReportsFonts();
View Full Code Here

Examples of framework.generic.ESecurity

    @Override
    public int login(Object aCollaboratorID, byte[] tryPasswdHash) throws Exception, ClipsServerException {
        cleanOldSessions();
        CollaboratorAbstract colEntity = findEntity(CollaboratorAbstract.class, (Integer) aCollaboratorID, "сотрудники");
        if (sessionPassword == null) {
            throw new ESecurity("Внутренняя ошибка: Перед вызовом login должен быть вызван getEncryptor ");
        }

        //check is admin or not
        ServConfig sc = manager.find(ServConfig.class, ConfigParametrAbstract.ID_ADMIN_PASSWORD_HASH);
        String adminPassword = (sc == null) ? null : sc.getStrvalue();

        boolean isSuperUser = false;
        if (adminPassword != null && !adminPassword.isEmpty()) {
            isSuperUser = sessionPassword.verifyHash(tryPasswdHash,
                    SessionPassword.char2byte(adminPassword.toCharArray()));
        } else {
            isSuperUser = sessionPassword.verifyPassword(tryPasswdHash, DEFAULT_ADMIN_PASSWORD);
        }

        if (!isSuperUser) {
            if(useLDAP) {
                checkLDAP(colEntity.getLdapName(), tryPasswdHash);
            } else {
                if (colEntity.getPasswordHash() == null) {
                    throw new ESecurity("У Вас не установлен пароль, поэтому вход в систему невозможен. Обратитесь к администратору");
                }

                if (!sessionPassword.verifyHash(tryPasswdHash, colEntity.getPasswordHash())) {
                    sessionPassword = null;
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        // DO NOTHING
                    }
                    throw new ESecurity("Введён неверный пароль");
                }

            }
        }
View Full Code Here

Examples of framework.generic.ESecurity

     */
    @Override
    public SessionSecurityDetails getSession(int aSessionId) throws ClipsServerException {
        cleanOldSessions();
        if (aSessionId == 0) {
            throw new ESecurity("Внутренняя ошибка: Пользователь не зарегистрирован. Идентификатор сессии клиента = 0");
        }
        SessionSecurityDetails d;
        synchronized (sessionDataCash) {
            d = sessionDataCash.get(aSessionId);
            if (d == null) {
                CollaboratorSessionActive ses = manager.find(CollaboratorSessionActive.class, aSessionId);
                if (ses == null) {
                    throw new ESecurity("Внутренняя ошибка: Указана несуществующая сессия клиента");
                }
                d = new SessionSecurityDetails();
                d.sessionId = ses.getSessionId();
                d.collaboratorId = ses.getCollaborator().getId();
                d.isSuperUser = ses.isSuperUser();
View Full Code Here

Examples of framework.generic.ESecurity

        CollaboratorSessionActive ses = null;
        if (aSessionId != 0) {
            ses = manager.find(CollaboratorSessionActive.class, aSessionId);
        }
        if (ses == null) {
            throw new ESecurity("Внутренняя ошибка: Попытка обновить незарегистрированную сессию");
        }
        ses.setLastCallMoment(new Date());
        manager.merge(ses);
    }
View Full Code Here

Examples of framework.generic.ESecurity

     * @param aCommandId
     * @param aRightOrReasonId - либо ид права, со знаком "+" или "-", либо ид. причины недоступности
     */
    public void setCommandAccessReason(int aCommandId, int aRightOrReasonId) throws ESecurity {
        if (cmdAccess == null || aCommandId >= cmdAccess.length) {
            throw new ESecurity("Внутренняя ошибка: не заполнены права бина или определяется доступ к несуществующей команде");
        }
        cmdAccess[aCommandId] = aRightOrReasonId;
    }
View Full Code Here

Examples of framework.generic.ESecurity

        for (Integer id : rights) {
            /*Проверка дополнительного ограничения:
             * дать право можно только в том случае если у раздающего права есть такое право */
            UserRight right = UserRightsSet.getRightFromID(id);
            if (!isSuperUser() && !hasRight(right)) {
                throw new ESecurity("Вы не можете назначать права, которыми не обладаете сами \n" +
                        "(" + right + ")");
            }
            CollaboratorRight r = new CollaboratorRight();
            AuditDoc<CollaboratorRight> auditDoc = new AuditDoc<CollaboratorRight>(null, getCollaborator());
            auditDocList.add(auditDoc);
View Full Code Here

Examples of framework.generic.ESecurity

        checkCommandAccessibility(COMMAND_WRITE_FOLLOWUP_EVENT);
        Followup entity = getExistentEntity();
       
        FollowupEvent event = null;
        if (details.date.before(DateTimeUtils.getDateOnly()) && !isSuperUser() && !hasRight(UserRightsSet.WRITE_STATISTIC_MEDICAL_DATA)) {
            throw new ESecurity("Недостаточно прав для записи о приеме по ДУ задним числом");
        }
        AuditDoc<FollowupEvent> auditFEvent;
        if(details.id != 0) {
            event = findEntity(FollowupEvent.class, details.id);
            checkTheSame(event.getFollup());
View Full Code Here

Examples of framework.generic.ESecurity

        super.onUpdate(entity, details, auditDoc, auditDocList);
        ContraindicationDetails d = (ContraindicationDetails) details;
       
        if(entity.getId() != 0) {
            if(entity.getServiceRender().getId() != d.serviceRenderID) {
                throw new ESecurity("Cмена услуги недопустима");
            }
        }
        if (!DateTimeUtils.belongsToCurrentDay(d.date)) {
            throwNeedAdminSecurityException("Попытка подмены даты");
        }
View Full Code Here

Examples of framework.generic.ESecurity

    // после того как дигноз был назначен больничному его нельзя изменять
    if (entity.getId() != 0){
      if (findEntityList(Sicklist.class, "diagOpen.id", entity.getId()).size() > 0
          || findEntityList(Sicklist.class, "diagClose.id", entity.getId()).size() > 0){
        if (RightPresence(UserRightsSet.WRITE_MEDICAL_DATA_ANY_TIME.id) < 0){
          throw new ESecurity("По этому диагнозу был выдан больничный лист, для его изменения вы должны облодать как минимум правом \"" + UserRightsSet.WRITE_MEDICAL_DATA_ANY_TIME.getDescription() + "\"");
        }
      }
    }
        DiagnosisDetails d = (DiagnosisDetails) details;
       
        if(entity.getId() != 0) {
            if(entity.getServiceRender().getId() != d.serviceRenderID) {
                throw new ESecurity("Cмена услуги недопустима");
            }
        } else {
            if (!DateTimeUtils.belongsToCurrentDay(d.date)
                    && !hasRight(UserRightsSet.WRITE_STATISTIC_MEDICAL_DATA)) {
                throwNeedAdminSecurityException("Недостаточно прав для записи диагноза другой датой");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.