Package org.openengsb.core.services.internal.security.model

Examples of org.openengsb.core.services.internal.security.model.UserData


    @Before
    public void setUp() throws Exception {
        EntryUtils.setUtilsService(new DefaultOsgiUtilsService(bundleContext));
        entityManager = testPersistenceUnit.getEntityManager("openengsb-security");
        setupUserManager();
        testUser2 = new UserData("testUser2");
        entityManager.persist(testUser2);
        testUser3 = new UserData("testUser3");
        entityManager.persist(testUser3);
    }
View Full Code Here


        }
    }

    @Override
    public void createUser(String username) throws UserExistsException {
        UserData newUser = new UserData();
        newUser.setUsername(username);
        UserPermissionSetData permissionSetData = new UserPermissionSetData(username);
        newUser.setPermissionSet(permissionSetData);
        synchronized (entityManager) {
            entityManager.persist(newUser);
        }
    }
View Full Code Here

        }
    }

    @Override
    public void deleteUser(String username) {
        UserData found;
        try {
            found = doFindUser(username);
        } catch (UserNotFoundException e) {
            LOGGER.warn("user {} was to be deleted, but not found", username);
            return;
View Full Code Here

        }
    }

    @Override
    public String getUserCredentials(String username, final String key) throws UserNotFoundException {
        UserData found = doFindUser(username);
        return found.getCredentials().get(key);
    }
View Full Code Here

        return found.getCredentials().get(key);
    }

    @Override
    public void setUserCredentials(String username, String type, String value) throws UserNotFoundException {
        UserData found = doFindUser(username);
        found.getCredentials().put(type, value);
        synchronized (entityManager) {
            entityManager.merge(found);
        }
    }
View Full Code Here

        }
    }

    @Override
    public void removeUserCredentials(String username, String type) throws UserNotFoundException {
        UserData found = doFindUser(username);
        found.getCredentials().remove(type);
        synchronized (entityManager) {
            entityManager.merge(found);
        }
    }
View Full Code Here

        }
    }

    @Override
    public List<Object> getUserAttribute(String username, String attributename) throws UserNotFoundException {
        UserData user = doFindUser(username);
        EntryValue entryValue = user.getAttributes().get(attributename);
        if (entryValue == null) {
            return null;
        }
        List<EntryElement> value = entryValue.getValue();
        return EntryUtils.convertAllEntryElementsToObject(value);
View Full Code Here

        return EntryUtils.convertAllEntryElementsToObject(value);
    }

    @Override
    public void setUserAttribute(String username, String attributename, Object... value) throws UserNotFoundException {
        UserData user = doFindUser(username);
        EntryValue entryValue = new EntryValue();
        entryValue.setKey(attributename);
        List<EntryElement> entryElementList = EntryUtils.makeEntryElementList(value);
        entryValue.setValue(entryElementList);
        user.getAttributes().put(attributename, entryValue);
        synchronized (entityManager) {
            entityManager.merge(user);
        }
    }
View Full Code Here

        }
    }

    @Override
    public void removeUserAttribute(String username, String attributename) throws UserNotFoundException {
        UserData user = doFindUser(username);
        EntryValue entryValue = user.getAttributes().get(attributename);
        if (entryValue == null) {
            // silently fail if attribute is not present
            LOGGER.warn("user does not have attribute, " + attributename);
            return;
        }
        user.getAttributes().remove(attributename);
        synchronized (entityManager) {
            entityManager.merge(user);
        }
    }
View Full Code Here

        }
    }

    @Override
    public Collection<Permission> getPermissionsForUser(String username) throws UserNotFoundException {
        UserData user = doFindUser(username);
        return getPermissionsFromSetData(user.getPermissionSet());
    }
View Full Code Here

TOP

Related Classes of org.openengsb.core.services.internal.security.model.UserData

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.