use of org.ovirt.engine.api.model.User in project ovirt-engine by oVirt.
the class VmMapper method mapConsoleSession.
/**
* This method maps the session of the 'console user', if exists. This is the ovirt user who opened a session
* through the user-console; the one who is said to be 'logged in' (or 'have the ticket') to this VM. Currently
* engine makes available only the name and IP of this user. In the future it may make available also the connection
* protocol used in the session (spice/vnc).
*/
private static Sessions mapConsoleSession(org.ovirt.engine.core.common.businessentities.VM vm, Sessions sessions) {
// currently in format user@domain, so needs to be
String consoleUserName = vm.getConsoleCurentUserName();
// parsed.
if (consoleUserName != null && !consoleUserName.isEmpty()) {
String userName = parseUserName(consoleUserName);
String domainName = parseDomainName(consoleUserName);
User consoleUser = new User();
consoleUser.setUserName(userName);
consoleUser.setDomain(new Domain());
consoleUser.getDomain().setName(domainName);
Session consoleSession = new Session();
consoleSession.setUser(consoleUser);
if (vm.getClientIp() != null && !vm.getClientIp().isEmpty()) {
Ip ip = new Ip();
ip.setAddress(vm.getClientIp());
consoleSession.setIp(ip);
}
consoleSession.setConsoleUser(true);
// TODO: in the future, map the connection protocol as well
sessions.getSessions().add(consoleSession);
}
return sessions;
}
use of org.ovirt.engine.api.model.User in project ovirt-engine by oVirt.
the class BackendRoleResource method addParents.
@Override
protected Role addParents(Role role) {
if (userId != null) {
role.setUser(new User());
role.getUser().setId(userId.toString());
}
return role;
}
use of org.ovirt.engine.api.model.User in project ovirt-engine by oVirt.
the class BackendUserAssignedPermissionsResourceTest method testAddIncompletePermission.
@Test
public void testAddIncompletePermission() throws Exception {
Permission model = new Permission();
model.setUser(new User());
model.getUser().setId(GUIDS[1].toString());
model.setRole(new Role());
model.getRole().setId(GUIDS[3].toString());
setUriInfo(setUpBasicUriExpectations());
try {
collection.add(model);
} catch (WebApplicationException wae) {
verifyIncompleteException(wae, "Permission", "add", "dataCenter|cluster|host|storageDomain|vm|vmPool|template.id");
}
}
use of org.ovirt.engine.api.model.User in project ovirt-engine by oVirt.
the class BackendUsersResourceTest method testAddUser2.
@Test
public void testAddUser2() throws Exception {
setUpEntityQueryExpectations(QueryType.GetDomainList, QueryParametersBase.class, new String[] {}, new Object[] {}, setUpDomains());
setUpAddUserExpectations("ADUSER@" + DOMAIN + ":: username=" + NAMES[0]);
User model = new User();
Domain domain = new Domain();
domain.setName(DOMAIN);
domain.setId(DirectoryEntryIdUtils.encode(domain.getName()));
model.setDomain(domain);
model.setUserName(NAMES[0]);
Response response = collection.add(model);
verifyAddUser(response);
}
use of org.ovirt.engine.api.model.User in project ovirt-engine by oVirt.
the class BackendUserTagResource method addParents.
@Override
protected Tag addParents(Tag tag) {
User user = new User();
user.setId(userId.toString());
tag.setUser(user);
return tag;
}
Aggregations