use of org.ovirt.engine.core.common.businessentities.Role in project ovirt-engine by oVirt.
the class RoleListModel method cloneRole.
public void cloneRole() {
commandType = CommandType.Clone;
Role role = getSelectedItem();
initRoleDialog(role);
}
use of org.ovirt.engine.core.common.businessentities.Role in project ovirt-engine by oVirt.
the class RoleListModel method eventRaised.
@Override
public void eventRaised(Event ev, Object sender, EventArgs args) {
super.eventRaised(ev, sender, args);
if (getWindow() != null && sender == ((RoleModel) getWindow()).getIsAdminRole()) {
if (commandType == CommandType.New) {
List<ActionGroup> selectedActionGroups = new ArrayList<>();
selectedActionGroups.add(ActionGroup.LOGIN);
setAttachedActionGroups(selectedActionGroups);
} else {
Role role = getSelectedItem();
Frontend.getInstance().runQuery(QueryType.GetRoleActionGroupsByRoleId, new IdQueryParameters(role.getId()), new AsyncQuery<QueryReturnValue>(returnValue -> {
publicAttachedActions = returnValue.getReturnValue();
setAttachedActionGroups(publicAttachedActions);
}));
}
}
}
use of org.ovirt.engine.core.common.businessentities.Role in project ovirt-engine by oVirt.
the class RoleListModel method remove.
public void remove() {
if (getWindow() != null) {
return;
}
ConfirmationModel model = new ConfirmationModel();
setWindow(model);
model.setTitle(ConstantsManager.getInstance().getConstants().removeRolesTitle());
model.setHelpTag(HelpTag.remove_role);
// $NON-NLS-1$
model.setHashName("remove_role");
ArrayList<String> list = new ArrayList<>();
for (Role role : getSelectedItems()) {
list.add(role.getName());
}
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.Role in project ovirt-engine by oVirt.
the class RoleListModel method setAttachedActionGroups.
void setAttachedActionGroups(List<ActionGroup> attachedActions) {
Role role = getSelectedItem();
RoleModel model = (RoleModel) getWindow();
ArrayList<SelectionTreeNodeModel> selectionTree = RoleTreeView.getRoleTreeView(model.getIsNew() ? false : role.isReadonly(), model.getIsAdminRole().getEntity());
for (SelectionTreeNodeModel sm : selectionTree) {
for (SelectionTreeNodeModel smChild : sm.getChildren()) {
smChild.setParent(sm);
smChild.setIsSelectedNotificationPrevent(false);
for (SelectionTreeNodeModel smGrandChild : smChild.getChildren()) {
smGrandChild.setParent(smChild);
smGrandChild.setIsSelectedNotificationPrevent(false);
if (attachedActions.contains(ActionGroup.valueOf(smGrandChild.getTitle()))) {
smGrandChild.setIsSelectedNullable(true);
smGrandChild.updateParentSelection();
}
if (smChild.getChildren().get(0).equals(smGrandChild)) {
smGrandChild.updateParentSelection();
}
}
}
}
model.setPermissionGroupModels(selectionTree);
}
use of org.ovirt.engine.core.common.businessentities.Role in project ovirt-engine by oVirt.
the class RoleListModel method syncSearch.
@Override
protected void syncSearch() {
super.syncSearch();
QueryParametersBase tempVar = new QueryParametersBase();
tempVar.setRefresh(getIsQueryFirstTime());
Frontend.getInstance().runQuery(QueryType.GetAllRoles, tempVar, new AsyncQuery<QueryReturnValue>(returnValue -> {
ArrayList<Role> filteredList = new ArrayList<>();
for (Role item : (ArrayList<Role>) returnValue.getReturnValue()) {
// ignore CONSUME_QUOTA_ROLE in UI
if (item.getId().equals(ApplicationGuids.quotaConsumer.asGuid())) {
continue;
}
if (getItemsFilter() == null || getItemsFilter() == item.getType()) {
filteredList.add(item);
}
}
Collections.sort(filteredList, new NameableComparator());
setItems(filteredList);
}));
setIsQueryFirstTime(false);
}
Aggregations