Search in sources :

Example 11 with AccessCheck

use of org.glassfish.api.admin.AccessRequired.AccessCheck in project Payara by payara.

the class ListComponentsCommand method getAccessChecks.

@Override
public Collection<? extends AccessCheck> getAccessChecks() {
    final List<AccessCheck> accessChecks = new ArrayList<AccessCheck>();
    /* Read access to the collection of applications. */
    accessChecks.add(new AccessCheck(DeploymentCommandUtils.APPLICATION_RESOURCE_NAME, "read"));
    /*
         * Because the command displays detailed information about the matching
         * apps, require read access to each app to be displayed.
         */
    for (Application app : domain.getApplicationsInTarget(target)) {
        if (!app.isLifecycleModule()) {
            if (type == null || isApplicationOfThisType(app, type)) {
                apps.add(app);
                accessChecks.add(new AccessCheck(AccessRequired.Util.resourceNameFromConfigBeanProxy(app), "read"));
            }
        }
    }
    return accessChecks;
}
Also used : AccessCheck(org.glassfish.api.admin.AccessRequired.AccessCheck)

Example 12 with AccessCheck

use of org.glassfish.api.admin.AccessRequired.AccessCheck in project Payara by payara.

the class MTUnprovisionCommand method getAccessChecks.

@Override
public Collection<? extends AccessCheck> getAccessChecks() {
    final List<AccessCheck> accessChecks = new ArrayList<AccessCheck>();
    app = applications.getApplication(appname);
    if (app != null) {
        accessChecks.add(new AccessCheck(AccessRequired.Util.resourceNameFromConfigBeanProxy(app), "read"));
        if (app.getAppTenants() != null) {
            appTenant = app.getAppTenants().getAppTenant(tenant);
            if (appTenant != null) {
                accessChecks.add(new AccessCheck(AccessRequired.Util.resourceNameFromConfigBeanProxy(appTenant), "unprovision"));
            }
        }
    }
    return accessChecks;
}
Also used : AccessCheck(org.glassfish.api.admin.AccessRequired.AccessCheck) ArrayList(java.util.ArrayList)

Example 13 with AccessCheck

use of org.glassfish.api.admin.AccessRequired.AccessCheck in project Payara by payara.

the class MonitoringReporter method getAccessChecksForList.

public Collection<? extends AccessCheck> getAccessChecksForList() {
    final Collection<AccessCheck> accessChecks = new ArrayList<AccessCheck>();
    for (org.glassfish.flashlight.datatree.TreeNode tn1 : nodeListToProcess) {
        /*
             * doList discards nodes that do not have children, but we
             * include them here in building the access checks
             * because the user needs read access to the node
             * in order to find out that it does or does not have children.
             */
        String name = tn1.getCompletePathName().replace('.', '/');
        accessChecks.add(new AccessCheck(sanitizeResourceName(name), "read"));
    }
    return accessChecks;
}
Also used : AccessCheck(org.glassfish.api.admin.AccessRequired.AccessCheck)

Example 14 with AccessCheck

use of org.glassfish.api.admin.AccessRequired.AccessCheck in project Payara by payara.

the class CreateApplicationRefCommand method getAccessChecks.

@Override
public Collection<? extends AccessCheck> getAccessChecks() {
    final List<AccessCheck> accessChecks = new ArrayList<AccessCheck>();
    accessChecks.add(new AccessCheck(DeploymentCommandUtils.getTargetResourceNameForNewAppRef(domain, target), "create"));
    return accessChecks;
}
Also used : AccessCheck(org.glassfish.api.admin.AccessRequired.AccessCheck) ArrayList(java.util.ArrayList)

Example 15 with AccessCheck

use of org.glassfish.api.admin.AccessRequired.AccessCheck in project Payara by payara.

the class EnableCommand method getAccessChecks.

@Override
public Collection<? extends AccessCheck> getAccessChecks() {
    accessChecks = new ArrayList<AccessCheck>();
    if (!DeploymentUtils.isDomainTarget(target)) {
        ApplicationRef applicationRef = domain.getApplicationRefInTarget(name(), target);
        if (applicationRef != null && !Boolean.getBoolean(applicationRef.getEnabled())) {
            accessChecks.add(new AccessCheck(applicationRef, ENABLE_ACTION, true));
        }
    } else {
        /*
             * The target is "domain" so expand that to all places where the
             * app is assigned.
             */
        for (String t : domain.getAllReferencedTargetsForApplication(target)) {
            final ApplicationRef applicationRef = domain.getApplicationRefInTarget(name(), t);
            if (applicationRef != null && !Boolean.getBoolean(applicationRef.getEnabled())) {
                accessChecks.add(new AccessCheck(applicationRef, ENABLE_ACTION, true));
            }
        }
    }
    /*
         * Add an access check for enabling the app itself.
         */
    final String resourceForApp = DeploymentCommandUtils.getResourceNameForExistingApp(domain, name());
    if (resourceForApp != null) {
        accessChecks.add(new AccessCheck(resourceForApp, ENABLE_ACTION));
    }
    return accessChecks;
}
Also used : AccessCheck(org.glassfish.api.admin.AccessRequired.AccessCheck)

Aggregations

AccessCheck (org.glassfish.api.admin.AccessRequired.AccessCheck)24 ArrayList (java.util.ArrayList)15 ApplicationRef (com.sun.enterprise.config.serverbeans.ApplicationRef)2 AppTenant (com.sun.enterprise.config.serverbeans.AppTenant)1 Cluster (com.sun.enterprise.config.serverbeans.Cluster)1 Server (com.sun.enterprise.config.serverbeans.Server)1 VirtualServer (com.sun.enterprise.config.serverbeans.VirtualServer)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1