Search in sources :

Example 1 with MockUser

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

the class TestAuthorizationManager method addUserForTest.

private void addUserForTest(String username, String password) throws Throwable {
    MockUser user = new MockUser();
    user.setUsername(username);
    user.setPassword(password);
    user.setDisabled(false);
    Authorization auth = new Authorization(this._groupManager.getGroup(Group.FREE_GROUP_NAME), this._roleManager.getRole("editor"));
    user.addAuthorization(auth);
    this._userManager.removeUser(user);
    UserDetails extractedUser = this._userManager.getUser(username);
    assertNull(extractedUser);
    this._userManager.addUser(user);
    this._authorizationManager.addUserAuthorization(username, auth);
}
Also used : UserDetails(com.agiletec.aps.system.services.user.UserDetails) MockUser(com.agiletec.aps.system.services.user.MockUser)

Example 2 with MockUser

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

the class TestDataObjectAuthorization method addUserForTest.

private void addUserForTest(String username, String password) throws Throwable {
    MockUser user = new MockUser();
    user.setUsername(username);
    user.setPassword(password);
    user.setDisabled(false);
    Authorization auth = new Authorization(this._groupManager.getGroup(Group.FREE_GROUP_NAME), this._roleManager.getRole("editor"));
    user.addAuthorization(auth);
    this._userManager.removeUser(user);
    UserDetails extractedUser = _userManager.getUser(username);
    assertNull(extractedUser);
    this._userManager.addUser(user);
    this._authorizationManager.addUserAuthorization(username, auth);
}
Also used : Authorization(com.agiletec.aps.system.services.authorization.Authorization) UserDetails(com.agiletec.aps.system.services.user.UserDetails) MockUser(com.agiletec.aps.system.services.user.MockUser)

Example 3 with MockUser

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

the class TestContentAuthorization method addUserForTest.

private void addUserForTest(String username, String password) throws Throwable {
    MockUser user = new MockUser();
    user.setUsername(username);
    user.setPassword(password);
    user.setDisabled(false);
    Authorization auth = new Authorization(this._groupManager.getGroup(Group.FREE_GROUP_NAME), this._roleManager.getRole("editor"));
    user.addAuthorization(auth);
    this._userManager.removeUser(user);
    UserDetails extractedUser = _userManager.getUser(username);
    assertNull(extractedUser);
    this._userManager.addUser(user);
    this._authorizationManager.addUserAuthorization(username, auth);
}
Also used : Authorization(com.agiletec.aps.system.services.authorization.Authorization) UserDetails(com.agiletec.aps.system.services.user.UserDetails) MockUser(com.agiletec.aps.system.services.user.MockUser)

Aggregations

MockUser (com.agiletec.aps.system.services.user.MockUser)3 UserDetails (com.agiletec.aps.system.services.user.UserDetails)3 Authorization (com.agiletec.aps.system.services.authorization.Authorization)2