use of org.ovirt.engine.core.common.action.PermissionsOperationsParameters in project ovirt-engine by oVirt.
the class UserPermissionListModel method onRemove.
private void onRemove() {
if (getSelectedItems() != null && getSelectedItems().size() > 0) {
ConfirmationModel model = (ConfirmationModel) getWindow();
if (model.getProgress() != null) {
return;
}
ArrayList<ActionParametersBase> list = new ArrayList<>();
for (Object perm : getSelectedItems()) {
PermissionsOperationsParameters tempVar = new PermissionsOperationsParameters();
tempVar.setPermission((Permission) perm);
list.add(tempVar);
}
model.startProgress();
Frontend.getInstance().runMultipleAction(ActionType.RemovePermission, list, result -> {
ConfirmationModel localModel = (ConfirmationModel) result.getState();
localModel.stopProgress();
cancel();
}, model);
} else {
cancel();
}
}
use of org.ovirt.engine.core.common.action.PermissionsOperationsParameters in project ovirt-engine by oVirt.
the class RemoveUserCommand method executeCommand.
@Override
protected void executeCommand() {
// Get the identifier of the user to be removed from the parameters:
Guid id = getParameters().getId();
// TODO: This should be done without invoking the command to avoid the overhead.
for (Permission permission : permissionDao.getAllDirectPermissionsForAdElement(id)) {
PermissionsOperationsParameters tempVar = new PermissionsOperationsParameters(permission);
tempVar.setShouldBeLogged(false);
runInternalActionWithTasksContext(ActionType.RemovePermission, tempVar);
}
// Delete the user itself:
dbUserDao.remove(id);
setSucceeded(true);
}
use of org.ovirt.engine.core.common.action.PermissionsOperationsParameters in project ovirt-engine by oVirt.
the class PermissionListModel method onAdd.
private void onAdd() {
AdElementListModel model = (AdElementListModel) getWindow();
if (model.getProgress() != null) {
return;
}
if (model.getSearchType() != AdSearchType.EVERYONE && model.getSelectedItems() == null) {
cancel();
return;
}
ArrayList<DbUser> items = new ArrayList<>();
if (model.getSearchType() == AdSearchType.EVERYONE) {
DbUser tempVar = new DbUser();
tempVar.setId(ApplicationGuids.everyone.asGuid());
items.add(tempVar);
} else {
for (Object item : model.getItems()) {
EntityModel entityModel = (EntityModel) item;
if (entityModel.getIsSelected()) {
items.add((DbUser) entityModel.getEntity());
}
}
}
Role role = model.getRole().getSelectedItem();
// adGroup/user
ArrayList<ActionParametersBase> list = new ArrayList<>();
for (DbUser user : items) {
Permission perm = new Permission(user.getId(), role.getId(), getEntityGuid(), getObjectType());
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());
PermissionsOperationsParameters tempVar3 = new PermissionsOperationsParameters();
tempVar3.setPermission(perm);
tempVar3.setGroup(group);
list.add(tempVar3);
} else {
PermissionsOperationsParameters tempVar4 = new PermissionsOperationsParameters();
tempVar4.setPermission(perm);
tempVar4.setUser(user);
list.add(tempVar4);
}
}
model.startProgress();
Frontend.getInstance().runMultipleAction(ActionType.AddPermission, list, result -> {
AdElementListModel localModel = (AdElementListModel) result.getState();
localModel.stopProgress();
cancel();
}, model);
}
use of org.ovirt.engine.core.common.action.PermissionsOperationsParameters in project ovirt-engine by oVirt.
the class SystemPermissionListModel method onAttach.
private void onAttach() {
AdElementListModel model = (AdElementListModel) getWindow();
if (model.getProgress() != null) {
return;
}
if (model.getSelectedItems() == null) {
cancel();
return;
}
ArrayList<DbUser> items = new ArrayList<>();
for (Object item : model.getItems()) {
EntityModel entityModel = (EntityModel) item;
if (entityModel.getIsSelected()) {
items.add((DbUser) entityModel.getEntity());
}
}
Role role = model.getRole().getSelectedItem();
ArrayList<ActionParametersBase> list = new ArrayList<>();
for (DbUser user : items) {
Permission perm = new Permission(user.getId(), role.getId(), null, null);
if (user.isGroup()) {
DbGroup group = new DbGroup();
group.setId(user.getId());
group.setName(user.getFirstName());
group.setDomain(user.getDomain());
group.setExternalId(user.getExternalId());
group.setNamespace(user.getNamespace());
PermissionsOperationsParameters tempVar2 = new PermissionsOperationsParameters();
tempVar2.setPermission(perm);
tempVar2.setGroup(group);
list.add(tempVar2);
} else {
PermissionsOperationsParameters tempVar3 = new PermissionsOperationsParameters();
tempVar3.setPermission(perm);
tempVar3.setUser(user);
list.add(tempVar3);
}
}
model.startProgress();
Frontend.getInstance().runMultipleAction(ActionType.AddSystemPermission, list, result -> {
AdElementListModel localModel = (AdElementListModel) result.getState();
localModel.stopProgress();
cancel();
}, model);
}
use of org.ovirt.engine.core.common.action.PermissionsOperationsParameters in project ovirt-engine by oVirt.
the class RolePermissionListModel method onRemove.
private void onRemove() {
if (getSelectedItems() != null && getSelectedItems().size() > 0) {
ConfirmationModel model = (ConfirmationModel) getWindow();
if (model.getProgress() != null) {
return;
}
ArrayList<ActionParametersBase> list = new ArrayList<>();
for (Object perm : getSelectedItems()) {
PermissionsOperationsParameters tempVar = new PermissionsOperationsParameters();
tempVar.setPermission((Permission) perm);
list.add(tempVar);
}
model.startProgress();
Frontend.getInstance().runMultipleAction(ActionType.RemovePermission, list, result -> {
ConfirmationModel localModel = (ConfirmationModel) result.getState();
localModel.stopProgress();
cancel();
}, model);
}
}
Aggregations