use of org.ovirt.engine.core.bll.utils.PermissionSubject in project ovirt-engine by oVirt.
the class AddVmFromScratchCommand method getPermissionCheckSubjects.
@Override
public List<PermissionSubject> getPermissionCheckSubjects() {
List<PermissionSubject> permissionList = new ArrayList<>();
permissionList.add(new PermissionSubject(getClusterId(), VdcObjectType.Cluster, getActionType().getActionGroup()));
addPermissionSubjectForAdminLevelProperties(permissionList);
return permissionList;
}
use of org.ovirt.engine.core.bll.utils.PermissionSubject in project ovirt-engine by oVirt.
the class AddVmAndCloneImageCommand method getPermissionCheckSubjects.
@Override
public List<PermissionSubject> getPermissionCheckSubjects() {
List<PermissionSubject> permissionList = new ArrayList<>();
permissionList.add(new PermissionSubject(getClusterId(), VdcObjectType.Cluster, getActionType().getActionGroup()));
for (DiskImage disk : getParameters().getDiskInfoDestinationMap().values()) {
if (disk.getStorageIds() != null && !disk.getStorageIds().isEmpty()) {
permissionList.add(new PermissionSubject(disk.getStorageIds().get(0), VdcObjectType.Storage, ActionGroup.CREATE_DISK));
}
}
addPermissionSubjectForAdminLevelProperties(permissionList);
return permissionList;
}
use of org.ovirt.engine.core.bll.utils.PermissionSubject in project ovirt-engine by oVirt.
the class ClearExternalJobCommand method getPermissionCheckSubjects.
@Override
public List<PermissionSubject> getPermissionCheckSubjects() {
List<PermissionSubject> permissionList = new ArrayList<>();
permissionList.add(new PermissionSubject(MultiLevelAdministrationHandler.SYSTEM_OBJECT_ID, VdcObjectType.System, ActionGroup.INJECT_EXTERNAL_TASKS));
return permissionList;
}
use of org.ovirt.engine.core.bll.utils.PermissionSubject in project ovirt-engine by oVirt.
the class ManageNetworkClustersCommand method checkDetachmentsPermissions.
private boolean checkDetachmentsPermissions() {
for (NetworkCluster detachment : getParameters().getDetachments()) {
final List<PermissionSubject> permissionCheckSubjects = detachPermissionFinder.findPermissionCheckSubjects(detachment.getNetworkId(), DetachNetworkToCluster);
for (PermissionSubject permissionSubject : permissionCheckSubjects) {
final ArrayList<String> messages = new ArrayList<>();
final boolean isUserAllowed = checkSinglePermission(permissionSubject, messages);
if (!isUserAllowed) {
getReturnValue().getValidationMessages().addAll(messages);
return false;
}
}
}
return true;
}
use of org.ovirt.engine.core.bll.utils.PermissionSubject in project ovirt-engine by oVirt.
the class UpdateNetworkClusterPermissionsChecker method checkPermissions.
/**
* Checks the user has permissions either on one of the objects at least.
*/
public boolean checkPermissions(CommandBase<?> command, List<PermissionSubject> permissionCheckSubjects) {
final List<String> messages = new ArrayList<>();
for (PermissionSubject permSubject : permissionCheckSubjects) {
messages.clear();
if (command.checkSinglePermission(permSubject, messages)) {
return true;
}
}
command.getReturnValue().getValidationMessages().addAll(messages);
return false;
}
Aggregations