From: <pn...@hy...> - 2010-03-30 20:20:24
|
Author: pnguyen Date: 2010-03-30 13:20:15 -0700 (Tue, 30 Mar 2010) New Revision: 14442 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=14442 Modified: trunk/src/org/hyperic/hq/authz/server/session/RoleManagerEJBImpl.java trunk/src/org/hyperic/hq/hqu/rendit/metaclass/RoleCategory.groovy Log: [HQ-1309] Get groups by role. Added primarily for HQApi integration testing. Modified: trunk/src/org/hyperic/hq/authz/server/session/RoleManagerEJBImpl.java =================================================================== --- trunk/src/org/hyperic/hq/authz/server/session/RoleManagerEJBImpl.java 2010-03-30 18:45:27 UTC (rev 14441) +++ trunk/src/org/hyperic/hq/authz/server/session/RoleManagerEJBImpl.java 2010-03-30 20:20:15 UTC (rev 14442) @@ -6,7 +6,7 @@ * normal use of the program, and does *not* fall under the heading of * "derived work". * - * Copyright (C) [2004-2008], Hyperic, Inc. + * Copyright (C) [2004-2010], Hyperic, Inc. * This file is part of HQ. * * HQ is free software; you can redistribute it and/or modify @@ -1090,6 +1090,25 @@ } /** + * Get the resource groups applicable to a given role. + * + * @ejb:interface-method + */ + public Collection getResourceGroupsByRole(AuthzSubject subject, + Role role) + throws PermissionException, FinderException { + + ResourceGroupDAO dao = getResourceGroupDAO(); + + Collection groups = + dao.findByRoleIdAndSystem_orderName(role.getId(), false, true); + + // now get viewable group pks + return filterViewableGroups(subject, groups); + + } + + /** * Get the resource groups applicable to a given role * @ejb:interface-method */ Modified: trunk/src/org/hyperic/hq/hqu/rendit/metaclass/RoleCategory.groovy =================================================================== --- trunk/src/org/hyperic/hq/hqu/rendit/metaclass/RoleCategory.groovy 2010-03-30 18:45:27 UTC (rev 14441) +++ trunk/src/org/hyperic/hq/hqu/rendit/metaclass/RoleCategory.groovy 2010-03-30 20:20:15 UTC (rev 14442) @@ -52,4 +52,11 @@ static void remove(Role role, AuthzSubject user) { roleMan.removeRole(user, role.id) } + + /** + * Get the Resource Groups for a Role + */ + static Collection getGroups(Role role, AuthzSubject user) { + roleMan.getResourceGroupsByRole(user, role) + } } |