Package org.rhq.enterprise.server.authz

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


    @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
    @Override
    public PageList<? extends AbstractAlertConditionCategoryComposite> getAlertConditionComposites(Subject user,
        Integer agentId, AlertConditionCategory category, PageControl pageControl) {
        if (authorizationManager.isOverlord(user) == false) {
            throw new PermissionException("User [" + user.getName() + "] does not have permission to call "
                + "getAlertConditionComposites; only the overlord has that right");
        }

        String queryName = null;
        String countQueryName = AlertCondition.QUERY_BY_CATEGORY_COUNT_PARAMETERIZED; // default
View Full Code Here


    private AuthorizationManagerLocal authorizationManager;

    public PageList<Dashboard> findDashboardsByCriteria(Subject subject, DashboardCriteria criteria) {
        if (criteria.isInventoryManagerRequired()) {
            if (!authorizationManager.isInventoryManager(subject)) {
                throw new PermissionException("Subject [" + subject.getName()
                    + "] requires InventoryManager permission for requested query criteria.");
            }

            Integer ownerId = criteria.getFilterOwnerId();
            if (null != ownerId && 0 == ownerId.intValue()) {
View Full Code Here

            entityManager.persist(dashboard);
            return dashboard;
        } else {
            if (!authorizationManager.hasGlobalPermission(subject, Permission.MANAGE_SETTINGS)
                && d.getOwner().getId() != subject.getId()) {
                throw new PermissionException("You may only alter dashboards you own.");
            }
            return entityManager.merge(dashboard);
        }
    }
View Full Code Here

        Dashboard toDelete = entityManager.find(Dashboard.class, dashboardId);

        if (!authorizationManager.hasGlobalPermission(subject, Permission.MANAGE_SETTINGS)
            && toDelete.getOwner().getId() != subject.getId()) {
            throw new PermissionException("You may only delete dashboards you own.");
        }

        entityManager.remove(toDelete);
    }
View Full Code Here

    @Override
    public Availability getCurrentAvailabilityForResource(Subject subject, int resourceId) {
        Availability retAvailability;
        if (authorizationManager.canViewResource(subject, resourceId) == false) {
            throw new PermissionException("User [" + subject
                + "] does not have permission to view current availability for resource[id=" + resourceId + "]");
        }

        try {
            Query q = entityManager.createNamedQuery(Availability.FIND_CURRENT_BY_RESOURCE);
View Full Code Here

    @Override
    public List<Availability> getAvailabilitiesForResource(Subject subject, int resourceId, long startTime, long endTime) {

        if (!authorizationManager.canViewResource(subject, resourceId)) {
            throw new PermissionException("User [" + subject.getName() + "] does not have permission to view ["
                + resourceId + "]");
        }

        List<Availability> result;
        Date startDate = new Date(startTime);
View Full Code Here

    @Override
    public List<ResourceGroupAvailability> getAvailabilitiesForResourceGroup(Subject subject, int groupId,
        long startTime, long endTime) {

        if (!authorizationManager.canViewGroup(subject, groupId)) {
            throw new PermissionException("User [" + subject.getName() + "] does not have permission to view ["
                + groupId + "]");
        }

        List<ResourceGroupAvailability> result = new ArrayList<ResourceGroupAvailability>();
        Date startDate = new Date(startTime);
View Full Code Here

    private List<AvailabilityPoint> getAvailabilitiesForContext(Subject subject, EntityContext context,
        long fullRangeBeginTime, long fullRangeEndTime, int numberOfPoints, boolean withCurrentAvailability) {

        if (context.type == EntityContext.Type.Resource) {
            if (!authorizationManager.canViewResource(subject, context.resourceId)) {
                throw new PermissionException("User [" + subject.getName() + "] does not have permission to view "
                    + context.toShortString());
            }
        } else if (context.type == EntityContext.Type.ResourceGroup) {
            if (!authorizationManager.canViewGroup(subject, context.groupId)) {
                throw new PermissionException("User [" + subject.getName() + "] does not have permission to view "
                    + context.toShortString());
            }
        } else {

        }
View Full Code Here

     */
    @Override
    @Deprecated
    public PageList<Availability> findAvailabilityForResource(Subject subject, int resourceId, PageControl pageControl) {
        if (authorizationManager.canViewResource(subject, resourceId) == false) {
            throw new PermissionException("User [" + subject
                + "] does not have permission to view Availability history for resource[id=" + resourceId + "]");
        }

        pageControl.initDefaultOrderingField("av.startTime", PageOrdering.DESC);

View Full Code Here

        return pluginMgr.getDriftServerPluginComponent();
    }
   
    private void authorizeOrFail(Subject subject, int resourceId, String message) {
        if (!authorizationManager.hasResourcePermission(subject, Permission.MANAGE_DRIFT, resourceId)) {
            throw new PermissionException(message + " - " + subject + " lacks "
                + Permission.MANAGE_DRIFT + " for resource[id=" + resourceId + "]");
        }
    }
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.