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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations