Thanks guys!
I'm still playing with it to understand how everything works.
This is what I have so far:

I created a new method in RoleBasedAuthorizationStrategy:

public Map<String,String> getSIDsFullNames(String type) {
      SortedSet<String> sids = getRoleMap(RoleType.fromString(type)).getSids();
      Map<String, String> sidToUser = new HashMap<String, String>(sids.size());
      for(String sid: sids) {
          String fullName = User.getById(sid, true).getFullName();
          sidToUser.put(sid, fullName);
      }
      return sidToUser;
  }


then in assign-roles.jelly, changed 

<j:set var="globalSIDs" value="${it.strategy.getSIDs(it.strategy.GLOBAL)}"/>


into this

<j:set var="globalSIDs" 
value="${it.strategy.getSIDsFullNames(it.strategy.GLOBAL)}"/>


and in assign-global-roles.jelly I used sid.value instead of sid:

<j:forEach var="sid" items="${globalSIDs}">
  <tr name="[${sid.value}]" class="permission-row">
    <local:userRow sid="${sid.value}" title="${sid.value}" global="${true}"  
type="${it.strategy.GLOBAL}"/>
  </tr>
  <j:set var="nbAssignedGlobalRoles" value="${nbAssignedGlobalRoles+1}" />
</j:forEach>


there is a checkForWhitespace form validation on this form, so it didn't work 
for user that has a full name with a whitespace.

I did fullname.replaceAll(" ", "_") just to see that it works and it did. I got 
the user name.


what do you think, is it a good direction?

how should we deal with the whitespace validation?


Thanks,

Tidhar


On Wednesday, July 15, 2020 at 9:59:20 PM UTC+3, Jesse Glick wrote:
>
> On Wed, Jul 15, 2020 at 1:49 PM Oleg Nenashev <[email protected] 
> <javascript:>> wrote: 
> > Passing true would create a user account if it is missing. 
>
> Does not _save_ a user account, merely ensures that a `User` object is 
> created in memory if it were not already on disk, which it very well 
> might not be. The Javadoc is perhaps misleading. 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/fe8dcafb-33dc-4c56-aa61-0d68ec8c1a8eo%40googlegroups.com.

Reply via email to