From: <rm...@hy...> - 2010-02-12 22:28:56
|
Author: rmorgan Date: 2010-02-12 14:28:48 -0800 (Fri, 12 Feb 2010) New Revision: 14287 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=14287 Modified: trunk/src/org/hyperic/hq/hqu/rendit/metaclass/AppdefCategory.groovy Log: [HHQ-3736] If resource_id is null, throw PermissionException rather than fail with an NPE. This does not fix the root case of why an appdef resource would have a null resource_id, but it does fix HQU plugins that do permission checking. Modified: trunk/src/org/hyperic/hq/hqu/rendit/metaclass/AppdefCategory.groovy =================================================================== --- trunk/src/org/hyperic/hq/hqu/rendit/metaclass/AppdefCategory.groovy 2010-02-12 21:36:23 UTC (rev 14286) +++ trunk/src/org/hyperic/hq/hqu/rendit/metaclass/AppdefCategory.groovy 2010-02-12 22:28:48 UTC (rev 14287) @@ -6,6 +6,7 @@ import org.hyperic.hq.appdef.server.session.AppdefResourceType import org.hyperic.hq.authz.shared.PermissionManagerFactory as PermManFactory import org.hyperic.hq.authz.shared.PermissionManager +import org.hyperic.hq.authz.shared.PermissionException class AppdefCategory { static Resource getResource(AppdefResource r) { @@ -46,6 +47,12 @@ def operation = r.getAuthzOp(p.operation) def user = p.user def resource = r.resource + + // HHQ-3736 - null resource_id in EAM_PLATFORM,EAM_SERVER,EAM_SERVICE. + if (resource == null) { + throw new PermissionException() + } + def instanceId = resource.instanceId assert instanceId == r.id |