Package com.evasion.entity.security

Examples of com.evasion.entity.security.User


    public StaticPage createPage(StaticPage page, String userName) throws PersistenceViolationException {
        if (page.getId() != null) {
            throw new PersistenceViolationException("Cette méthode ne peut être utilisé pour une page déja existente");
        }
        User user = new UserDetailsService(em).findUserByUserName(userName);
        page.setUser(user);
        return savePage(page);
    }
View Full Code Here


        }
        return u;
    }

    public User updateUser(User u) {
        final User userBDD = em.find(User.class, u.getUsername());
        LOGGER.debug("Mise à jour du user: {}", u.toString());
        validGrantedAuthority(u);
        if (!userBDD.getPassword().equals(u.getPassword())) {
            encodPassword(u);
        }
        return em.merge(u);
    }
View Full Code Here

    public Account findOrCreateAdminAccount() throws EvasionException {

        Account acc = accountDAO.findAccountByUsername("admin");
        if (acc == null) {
            User admin = userDAO.findById("admin");
            if (admin == null) {
                admin = new User();
                admin.setEnabled(true);
                admin.setUsername("admin");
                admin.setPassword("adminadmin");
                admin.setEmail("admin@localhost");
            }
            Person person = new Individual("", Civilite.monsieur, "admin", "admin", new Date());
            defaultDAO.persist(person);
            acc = new Account(admin, person);
            createAccount(acc);
View Full Code Here

        return acc;
    }

    public void checkOrUpdateAdminAuth() throws EvasionException {
        Authority auth = findOrCreateAdminAuthority();
        User admin = findOrCreateAdminAccount().getUser();
        if (!admin.getAuthorities().contains(auth)) {
            admin.addAuthority(auth);
            updateUser(admin);
        }
    }
View Full Code Here

TOP

Related Classes of com.evasion.entity.security.User

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.