Search in sources :

Example 26 with IUser

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

the class UserRoleHelper method convertFromProxyPentahoUser.

public static IUser convertFromProxyPentahoUser(ProxyPentahoUser user, List<UserToRoleAssignment> assignments, 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(getRolesForUser(user.getName(), assignments, rsm));
        }
    } catch (KettleException e) {
        // TODO Auto-generated catch block
        e.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)

Example 27 with IUser

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

the class UserRoleHelper method convertToPentahoProxyUsers.

public static ProxyPentahoUser[] convertToPentahoProxyUsers(Set<IUser> users) {
    ProxyPentahoUser[] proxyUsers = new ProxyPentahoUser[users.size()];
    int i = 0;
    for (IUser user : users) {
        proxyUsers[i++] = convertToPentahoProxyUser(user);
    }
    return proxyUsers;
}
Also used : IUser(org.pentaho.di.repository.IUser) ProxyPentahoUser(org.pentaho.platform.security.userroledao.ws.ProxyPentahoUser)

Example 28 with IUser

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

the class UserRoleHelper method convertFromProxyPentahoUser.

public static IUser convertFromProxyPentahoUser(IUserRoleWebService userRoleWebService, ProxyPentahoUser user, UserRoleLookupCache lookupCache, 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());
        try {
            if (userInfo instanceof IEEUser) {
                ((IEEUser) userInfo).setRoles(convertToSetFromProxyPentahoRoles(userRoleWebService.getRolesForUser(user), lookupCache));
            }
        } catch (UserRoleException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    } catch (KettleException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    }
    return userInfo;
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) IUser(org.pentaho.di.repository.IUser) UserRoleException(org.pentaho.platform.security.userroledao.ws.UserRoleException) IEEUser(org.pentaho.di.repository.pur.model.IEEUser)

Example 29 with IUser

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

the class UserRoleHelper method convertToPentahoProxyUsers.

public static ProxyPentahoUser[] convertToPentahoProxyUsers(List<IUser> users) {
    ProxyPentahoUser[] proxyUsers = new ProxyPentahoUser[users.size()];
    int i = 0;
    for (IUser user : users) {
        proxyUsers[i++] = convertToPentahoProxyUser(user);
    }
    return proxyUsers;
}
Also used : IUser(org.pentaho.di.repository.IUser) ProxyPentahoUser(org.pentaho.platform.security.userroledao.ws.ProxyPentahoUser)

Example 30 with IUser

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

the class UserRoleLookupCache method updateUserInLookupSet.

public void updateUserInLookupSet(IUser user) {
    IUser userInfoToUpdate = null;
    for (IUser userInfo : userInfoSet) {
        if (userInfo.getLogin().equals(user.getLogin())) {
            userInfoToUpdate = userInfo;
            break;
        }
    }
    userInfoToUpdate.setDescription(user.getDescription());
    if (!StringUtils.isEmpty(user.getPassword())) {
        userInfoToUpdate.setPassword(user.getPassword());
    }
    if (user instanceof IEEUser) {
        ((IEEUser) userInfoToUpdate).setRoles(((IEEUser) user).getRoles());
    }
}
Also used : 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