Package org.opencustomer.db.vo.system

Examples of org.opencustomer.db.vo.system.UserVO


                log.debug("do ldap login");
            logon = new LdapLogon();         
        }
       
        ActionErrors errors = new ActionErrors();
        UserVO uservo = logon.validate(user, password, Logon.Type.WEBSERVICE, errors);
       
        if(uservo != null && errors.isEmpty())
        {     
            Authenticator auth = new Authenticator(uservo);
            if(auth.isValid(Right.EXTERN_WEBSERVICE_READ))
            {
                UserConfiguration userConf = new UserConfiguration(uservo);
               
                eventList = new ArrayList<HashMap>();
                EventBeanCalculator calc = new EventBeanCalculator(uservo.getCalendar(),startDate,endDate);
                calc.setWithReminderDate(true);
                List<EventBean> eventBeanList = calc.getEventBeans();
                HashMap<String,String> eventMap;
                SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
                               
View Full Code Here


    public UserVO syncLdapUser(String username) throws NamingException
    {
        if(log.isDebugEnabled())
            log.debug("sync user: " + username);
          
        UserVO user = new UserDAO().getByUserName(username);
        LdapGroupVO profile = LdapUtil.getInstance().getProfileForUser(username);
       
        if(user == null && profile == null)
        {
            if(log.isDebugEnabled())
                log.debug("ignoring new user without ldapgroups");
        }
        else if(user == null)
        {
            if(log.isDebugEnabled())
                log.debug("creating new user");
            LdapUtil.getInstance().createUserFromLdap(username);
        }
        else if(user.getProfile().getRole().isAdmin())
        {
            if(log.isDebugEnabled())
                log.debug("user is admin, do nothing");
        }
        else if(user.getProfile().getLdapGroup() != null && !LdapAuthenticator.getInstance().isLdapUser(username))
        {
            new UserDAO().delete(user);
            user = null;
            if(log.isDebugEnabled())
                log.debug("oc user deleted: " + username);
        }
        else if((user.getProfile().getRole().isAdmin() || (user.getProfile().getLdapGroup() == null))&& LdapAuthenticator.getInstance().isLdapUser(username))
        {
            log.error("username conflict: " +  username);
            user = null;
        }
        else if(profile == null)
        {
            if(log.isDebugEnabled())
                log.debug("no ldapgroup for user, deleting user");
            new UserDAO().delete(user);
            user = null;
        }
        else if(user.getProfile().getId() != profile.getProfile().getId())
        {
            if(log.isDebugEnabled())
                log.debug("ldap group change");
            user.setProfile(profile.getProfile());
        }
        else
        {
            if(log.isDebugEnabled())
                log.debug("no changes for user: " + username);
View Full Code Here

     * @return the new UserVO or null if the user is no ldap user, or has no LdapGroup
     * @throws NamingException error on ladp connection
     */
    public UserVO createUserFromLdap(String username) throws NamingException
    {
        UserVO user = new UserDAO().getByUserName(username);
       
        if(!LdapAuthenticator.getInstance().isLdapUser(username))
        {
            if(log.isDebugEnabled())
                log.debug("no ldap user for username: " + username);
            return null;
        }
        else if(user == null)
        {
            LdapGroupVO profile = getProfileForUser(username);
            if(profile != null)
            {
                if(log.isDebugEnabled())
                    log.debug("creating new user: " + username);
                InitialDirContext ctx = new InitialDirContext(env);
                Attributes attrs = ctx.getAttributes("uid=" + username + "," + SystemConfiguration.getInstance().getStringValue(SystemConfiguration.Key.LDAP_USER_PREFIX));
               
                // Defaultwerte setzen
                user = new UserVO();
                user.setUserName(attrs.get("Uid").get().toString());
                user.setProfile(profile.getProfile());
                user.setLocale(adminUser.getLocale());
                user.setOwnerUser(adminUser.getId());
                user.setOwnerGroup(adminUser.getId());
                user.setAccessUser(Access.WRITE_SYSTEM);
                user.setAccessGroup(Access.READ);
                user.setAccessGlobal(Access.READ);
                user.setPassword(SignatureUtility.getInstance().createSignature(new PasswordGenerator().generate()));
               
                new UserDAO().insert(user,adminUser);
                CalendarVO calendar = new CalendarVO();
                calendar.setUser(user);
                calendar.setAccessUser(EntityAccess.Access.WRITE_SYSTEM);
                calendar.setOwnerUser(user.getId());
                calendar.setAccessGroup(EntityAccess.Access.NONE);
                calendar.setOwnerGroup(user.getProfile().getDefaultUsergroup().getId());
                calendar.setAccessGlobal(EntityAccess.Access.NONE);
               
                new CalendarDAO().insert(calendar, user);
            }
            else
            {
                if(log.isDebugEnabled())
                    log.debug("user has no Ldap group: " + username);
            }
        }
        else if((user.getProfile().getRole().isAdmin() || (user.getProfile().getLdapGroup() == null))&& LdapAuthenticator.getInstance().isLdapUser(username))
        {
            log.error("username conflict: " +  username);
        }
        else
        {
View Full Code Here

                log.debug("do ldap login");
            logon = new LdapLogon();         
        }
       
        ActionErrors errors = new ActionErrors();
        UserVO uservo = logon.validate(user, password, Logon.Type.WEBDAV, errors);
       
        if(uservo != null && errors.isEmpty())
        {
            Authenticator auth = new Authenticator(uservo);
            if(auth.isValid(Right.EXTERN_WEBDAV_READ, Right.EXTERN_WEBDAV_WRITE)
                    && SignatureUtility.getInstance().isSignatureValid(uservo.getPassword(),password))
            {
                if(log.isInfoEnabled())
                    log.info("webdav session for user [" + user + "]");
                String session = user+":"+password;
                userMap.put(user, session);
View Full Code Here

TOP

Related Classes of org.opencustomer.db.vo.system.UserVO

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.