use of org.ovirt.engine.core.common.businessentities.aaa.DbUser in project ovirt-engine by oVirt.
the class AdElementListModel method addUsersToModel.
protected void addUsersToModel(QueryReturnValue returnValue, Set<String> excludeUsers) {
for (Queryable item : (List<Queryable>) returnValue.getReturnValue()) {
DirectoryUser a = (DirectoryUser) item;
if (!excludeUsers.contains(a.getId())) {
EntityModel<DbUser> tempVar2 = new EntityModel<>();
tempVar2.setEntity(new DbUser(a));
getusers().add(tempVar2);
}
}
}
use of org.ovirt.engine.core.common.businessentities.aaa.DbUser in project ovirt-engine by oVirt.
the class UserListModel method postOnAssignTags.
@Override
public void postOnAssignTags(Map<Guid, Boolean> attachedTags) {
TagListModel model = (TagListModel) getWindow();
ArrayList<Guid> userIds = new ArrayList<>();
ArrayList<Guid> grpIds = new ArrayList<>();
for (Object item : getSelectedItems()) {
DbUser user = (DbUser) item;
if (user.isGroup()) {
grpIds.add(user.getId());
} else {
userIds.add(user.getId());
}
}
// prepare attach/detach lists
ArrayList<Guid> tagsToAttach = new ArrayList<>();
ArrayList<Guid> tagsToDetach = new ArrayList<>();
if (model.getItems() != null && model.getItems().size() > 0) {
ArrayList<TagModel> tags = (ArrayList<TagModel>) model.getItems();
TagModel rootTag = tags.get(0);
TagModel.recursiveEditAttachDetachLists(rootTag, attachedTags, tagsToAttach, tagsToDetach);
}
ArrayList<ActionParametersBase> usersToAttach = new ArrayList<>();
ArrayList<ActionParametersBase> grpsToAttach = new ArrayList<>();
for (Guid tag_id : tagsToAttach) {
if (userIds.size() > 0) {
usersToAttach.add(new AttachEntityToTagParameters(tag_id, userIds));
}
if (grpIds.size() > 0) {
grpsToAttach.add(new AttachEntityToTagParameters(tag_id, grpIds));
}
}
if (usersToAttach.size() > 0) {
Frontend.getInstance().runMultipleAction(ActionType.AttachUserToTag, usersToAttach);
}
if (grpsToAttach.size() > 0) {
Frontend.getInstance().runMultipleAction(ActionType.AttachUserGroupToTag, grpsToAttach);
}
ArrayList<ActionParametersBase> usersToDetach = new ArrayList<>();
ArrayList<ActionParametersBase> grpsToDetach = new ArrayList<>();
for (Guid tag_id : tagsToDetach) {
if (userIds.size() > 0) {
usersToDetach.add(new AttachEntityToTagParameters(tag_id, userIds));
}
if (grpIds.size() > 0) {
grpsToDetach.add(new AttachEntityToTagParameters(tag_id, grpIds));
}
}
if (usersToDetach.size() > 0) {
Frontend.getInstance().runMultipleAction(ActionType.DetachUserFromTag, usersToDetach);
}
if (grpsToDetach.size() > 0) {
Frontend.getInstance().runMultipleAction(ActionType.DetachUserGroupFromTag, grpsToDetach);
}
cancel();
}
use of org.ovirt.engine.core.common.businessentities.aaa.DbUser in project ovirt-engine by oVirt.
the class UserPermissionListModel method onAddRoleToUser.
private void onAddRoleToUser() {
AdElementListModel model = (AdElementListModel) getWindow();
if (model.getProgress() != null) {
return;
}
List<Role> roles = model.getRole().getSelectedItems();
// adGroup/user
DbUser user = getEntity();
List<ActionParametersBase> permissionParamsList = new ArrayList<>();
roles.forEach(role -> {
PermissionsOperationsParameters permissionParams = new PermissionsOperationsParameters();
Permission perm = new Permission(user.getId(), role.getId(), null, null);
if (user.isGroup()) {
DbGroup group = new DbGroup();
group.setId(user.getId());
group.setExternalId(user.getExternalId());
group.setName(user.getFirstName());
group.setDomain(user.getDomain());
group.setNamespace(user.getNamespace());
permissionParams.setPermission(perm);
permissionParams.setGroup(group);
} else {
permissionParams.setPermission(perm);
permissionParams.setUser(user);
}
permissionParamsList.add(permissionParams);
});
model.startProgress();
Frontend.getInstance().runMultipleAction(ActionType.AddSystemPermission, permissionParamsList, result -> {
AdElementListModel localModel = (AdElementListModel) result.getState();
localModel.stopProgress();
cancel();
}, model);
}
use of org.ovirt.engine.core.common.businessentities.aaa.DbUser in project ovirt-engine by oVirt.
the class SetVmTicketCommandTest method testNullConsoleUserNameWhenNoUserSet.
/**
* Check that the constructed consule user name is {@code null} when the
* user doesn't have a name.
*/
@Test
public void testNullConsoleUserNameWhenNoUserSet() {
DbUser user = new DbUser();
command.setCurrentUser(user);
assertNull(command.getConsoleUserName());
}
use of org.ovirt.engine.core.common.businessentities.aaa.DbUser in project ovirt-engine by oVirt.
the class SetVmTicketCommandTest method testLoginNameAtDirectoryWhenDirectorySet.
/**
* Check that when the has a name and a directory name the console user name
* is the user name followed by {@code @} and the directory name.
*/
@Test
public void testLoginNameAtDirectoryWhenDirectorySet() {
DbUser user = new DbUser();
user.setLoginName("Legolas");
user.setDomain("MiddleEarth.com");
command.setCurrentUser(user);
assertEquals("Legolas@MiddleEarth.com", command.getConsoleUserName());
}
Aggregations