use of org.pentaho.di.repository.pur.model.IEEUser in project pentaho-kettle by pentaho.
the class UserRoleDelegate method createUser.
public void createUser(IUser newUser) throws KettleException {
ensureHasPermissions();
ProxyPentahoUser user = UserRoleHelper.convertToPentahoProxyUser(newUser);
try {
ProxyPentahoUser[] existingUsers = userRoleWebService.getUsers();
if (existsAmong(existingUsers, user)) {
throw userExistsException();
}
} catch (UserRoleException e) {
throw cannotCreateUserException(newUser, e);
}
try {
userRoleWebService.createUser(user);
if (newUser instanceof IEEUser) {
userRoleWebService.setRoles(user, UserRoleHelper.convertToPentahoProxyRoles(((IEEUser) newUser).getRoles()));
}
lookupCache.insertUserToLookupSet(newUser);
fireUserRoleListChange();
} catch (Exception e) {
// it is the only way to determine AlreadyExistsException
if (e.getCause().toString().contains("org.pentaho.platform.api.engine.security.userroledao.AlreadyExistsException")) {
throw userExistsException();
}
throw cannotCreateUserException(newUser, e);
}
}
use of org.pentaho.di.repository.pur.model.IEEUser in project pentaho-kettle by pentaho.
the class UserRoleDelegate method updateUser.
public void updateUser(IUser user) throws KettleException {
ensureHasPermissions();
try {
ProxyPentahoUser proxyUser = UserRoleHelper.convertToPentahoProxyUser(user);
userRoleWebService.updateUser(proxyUser);
if (user instanceof IEEUser) {
userRoleWebService.setRoles(proxyUser, UserRoleHelper.convertToPentahoProxyRoles(((IEEUser) user).getRoles()));
}
lookupCache.updateUserInLookupSet(user);
fireUserRoleListChange();
} catch (Exception e) {
throw new KettleException(BaseMessages.getString(UserRoleDelegate.class, "UserRoleDelegate.ERROR_0007_UNABLE_TO_UPDATE_USER", user.getLogin()), // $NON-NLS-1$
e);
}
}
use of org.pentaho.di.repository.pur.model.IEEUser 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;
}
use of org.pentaho.di.repository.pur.model.IEEUser 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;
}
use of org.pentaho.di.repository.pur.model.IEEUser 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;
}
Aggregations