return (defs != null) && (defs.size() > 0);
}
@Override
public boolean isGroupOperationSupported(Subject subject, int resourceGroupId) {
ResourceGroup group;
try {
group = resourceGroupManager.getResourceGroupById(subject, resourceGroupId, null);
if (group.getGroupCategory() == GroupCategory.MIXED) {
return false;
}
} catch (ResourceGroupNotFoundException e) {
if (LOG.isDebugEnabled()) {
LOG.debug("isGroupOperationSupported: group does not exist: " + resourceGroupId);
}
return false;
} catch (PermissionException pe) {
// notice we caught this exception before propogating it up to the EJB layer, so
// our transaction is not rolled back
if (LOG.isDebugEnabled()) {
LOG.debug("isGroupOperationSupported: User cannot view (and thus) control group: " + resourceGroupId);
}
return false;
}
if (!authorizationManager.hasGroupPermission(subject, Permission.CONTROL, group.getId())) {
if (LOG.isDebugEnabled()) {
LOG.debug("isGroupOperationSupported: User cannot control group: " + group);
}
return false;
}
Set<OperationDefinition> defs = group.getResourceType().getOperationDefinitions();
return (defs != null) && (defs.size() > 0);
}