[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: Doubt about a method...



On 07/04/2013 04:56 AM, Emmanuel LÃcharny wrote:
Hi !

I'm wonderig if there is not something wrong in the following method :

     private void loadUserAdminRoles( List<UserAdminRole> list,
LDAPModificationSet mods )
     {
         LDAPAttribute attr = null;
         LDAPAttribute attrNm = null;

         if ( list != null )
         {
             for ( UserAdminRole userRole : list )
             {
                 String szUserRole = userRole.getRawData();

                 if ( attr == null )
                 {
                     attr = new LDAPAttribute(
GlobalIds.USER_ADMINROLE_DATA, szUserRole );
                     attrNm = new LDAPAttribute(
GlobalIds.USER_ADMINROLE_ASSIGN, userRole.getName() );
                 }
                 else
                 {
                     attr.addValue( szUserRole );
                 }
             }

             if ( attr != null )
             {
                 mods.add( LDAPModification.REPLACE, attr );
                 mods.add( LDAPModification.REPLACE, attrNm );
             }
         }
     }

the attrNm is updated only once. Is it because the userRole.getName()
will always be the same when it comes to Admin ?

Good catch Emmanuel.  Will get it fixed.

Thanks

--
shawn.mckinney@jts.us is my new email address