use of org.ovirt.engine.core.common.businessentities.Permission in project ovirt-engine by oVirt.
the class PermissionListModel method updateActionAvailability.
private void updateActionAvailability() {
getRemoveCommand().setIsExecutionAllowed(getSelectedItems() != null && getSelectedItems().size() > 0);
if (!getRemoveCommand().getIsExecutionAllowed()) {
return;
}
Guid entityGuid = getEntityGuid();
for (Object p : getSelectedItems()) {
if (!entityGuid.equals(((Permission) p).getObjectId())) {
getRemoveCommand().setIsExecutionAllowed(false);
return;
}
}
}
use of org.ovirt.engine.core.common.businessentities.Permission in project ovirt-engine by oVirt.
the class QuotaUserListModel method remove.
public void remove() {
if (getWindow() != null) {
return;
}
ConfirmationModel model = new ConfirmationModel();
setWindow(model);
model.setTitle(ConstantsManager.getInstance().getConstants().removeQuotaAssignmentFromUsersTitle());
model.setHelpTag(HelpTag.remove_quota_assignment_from_user);
// $NON-NLS-1$
model.setHashName("remove_quota_assignment_from_user");
ArrayList<String> list = new ArrayList<>();
for (Permission item : getSelectedItems()) {
list.add(item.getOwnerName());
}
model.setItems(list);
// $NON-NLS-1$
UICommand tempVar = UICommand.createDefaultOkUiCommand("OnRemove", this);
model.getCommands().add(tempVar);
// $NON-NLS-1$
UICommand tempVar2 = UICommand.createCancelUiCommand("Cancel", this);
model.getCommands().add(tempVar2);
}
use of org.ovirt.engine.core.common.businessentities.Permission in project ovirt-engine by oVirt.
the class QuotaUserListModel method updateActionAvailability.
private void updateActionAvailability() {
ArrayList<Permission> items = (getSelectedItems() != null) ? (ArrayList<Permission>) getSelectedItems() : new ArrayList<Permission>();
boolean removeExe = false;
if (items.size() > 0) {
removeExe = true;
}
for (Permission perm : items) {
if (!perm.getRoleId().equals(ApplicationGuids.quotaConsumer.asGuid())) {
removeExe = false;
break;
}
}
getRemoveCommand().setIsExecutionAllowed(removeExe);
}
use of org.ovirt.engine.core.common.businessentities.Permission in project ovirt-engine by oVirt.
the class QuotaUserListModel method syncSearch.
@Override
protected void syncSearch() {
super.syncSearch();
IdQueryParameters param = new IdQueryParameters(getEntity().getId());
param.setRefresh(getIsQueryFirstTime());
param.setRefresh(getIsQueryFirstTime());
Frontend.getInstance().runQuery(QueryType.GetPermissionsToConsumeQuotaByQuotaId, param, new AsyncQuery<QueryReturnValue>(returnValue -> {
ArrayList<Permission> list = returnValue.getReturnValue();
Map<Guid, Permission> map = new HashMap<>();
for (Permission permission : list) {
// filter out sys-admin and dc admin from consumers sub-tab
if (permission.getRoleId().equals(ApplicationGuids.superUser.asGuid()) || permission.getRoleId().equals(ApplicationGuids.dataCenterAdmin.asGuid())) {
continue;
}
if (!map.containsKey(permission.getAdElementId())) {
map.put(permission.getAdElementId(), permission);
} else {
if (map.get(permission.getAdElementId()).getRoleId().equals(ApplicationGuids.quotaConsumer.asGuid())) {
map.put(permission.getAdElementId(), permission);
}
}
}
list.clear();
for (Permission permission : map.values()) {
list.add(permission);
}
setItems(list);
}));
setIsQueryFirstTime(false);
}
use of org.ovirt.engine.core.common.businessentities.Permission in project ovirt-engine by oVirt.
the class SystemPermissionsRemoveConfirmationPopupView method addItemText.
@Override
protected void addItemText(Object item) {
// We assume that the objects passed in are of type permissions.
Permission permissions = (Permission) item;
addItemLabel(messages.userWithRole(permissions.getOwnerName(), permissions.getRoleName()));
}
Aggregations