use of org.ovirt.engine.core.common.businessentities.Permission in project ovirt-engine by oVirt.
the class GetPermissionsForObjectQueryTest method setUp.
@Before
@Override
public void setUp() throws Exception {
super.setUp();
objectID = Guid.newGuid();
Permission permission = new Permission();
permission.setObjectId(objectID);
mockedPermissions = Collections.singletonList(permission);
}
use of org.ovirt.engine.core.common.businessentities.Permission in project ovirt-engine by oVirt.
the class UserPermissionListModel method syncSearch.
@Override
protected void syncSearch() {
if (getEntity() == null) {
return;
}
IdQueryParameters mlaParams = new IdQueryParameters(getEntity().getId());
mlaParams.setRefresh(getIsQueryFirstTime());
Frontend.getInstance().runQuery(QueryType.GetPermissionsOnBehalfByAdElementId, mlaParams, new AsyncQuery<>((AsyncCallback<QueryReturnValue>) returnValue -> {
ArrayList<Permission> list = returnValue.getReturnValue();
ArrayList<Permission> newList = new ArrayList<>();
for (Permission permission : list) {
if (!permission.getRoleId().equals(ApplicationGuids.quotaConsumer.asGuid())) {
newList.add(permission);
}
}
setItems(newList);
}));
setIsQueryFirstTime(false);
}
use of org.ovirt.engine.core.common.businessentities.Permission in project ovirt-engine by oVirt.
the class UserPermissionListModel method updateActionAvailability.
private void updateActionAvailability() {
boolean isInherited = false;
Permission p = getSelectedItem();
if (p != null && getEntity() != null) {
isInherited = !p.getAdElementId().equals(getEntity().getId());
}
getRemoveCommand().setIsExecutionAllowed(!isInherited && (getSelectedItem() != null || (getSelectedItems() != null && getSelectedItems().size() > 0)));
// User Permission uses the same action panel as all the permission models, but you can't
// add, so we need to hide the add button.
getAddCommand().setIsAvailable(false);
}
use of org.ovirt.engine.core.common.businessentities.Permission in project ovirt-engine by oVirt.
the class UserModule method getPermissionListProvider.
@Provides
@Singleton
public SearchableDetailModelProvider<Permission, UserListModel, UserPermissionListModel> getPermissionListProvider(EventBus eventBus, Provider<DefaultConfirmationPopupPresenterWidget> defaultConfirmPopupProvider, final Provider<UserRolesPopupPresenterWidget> popupProvider, final Provider<RolePermissionsRemoveConfirmationPopupPresenterWidget> removeConfirmPopupProvider, final Provider<UserListModel> mainModelProvider, final Provider<UserPermissionListModel> modelProvider) {
SearchableDetailTabModelProvider<Permission, UserListModel, UserPermissionListModel> result = new SearchableDetailTabModelProvider<Permission, UserListModel, UserPermissionListModel>(eventBus, defaultConfirmPopupProvider) {
@Override
public AbstractModelBoundPopupPresenterWidget<? extends Model, ?> getModelPopup(UserPermissionListModel source, UICommand lastExecutedCommand, Model windowModel) {
UserPermissionListModel model = getModel();
if (lastExecutedCommand == model.getAddRoleToUserCommand()) {
return popupProvider.get();
} else {
return super.getModelPopup(source, lastExecutedCommand, windowModel);
}
}
@Override
public AbstractModelBoundPopupPresenterWidget<? extends ConfirmationModel, ?> getConfirmModelPopup(UserPermissionListModel source, UICommand lastExecutedCommand) {
if (lastExecutedCommand == getModel().getRemoveCommand()) {
return removeConfirmPopupProvider.get();
} else {
return super.getConfirmModelPopup(source, lastExecutedCommand);
}
}
};
result.setMainModelProvider(mainModelProvider);
result.setModelProvider(modelProvider);
return result;
}
use of org.ovirt.engine.core.common.businessentities.Permission in project ovirt-engine by oVirt.
the class SubTabQuotaUserView method initTable.
private void initTable() {
getTable().enableColumnResizing();
// $NON-NLS-1$
getTable().addColumn(new PermissionTypeColumn(), constants.empty(), "30px");
AbstractTextColumn<Permission> userColumn = new AbstractTextColumn<Permission>() {
@Override
public String getValue(Permission object) {
return object.getOwnerName();
}
};
userColumn.makeSortable();
// $NON-NLS-1$
getTable().addColumn(userColumn, constants.userUser(), "400px");
AbstractTextColumn<Permission> permissionColumn = new AbstractObjectNameColumn<Permission>() {
@Override
protected Object[] getRawValue(Permission object) {
return new Object[] { object.getObjectType(), object.getObjectName(), getDetailModel().getEntity(), object.getObjectId() };
}
};
permissionColumn.makeSortable();
// $NON-NLS-1$
getTable().addColumn(permissionColumn, constants.inheritedFromUser(), "400px");
}
Aggregations