5252 */
5353public class BBMRIResources extends DefaultRegistrarModule {
5454
55- private final static Logger log = LoggerFactory .getLogger (BBMRIResources .class );
55+ private static final Logger log = LoggerFactory .getLogger (BBMRIResources .class );
5656
5757 // field names
5858 private static final String RESOURCE_IDS = "resourceIds" ;
@@ -70,7 +70,6 @@ public class BBMRIResources extends DefaultRegistrarModule {
7070 * @param session who approves the application
7171 * @param app application
7272 * @return unchanged application
73- * @throws PerunException in case of internal error in Perun
7473 */
7574 @ Override
7675 public Application approveApplication (PerunSession session , Application app )
@@ -157,8 +156,8 @@ public void canBeApproved(PerunSession session, Application app) throws PerunExc
157156 * @return Map of String to Group, where key is the ID of the resource and Group is the representation
158157 */
159158 private Map <String , Group > getPerunResourceIdToGroupMap (PerunSession session , Application app , PerunBl perun )
160- throws PrivilegeException , RegistrarException , VoNotExistsException , WrongAttributeAssignmentException ,
161- AttributeNotExistsException , GroupNotExistsException
159+ throws PrivilegeException , RegistrarException , WrongAttributeAssignmentException ,
160+ AttributeNotExistsException
162161 {
163162 // get root group for resources hierarchy
164163 Group resourceOriginGroup = getResourceOriginGroup (session , app , perun );
@@ -189,13 +188,13 @@ private String getResourceIdAttributeName(PerunSession session, Application app,
189188 * @return resource IDs set
190189 */
191190 private Group getResourceOriginGroup (PerunSession session , Application app , PerunBl perun )
192- throws PrivilegeException , RegistrarException , VoNotExistsException
191+ throws PrivilegeException , RegistrarException
193192 {
194193 try {
195- if ( perun .getAttributesManagerBl ()
194+ Boolean resourceOriginEnabled = perun .getAttributesManagerBl ()
196195 .getAttribute (session , app .getGroup (), RESOURCE_ORIGIN_ENABLED_ATTR_NAME )
197- .valueAsBoolean ()
198- ) {
196+ .valueAsBoolean ();
197+ if ( resourceOriginEnabled != null && resourceOriginEnabled ) {
199198 try {
200199 String resourceOriginGroupName = getResourceOriginGroupNameFromApplication (session , app );
201200 return perun .getGroupsManagerBl ().getGroupByName (session , app .getVo (), resourceOriginGroupName );
@@ -290,7 +289,7 @@ private Map<String, Group> getResourceIDsToGroupsMap(PerunSession session,
290289 {
291290 Map <String , Group > resourceIDsToGroupMap = new HashMap <>();
292291
293- List <Group > resourceGroups = perun .getGroupsManagerBl ().getSubGroups (session , resourceOriginGroup );
292+ List <Group > resourceGroups = perun .getGroupsManagerBl ().getAllSubGroups (session , resourceOriginGroup );
294293 if (resourceGroups == null || resourceGroups .isEmpty ()) {
295294 log .debug ("No resource groups found, returning empty map." );
296295 return resourceIDsToGroupMap ;
0 commit comments