Search in sources :

Example 1 with PermissionsOperationsParameters

use of org.ovirt.engine.core.common.action.PermissionsOperationsParameters in project ovirt-engine by oVirt.

the class PermissionListModel 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);
    }
}
Also used : PermissionsOperationsParameters(org.ovirt.engine.core.common.action.PermissionsOperationsParameters) ArrayList(java.util.ArrayList) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase)

Example 2 with PermissionsOperationsParameters

use of org.ovirt.engine.core.common.action.PermissionsOperationsParameters in project ovirt-engine by oVirt.

the class SystemPermissionListModel 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.RemoveSystemPermission, list, result -> {
            ConfirmationModel localModel = (ConfirmationModel) result.getState();
            localModel.stopProgress();
            cancel();
        }, model);
    }
}
Also used : PermissionsOperationsParameters(org.ovirt.engine.core.common.action.PermissionsOperationsParameters) ArrayList(java.util.ArrayList) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase)

Example 3 with PermissionsOperationsParameters

use of org.ovirt.engine.core.common.action.PermissionsOperationsParameters in project ovirt-engine by oVirt.

the class QuotaUserListModel 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);
    }
    cancel();
}
Also used : PermissionsOperationsParameters(org.ovirt.engine.core.common.action.PermissionsOperationsParameters) ArrayList(java.util.ArrayList) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase)

Example 4 with PermissionsOperationsParameters

use of org.ovirt.engine.core.common.action.PermissionsOperationsParameters in project ovirt-engine by oVirt.

the class AddCpuProfileCommand method createPermissionParameters.

private PermissionsOperationsParameters createPermissionParameters(Guid userId, Guid roleId) {
    Permission permission = new Permission(userId, roleId, getProfileId(), VdcObjectType.CpuProfile);
    permission.setObjectName(getParameters().getProfile().getName());
    if (MultiLevelAdministrationHandler.EVERYONE_OBJECT_ID.equals(userId)) {
        permission.setAuthz("N/A");
    }
    PermissionsOperationsParameters permissionsOperationsParameters = new PermissionsOperationsParameters(permission);
    permissionsOperationsParameters.setParametersCurrentUser(getCurrentUser());
    permissionsOperationsParameters.setSessionId(getContext().getEngineContext().getSessionId());
    return permissionsOperationsParameters;
}
Also used : PermissionsOperationsParameters(org.ovirt.engine.core.common.action.PermissionsOperationsParameters) Permission(org.ovirt.engine.core.common.businessentities.Permission)

Example 5 with PermissionsOperationsParameters

use of org.ovirt.engine.core.common.action.PermissionsOperationsParameters in project ovirt-engine by oVirt.

the class BackendAssignedPermissionsResource method add.

@Override
public Response add(Permission permission) {
    validateParameters(permission, isPrincipalSubCollection() ? new String[] { "role.id|name", "dataCenter|cluster|host|storageDomain|vm|vmPool|template.id" } : new String[] { "role.id|name", "user|group.id" });
    PermissionsOperationsParameters parameters = getParameters(permission);
    QueryIdResolver<Guid> resolver = new QueryIdResolver<>(QueryType.GetPermissionById, IdQueryParameters.class);
    return performCreate(ActionType.AddPermission, parameters, resolver);
}
Also used : PermissionsOperationsParameters(org.ovirt.engine.core.common.action.PermissionsOperationsParameters) Guid(org.ovirt.engine.core.compat.Guid)

Aggregations

PermissionsOperationsParameters (org.ovirt.engine.core.common.action.PermissionsOperationsParameters)16 ArrayList (java.util.ArrayList)9 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)9 Permission (org.ovirt.engine.core.common.businessentities.Permission)8 DbGroup (org.ovirt.engine.core.common.businessentities.aaa.DbGroup)5 DbUser (org.ovirt.engine.core.common.businessentities.aaa.DbUser)5 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)5 Role (org.ovirt.engine.core.common.businessentities.Role)3 Guid (org.ovirt.engine.core.compat.Guid)3 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)3 AdElementListModel (org.ovirt.engine.ui.uicommonweb.models.users.AdElementListModel)3