Search in sources :

Example 1 with User

use of com.agiletec.aps.system.services.user.User in project entando-core by entando.

the class UserService method updateUser.

private UserDetails updateUser(UserDetails oldUser, UserRequest userRequest) {
    User user = new User();
    user.setUsername(userRequest.getUsername());
    user.setPassword(userRequest.getPassword());
    user.setDisabled(userRequest.getStatus() != null && !userRequest.getStatus().equals(IUserService.STATUS_ACTIVE));
    if (oldUser.isEntandoUser()) {
        User userToClone = (User) oldUser;
        user.setLastAccess(userToClone.getLastAccess());
        user.setLastPasswordChange(userToClone.getLastPasswordChange());
    }
    return user;
}
Also used : User(com.agiletec.aps.system.services.user.User)

Example 2 with User

use of com.agiletec.aps.system.services.user.User in project entando-core by entando.

the class UserService method createUser.

private UserDetails createUser(UserRequest userRequest) {
    User user = new User();
    user.setUsername(userRequest.getUsername());
    user.setPassword(userRequest.getPassword());
    user.setDisabled(userRequest.getStatus() != null && !userRequest.getStatus().equals(IUserService.STATUS_ACTIVE));
    return user;
}
Also used : User(com.agiletec.aps.system.services.user.User)

Example 3 with User

use of com.agiletec.aps.system.services.user.User in project entando-core by entando.

the class UserAction method executeSave.

protected String executeSave(boolean editProfile) {
    User user = null;
    boolean hasProfile = false;
    try {
        if (this.getStrutsAction() == ApsAdminSystemConstants.ADD) {
            user = new User();
            user.setUsername(this.getUsername());
            user.setPassword(this.getPassword());
        } else if (this.getStrutsAction() == ApsAdminSystemConstants.EDIT) {
            user = (User) this.getUserManager().getUser(this.getUsername());
            if (null != this.getPassword() && this.getPassword().trim().length() > 0) {
                user.setPassword(this.getPassword());
            }
            hasProfile = this.checkUserProfile(this.getUsername(), null);
        }
        user.setDisabled(!this.isActive());
        if (this.isReset()) {
            user.setLastAccess(new Date());
            user.setLastPasswordChange(new Date());
        }
        if (this.getStrutsAction() == ApsAdminSystemConstants.ADD) {
            this.getUserManager().addUser(user);
            hasProfile = this.checkUserProfile(this.getUsername(), this.getProfileTypeCode());
        } else if (this.getStrutsAction() == ApsAdminSystemConstants.EDIT) {
            this.getUserManager().updateUser(user);
            if (null != this.getPassword() && this.getPassword().trim().length() > 0) {
                this.getUserManager().changePassword(this.getUsername(), this.getPassword());
            }
        }
        if (editProfile && hasProfile) {
            return "editProfile";
        }
    } catch (Throwable t) {
        _logger.error("error in executeSave", t);
        return FAILURE;
    }
    return SUCCESS;
}
Also used : User(com.agiletec.aps.system.services.user.User) Date(java.util.Date)

Example 4 with User

use of com.agiletec.aps.system.services.user.User in project entando-core by entando.

the class TestUserAuthorizationAction method addTestUserAndAuthorities.

private void addTestUserAndAuthorities() throws ApsSystemException {
    Group groupForTest = new Group();
    groupForTest.setName(TEST_GROUP_NAME);
    groupForTest.setDescription("group test description");
    this._groupManager.addGroup(groupForTest);
    Role roleForTest = new Role();
    roleForTest.setName(TEST_ROLE_NAME);
    roleForTest.setDescription("role test description");
    this._roleManager.addRole(roleForTest);
    User user = new User();
    user.setUsername(TEST_USER_NAME);
    user.setPassword(TEST_USER_PASSWORD);
    this._userManager.addUser(user);
    this._authorizationManager.addUserAuthorization(TEST_USER_NAME, Group.FREE_GROUP_NAME, TEST_ROLE_NAME);
    this._authorizationManager.addUserAuthorization(TEST_USER_NAME, TEST_GROUP_NAME, "admin");
}
Also used : Role(com.agiletec.aps.system.services.role.Role) Group(com.agiletec.aps.system.services.group.Group) User(com.agiletec.aps.system.services.user.User)

Example 5 with User

use of com.agiletec.aps.system.services.user.User in project entando-core by entando.

the class TestUserProfileAction method createUserForTest.

protected User createUserForTest(String username) {
    User user = new User();
    user.setUsername(username);
    user.setPassword(username);
    return user;
}
Also used : User(com.agiletec.aps.system.services.user.User)

Aggregations

User (com.agiletec.aps.system.services.user.User)15 Date (java.util.Date)6 ApsSystemException (com.agiletec.aps.system.exception.ApsSystemException)2 UserDto (org.entando.entando.aps.system.services.user.model.UserDto)2 SearcherDaoPaginatedResult (com.agiletec.aps.system.common.model.dao.SearcherDaoPaginatedResult)1 Group (com.agiletec.aps.system.services.group.Group)1 Role (com.agiletec.aps.system.services.role.Role)1 UserDetails (com.agiletec.aps.system.services.user.UserDetails)1 ArrayList (java.util.ArrayList)1 UserDtoBuilder (org.entando.entando.aps.system.services.user.model.UserDtoBuilder)1 PagedMetadata (org.entando.entando.web.common.model.PagedMetadata)1 RestListRequest (org.entando.entando.web.common.model.RestListRequest)1