use of org.pentaho.di.ui.repository.pur.services.IRoleSupportSecurityManager in project pentaho-kettle by pentaho.
the class UserRoleHelperTest method convertFromProxyPentahoUser_CopiesDataFromInput.
@Test
public void convertFromProxyPentahoUser_CopiesDataFromInput() throws Exception {
IRoleSupportSecurityManager manager = mockSecurityManager(false);
ProxyPentahoUser pentahoUser = pentahoUser("name");
pentahoUser.setPassword("password");
pentahoUser.setDescription("desc");
pentahoUser.setEnabled(true);
IUser user = convertFromProxyPentahoUser(pentahoUser, Collections.<UserToRoleAssignment>emptyList(), manager);
assertNotNull(user);
assertEquals(pentahoUser.getName(), user.getName());
assertEquals(pentahoUser.getName(), user.getLogin());
assertEquals(pentahoUser.getPassword(), user.getPassword());
assertEquals(pentahoUser.getDescription(), user.getDescription());
assertEquals(pentahoUser.getEnabled(), user.isEnabled());
}
use of org.pentaho.di.ui.repository.pur.services.IRoleSupportSecurityManager in project pentaho-kettle by pentaho.
the class UserRoleHelperTest method convertFromProxyPentahoUsers_CopiesEachUser.
@Test
public void convertFromProxyPentahoUsers_CopiesEachUser() throws Exception {
UserRoleSecurityInfo info = new UserRoleSecurityInfo();
info.setUsers(Arrays.asList(pentahoUser("user1"), pentahoUser("user2")));
IRoleSupportSecurityManager manager = mockSecurityManager(false);
List<IUser> users = convertFromProxyPentahoUsers(info, manager);
assertNotNull(users);
assertEquals(2, users.size());
assertEquals("user1", users.get(0).getName());
assertEquals("user2", users.get(1).getName());
}
use of org.pentaho.di.ui.repository.pur.services.IRoleSupportSecurityManager in project pentaho-kettle by pentaho.
the class EESecurityController method updateRole.
/**
* updateRole method is called when user has click ok on a edit role dialog. The method updates the role
*
* @throws Exception
*/
private void updateRole() {
if (service != null) {
try {
IUIRole uiRole = eeSecurity.getSelectedRole();
Set<IUIUser> previousUserList = new HashSet<IUIUser>();
previousUserList.addAll(uiRole.getUsers());
uiRole.setDescription(securityRole.getDescription());
uiRole.setUsers(new HashSet<IUIUser>(securityRole.getAssignedUsers()));
((IRoleSupportSecurityManager) service).updateRole(uiRole.getRole());
eeSecurity.updateRole(uiRole, previousUserList);
roleDialog.hide();
} catch (Throwable th) {
// $NON-NLS-1$
messageBox.setTitle(BaseMessages.getString(PKG, "Dialog.Error"));
// $NON-NLS-1$
messageBox.setAcceptLabel(BaseMessages.getString(PKG, "Dialog.Ok"));
messageBox.setMessage(// $NON-NLS-1$
BaseMessages.getString(PKG, "UpdateRole.UnableToUpdateRole", th.getLocalizedMessage()));
messageBox.open();
}
}
}
Aggregations