Package framework.beans.security.entities

Examples of framework.beans.security.entities.CollaboratorSessionActive


        sessionPassword = null;
    return registerSesion(colEntity, isSuperUser);
    }

  protected int registerSesion(CollaboratorAbstract colEntity, boolean isSuperUser) throws ClipsServerException{
        CollaboratorSessionActive ses;
        Throwable ex = null;
        Random rnd = new Random();
        int sd = 0, newSessionId = 0, i = 0;
        //@todo иногда 10 не хватает
        while (newSessionId == 0 && i < ClipsServerConstants.MAX_LOGIN_ATTEMPT_COUNT) {
            do {
                sd = rnd.nextInt(Integer.MAX_VALUE) + 1;
                ses = manager.find(CollaboratorSessionActive.class, sd);
            } while (ses != null);
            ses = new CollaboratorSessionActive();
            ses.setSessionId(sd);
            ses.setCollaborator(colEntity);
            ses.setLastCallMoment(new Date());
            ses.setAdmin(isSuperUser);
            ses.incRefCount();
            try {
                manager.persist(ses);
                manager.flush();
                newSessionId = sd;
            } catch (Throwable e) {
View Full Code Here


   * @param aSessionId
   * @throws ClipsServerException
     */
    @Override
    public void logout(int aSessionId) throws ClipsServerException {
        CollaboratorSessionActive ses = null;
        synchronized (sessionDataCash) {
            if (aSessionId != 0) {
                if (sessionDataCash.containsKey(aSessionId)) {
                    sessionDataCash.remove(aSessionId);
                }
                ses = manager.find(CollaboratorSessionActive.class, aSessionId);
            }
        }
        if (ses == null) {
            throw new ClipsServerException("Внутренняя ошибка: Попытка завершить незарегистрированную сессию");
        }
        ses.decRefCount();
        if (ses.getRefCount() == 0) {
            manager.remove(ses);
        } else {
            manager.merge(ses);
        }
    }
View Full Code Here

        }
        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();
                d.currentUserRights = getCollaboratorRights(d.collaboratorId, d.isSuperUser);
                sessionDataCash.put(aSessionId, d);
            }
        }
        return d;
View Full Code Here

   * @param aSessionId
   * @throws ESecurity
     */
    @Override
    public void disturbServer(int aSessionId) throws 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

TOP

Related Classes of framework.beans.security.entities.CollaboratorSessionActive

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.