Search in sources :

Example 16 with Permission

use of org.ovirt.engine.core.common.businessentities.Permission in project ovirt-engine by oVirt.

the class SubTabUserPermissionView method initTable.

void initTable() {
    getTable().enableColumnResizing();
    PermissionTypeColumn typeColumn = new PermissionTypeColumn();
    typeColumn.setContextMenuTitle(constants.typePermission());
    // $NON-NLS-1$
    getTable().addColumn(typeColumn, constants.empty(), "30px");
    AbstractTextColumn<Permission> roleColumn = new AbstractTextColumn<Permission>() {

        @Override
        public String getValue(Permission object) {
            return object.getRoleName();
        }
    };
    roleColumn.makeSortable();
    // $NON-NLS-1$
    getTable().addColumn(roleColumn, constants.rolePermission(), "560px");
    AbstractTextColumn<Permission> permissionColumn = new AbstractObjectNameColumn<Permission>() {

        @Override
        protected Object[] getRawValue(Permission object) {
            return new Object[] { object.getObjectType(), object.getObjectName() };
        }
    };
    permissionColumn.makeSortable();
    // $NON-NLS-1$
    getTable().addColumn(permissionColumn, constants.objectPermission(), "560px");
    AbstractTextColumn<Permission> inheritedColumn = new AbstractGroupNameColumn<Permission>() {

        @Override
        protected Object[] getRawValue(Permission object) {
            return new Object[] { getDetailModel().getEntity(), object.getAdElementId(), object.getOwnerName() };
        }
    };
    inheritedColumn.makeSortable();
    // $NON-NLS-1$
    getTable().addColumn(inheritedColumn, constants.inheritedPermission(), "560px");
}
Also used : AbstractGroupNameColumn(org.ovirt.engine.ui.webadmin.widget.table.column.AbstractGroupNameColumn) Permission(org.ovirt.engine.core.common.businessentities.Permission) AbstractTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn) PermissionTypeColumn(org.ovirt.engine.ui.common.widget.table.column.PermissionTypeColumn) AbstractObjectNameColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractObjectNameColumn)

Example 17 with Permission

use of org.ovirt.engine.core.common.businessentities.Permission in project ovirt-engine by oVirt.

the class AddPermissionCommand method getPermissionCheckSubjects.

@Override
public List<PermissionSubject> getPermissionCheckSubjects() {
    Permission permission = getParameters().getPermission();
    List<PermissionSubject> permissionsSubject = new ArrayList<>();
    permissionsSubject.add(new PermissionSubject(permission.getObjectId(), permission.getObjectType(), getActionType().getActionGroup()));
    initUserAndGroupData();
    // user from the directory service
    if ((getParameters().getUser() != null && dbUser == null) || (getParameters().getGroup() != null && dbGroup == null)) {
        permissionsSubject.add(new PermissionSubject(permission.getObjectId(), permission.getObjectType(), ActionGroup.ADD_USERS_AND_GROUPS_FROM_DIRECTORY));
    }
    return permissionsSubject;
}
Also used : PermissionSubject(org.ovirt.engine.core.bll.utils.PermissionSubject) Permission(org.ovirt.engine.core.common.businessentities.Permission) ArrayList(java.util.ArrayList)

Example 18 with Permission

use of org.ovirt.engine.core.common.businessentities.Permission in project ovirt-engine by oVirt.

the class RemoveUserCommand method executeCommand.

@Override
protected void executeCommand() {
    // Get the identifier of the user to be removed from the parameters:
    Guid id = getParameters().getId();
    // TODO: This should be done without invoking the command to avoid the overhead.
    for (Permission permission : permissionDao.getAllDirectPermissionsForAdElement(id)) {
        PermissionsOperationsParameters tempVar = new PermissionsOperationsParameters(permission);
        tempVar.setShouldBeLogged(false);
        runInternalActionWithTasksContext(ActionType.RemovePermission, tempVar);
    }
    // Delete the user itself:
    dbUserDao.remove(id);
    setSucceeded(true);
}
Also used : PermissionsOperationsParameters(org.ovirt.engine.core.common.action.PermissionsOperationsParameters) Permission(org.ovirt.engine.core.common.businessentities.Permission) Guid(org.ovirt.engine.core.compat.Guid)

Example 19 with Permission

use of org.ovirt.engine.core.common.businessentities.Permission in project ovirt-engine by oVirt.

the class BackendAssignedRolesResourceTest method getEntity.

@Override
protected Permission getEntity(int index) {
    Permission permission = new Permission();
    permission.setId(GUIDS[(index + 1) % 3]);
    permission.setAdElementId(GUIDS[0]);
    permission.setRoleId(GUIDS[index]);
    permission.setObjectType(VdcObjectType.System);
    return permission;
}
Also used : Permission(org.ovirt.engine.core.common.businessentities.Permission)

Example 20 with Permission

use of org.ovirt.engine.core.common.businessentities.Permission in project ovirt-engine by oVirt.

the class MultiLevelAdministrationHandler method addPermission.

public void addPermission(Guid userId, Guid entityId, PredefinedRoles role, VdcObjectType objectType) {
    Permission perms = new Permission();
    perms.setAdElementId(userId);
    perms.setObjectType(objectType);
    perms.setObjectId(entityId);
    perms.setRoleId(role.getId());
    addPermission(perms);
}
Also used : Permission(org.ovirt.engine.core.common.businessentities.Permission)

Aggregations

Permission (org.ovirt.engine.core.common.businessentities.Permission)59 Test (org.junit.Test)14 ArrayList (java.util.ArrayList)12 Guid (org.ovirt.engine.core.compat.Guid)12 PermissionsOperationsParameters (org.ovirt.engine.core.common.action.PermissionsOperationsParameters)9 DbUser (org.ovirt.engine.core.common.businessentities.aaa.DbUser)8 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)6 DbGroup (org.ovirt.engine.core.common.businessentities.aaa.DbGroup)6 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)5 AdElementListModel (org.ovirt.engine.ui.uicommonweb.models.users.AdElementListModel)5 Role (org.ovirt.engine.core.common.businessentities.Role)4 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)3 QueryType (org.ovirt.engine.core.common.queries.QueryType)3 AbstractTextColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn)3 PermissionTypeColumn (org.ovirt.engine.ui.common.widget.table.column.PermissionTypeColumn)3 Frontend (org.ovirt.engine.ui.frontend.Frontend)3 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)3 HelpTag (org.ovirt.engine.ui.uicommonweb.help.HelpTag)3 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)3 Inject (com.google.inject.Inject)2