Search in sources :

Example 6 with IUser

use of org.pentaho.di.repository.IUser in project pentaho-kettle by pentaho.

the class PurRepositorySecurityManagerTest method saveUserInfo_NormalizesInfo_PassesIfNoViolations.

@Test
public void saveUserInfo_NormalizesInfo_PassesIfNoViolations() throws Exception {
    IUser info = new UserInfo("login    ");
    ArgumentCaptor<IUser> captor = ArgumentCaptor.forClass(IUser.class);
    manager.saveUserInfo(info);
    verify(roleDelegate).createUser(captor.capture());
    info = captor.getValue();
    assertEquals("Spaces should be trimmed", "login", info.getLogin());
}
Also used : IUser(org.pentaho.di.repository.IUser) UserInfo(org.pentaho.di.repository.UserInfo) Test(org.junit.Test)

Example 7 with IUser

use of org.pentaho.di.repository.IUser in project pentaho-kettle by pentaho.

the class UIEESecurityUser method getUserInfo.

@Override
public IUser getUserInfo() throws KettleException {
    IUser userInfo = rsm.constructUser();
    userInfo.setDescription(getDescription());
    userInfo.setLogin(getName());
    userInfo.setName(getName());
    userInfo.setUsername(getName());
    userInfo.setPassword(getPassword());
    if (userInfo instanceof IEEUser) {
        for (IUIRole role : getAssignedRoles()) {
            ((IEEUser) userInfo).addRole(role.getRole());
        }
    }
    return userInfo;
}
Also used : IUIUser(org.pentaho.di.ui.repository.repositoryexplorer.model.IUIUser) IUser(org.pentaho.di.repository.IUser) IUIEEUser(org.pentaho.di.ui.repository.pur.repositoryexplorer.IUIEEUser) IEEUser(org.pentaho.di.repository.pur.model.IEEUser) IUIRole(org.pentaho.di.ui.repository.pur.repositoryexplorer.IUIRole)

Example 8 with IUser

use of org.pentaho.di.repository.IUser in project pentaho-kettle by pentaho.

the class PurRepositorySecurityManager method loadUserInfo.

public IUser loadUserInfo(String login, String password) throws KettleException {
    // Create a UserInfo object
    IUser user = constructUser();
    user.setLogin(login);
    user.setPassword(password);
    user.setName(login);
    return user;
}
Also used : IUser(org.pentaho.di.repository.IUser)

Example 9 with IUser

use of org.pentaho.di.repository.IUser in project pentaho-kettle by pentaho.

the class UserRoleDelegate method updateRole.

public void updateRole(IRole role) throws KettleException {
    ensureHasPermissions();
    try {
        List<String> users = new ArrayList<String>();
        for (IUser user : role.getUsers()) {
            users.add(user.getLogin());
        }
        userRoleWebService.updateRole(role.getName(), role.getDescription(), users);
        lookupCache.updateRoleInLookupSet(role);
        fireUserRoleListChange();
    } catch (Exception e) {
        throw new KettleException(BaseMessages.getString(UserRoleDelegate.class, "UserRoleDelegate.ERROR_0012_UNABLE_TO_UPDATE_ROLE", role.getName()), // $NON-NLS-1$
        e);
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) ArrayList(java.util.ArrayList) IUser(org.pentaho.di.repository.IUser) KettleException(org.pentaho.di.core.exception.KettleException) UserRoleException(org.pentaho.platform.security.userroledao.ws.UserRoleException) JSONException(org.json.JSONException)

Example 10 with IUser

use of org.pentaho.di.repository.IUser in project pentaho-kettle by pentaho.

the class UserRoleHelper method convertToUserInfo.

public static IUser convertToUserInfo(ProxyPentahoUser user, ProxyPentahoRole[] roles, IRoleSupportSecurityManager rsm) {
    IUser userInfo = null;
    try {
        userInfo = rsm.constructUser();
        userInfo.setDescription(user.getDescription());
        userInfo.setPassword(user.getPassword());
        userInfo.setLogin(user.getName());
        userInfo.setName(user.getName());
        if (userInfo instanceof IEEUser) {
            ((IEEUser) userInfo).setRoles(convertToSetFromProxyPentahoRoles(roles, rsm));
        }
    } catch (KettleException ke) {
        ke.printStackTrace();
    }
    return userInfo;
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) IUser(org.pentaho.di.repository.IUser) IEEUser(org.pentaho.di.repository.pur.model.IEEUser)

Aggregations

IUser (org.pentaho.di.repository.IUser)34 KettleException (org.pentaho.di.core.exception.KettleException)12 Test (org.junit.Test)8 ProxyPentahoUser (org.pentaho.platform.security.userroledao.ws.ProxyPentahoUser)7 UserInfo (org.pentaho.di.repository.UserInfo)6 IEEUser (org.pentaho.di.repository.pur.model.IEEUser)5 IRoleSupportSecurityManager (org.pentaho.di.ui.repository.pur.services.IRoleSupportSecurityManager)5 ArrayList (java.util.ArrayList)4 EEUserInfo (org.pentaho.di.repository.pur.model.EEUserInfo)3 IUIUser (org.pentaho.di.ui.repository.repositoryexplorer.model.IUIUser)3 UserRoleException (org.pentaho.platform.security.userroledao.ws.UserRoleException)3 HashSet (java.util.HashSet)2 JSONException (org.json.JSONException)2 InvocationOnMock (org.mockito.invocation.InvocationOnMock)2 UserRoleHelper.convertFromProxyPentahoUser (org.pentaho.di.repository.pur.UserRoleHelper.convertFromProxyPentahoUser)2 IRole (org.pentaho.di.repository.pur.model.IRole)2 IUIRole (org.pentaho.di.ui.repository.pur.repositoryexplorer.IUIRole)2 UserRoleSecurityInfo (org.pentaho.platform.security.userroledao.ws.UserRoleSecurityInfo)2 UserToRoleAssignment (org.pentaho.platform.security.userroledao.ws.UserToRoleAssignment)2 IRepositorySyncWebService (com.pentaho.pdi.ws.IRepositorySyncWebService)1