{
for ( String roleName : roleNames )
{
- Role role = this.rbacImpl.getRole( roleName );
- role = ( role == null ) ? new RoleImpl( roleName ) : role;
- if ( role != null )
- {
- rolesCache.put( role.getName(), role );
- roles.add( role );
- }
+ Role role = buildRole( roleName );
+ roles.add( role );
}
}
else if ( this.ldapRoleMapper.isUseDefaultRoleName() )
{
- Role role = null;
- try
- {
- role = this.rbacImpl.getRole( group );
- }
- catch ( RbacObjectNotFoundException e )
- {
- // if it's mapped role to a group it doesn't exist in jdo
- }
- role = ( role == null ) ? new RoleImpl( group ) : role;
- if ( role != null )
- {
- rolesCache.put( role.getName(), role );
- roles.add( role );
- }
+ Role role = buildRole( group );
+ roles.add( role );
+
}
}
}
+ private Role buildRole( String group )
+ throws RbacManagerException
+ {
+ Role role = null;
+ try
+ {
+ role = this.rbacImpl.getRole( group );
+ }
+ catch ( RbacObjectNotFoundException e )
+ {
+ // if it's mapped role to a group it doesn't exist in jdo
+ }
+ role = ( role == null ) ? new RoleImpl( group ) : role;
+ if ( role != null )
+ {
+ rolesCache.put( role.getName(), role );
+
+ }
+ return role;
+ }
+
protected List<String> getRealRoles()
throws RbacManagerException
{