Package org.rhq.enterprise.server.authz

Examples of org.rhq.enterprise.server.authz.PermissionException


        long beginTime, long endTime, PageControl pageControl) {
        pageControl.initDefaultOrderingField("value.beginTime", PageOrdering.ASC);
        MeasurementSchedule schedule = entityManager.find(MeasurementSchedule.class, scheduleId);
        int resourceId = schedule.getResource().getId();
        if (authorizationManager.canViewResource(subject, resourceId) == false) {
            throw new PermissionException("User [" + subject
                + "] does not have permission to view call time data for measurementSchedule[id=" + scheduleId
                + "] and resource[id=" + resourceId + "]");
        }
        String query = CallTimeDataValue.QUERY_FIND_RAW_FOR_RESOURCE;
View Full Code Here


        pageControl.addDefaultOrderingField("key.callDestination", PageOrdering.ASC); // add this to sort, if not already specified

        MeasurementSchedule schedule = entityManager.find(MeasurementSchedule.class, scheduleId);
        int resourceId = schedule.getResource().getId();
        if (authorizationManager.canViewResource(subject, resourceId) == false) {
            throw new PermissionException("User [" + subject
                + "] does not have permission to view call time data for measurementSchedule[id=" + scheduleId
                + "] and resource[id=" + resourceId + "]");
        }

        String query = CallTimeDataValue.QUERY_FIND_COMPOSITES_FOR_RESOURCE;
View Full Code Here

            return;
        }

        // Check permissions first
        if (!authorizationManager.hasResourcePermission(user, Permission.MANAGE_CONTENT, resourceId)) {
            throw new PermissionException("User [" + user.getName()
                + "] does not have permission to deploy packages for resource ID [" + resourceId + "]");
        }

        // Load entities for references later in the method
        Resource resource = entityManager.find(Resource.class, resourceId);
View Full Code Here

            return;
        }

        // Check permissions first
        if (!authorizationManager.hasResourcePermission(user, Permission.MANAGE_CONTENT, resourceId)) {
            throw new PermissionException("User [" + user.getName()
                + "] does not have permission to delete installedPackageIds from resource ID [" + resourceId + "]");
        }

        // Load entities for references later in the method
        Resource resource = entityManager.find(Resource.class, resourceId);
View Full Code Here

    public void retrieveBitsFromResource(Subject user, int resourceId, int installedPackageId) {
        LOG.info("Retrieving bits for package [" + installedPackageId + "] on resource ID [" + resourceId + "]");

        // Check permissions first
        if (!authorizationManager.hasResourcePermission(user, Permission.MANAGE_CONTENT, resourceId)) {
            throw new PermissionException("User [" + user.getName() + "] does not have permission to delete package "
                + installedPackageId + " for resource ID [" + resourceId + "]");
        }

        // Load entities for references later in the method
        Resource resource = entityManager.find(Resource.class, resourceId);
View Full Code Here

    @Override
    public byte[] getPackageBytes(Subject user, int resourceId, int installedPackageId) {
        // Check permissions first
        if (!authorizationManager.hasResourcePermission(user, Permission.MANAGE_CONTENT, resourceId)) {
            throw new PermissionException("User [" + user.getName()
                + "] does not have permission to obtain package content for installed package id ["
                + installedPackageId + "] for resource ID [" + resourceId + "]");
        }
        try {
            InstalledPackage installedPackage = entityManager.find(InstalledPackage.class, installedPackageId);
View Full Code Here

    public PackageVersion createPackageVersionWithDisplayVersion(Subject subject, String packageName,
        int packageTypeId, String version, String displayVersion, Integer architectureId, byte[] packageBytes) {

        // Check permissions first
        if (!authorizationManager.hasGlobalPermission(subject, Permission.MANAGE_CONTENT)) {
            throw new PermissionException("User [" + subject.getName()
                + "] does not have permission to create package versions");
        }

        return createPackageVersionWithDisplayVersion(subject, packageName, packageTypeId, version, displayVersion,
            (null == architectureId) ? getNoArchitecture().getId() : architectureId, new ByteArrayInputStream(
View Full Code Here

        Integer resourceId = criteria.getFilterResourceId();

        if (!authorizationManager.isInventoryManager(subject)) {
            if ((null == resourceId) || criteria.isInventoryManagerRequired()) {
                throw new PermissionException("Subject [" + subject.getName()
                    + "] requires InventoryManager permission for requested query criteria.");
            } else if (!authorizationManager.canViewResource(subject, resourceId)) {
                throw new PermissionException("Subject [" + subject.getName()
                    + "] does not have permission to view the specified resource.");
            }
        }

        CriteriaQueryGenerator generator = new CriteriaQueryGenerator(subject, criteria);
View Full Code Here

    @Override
    public PageList<Package> findPackagesByCriteria(Subject subject, PackageCriteria criteria) {

        if (criteria.getFilterRepoId() != null) {
            if (!authorizationManager.canViewRepo(subject, criteria.getFilterRepoId())) {
                throw new PermissionException("Subject [" + subject.getName() + "] cannot view the repo with id "
                    + criteria.getFilterRepoId());
            }
        } else if (!authorizationManager.hasGlobalPermission(subject, Permission.MANAGE_REPOSITORIES)) {
            throw new PermissionException("Only repository managers can search for packages across all repos.");
        }

        CriteriaQueryGenerator generator = new CriteriaQueryGenerator(subject, criteria);

        CriteriaQueryRunner<Package> runner = new CriteriaQueryRunner<Package>(criteria, generator, entityManager);
View Full Code Here

    @Override
    public PackageVersion createPackageVersionWithDisplayVersion(Subject subject, String packageName,
        int packageTypeId, String version, String displayVersion, Integer architectureId, String temporaryContentHandle) {
        // Check permissions first
        if (!authorizationManager.hasGlobalPermission(subject, Permission.MANAGE_CONTENT)) {
            throw new PermissionException("User [" + subject.getName()
                + "] does not have permission to create package versions");
        }
        FileInputStream fileInputStream = null;
        try {
            fileInputStream = new FileInputStream(getTemporaryContentFile(temporaryContentHandle));
View Full Code Here

TOP

Related Classes of org.rhq.enterprise.server.authz.PermissionException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.