Uploaded image for project: 'Sakai'
  1. Sakai
  2. SAK-11374

Authz Member getUserEid causes multiple UserDirectoryService calls

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: RESOLVED
    • Priority: Minor
    • Resolution: Won't Fix
    • Affects Version/s: 2.4.0, 2.4.1
    • Fix Version/s: None
    • Labels:
      None

      Description

      (This is a minor issue that surprised me enough to deserve documentation, if not necessarily an immediate fix.)

      The org.sakaiproject.authz.api.Member domain object interface includes methods called getUserId() and getUserEid(). This hints that local copies of both fields are at hand in the domain object. Instead, BaseMember's getUserEid() implementation actually calls the UserDirectoryService's getUserEid(userId) method every time. As a result, a real-life line like:

      User user = UserDirectoryService.getUserByEid(member.getUserEid());

      calls the UserDirectoryService twice. With the current implementation, the more efficient way of coding this would be:

      User user = UserDirectoryService.getUser(g.getUserId());

      Either the EID should be lazily loaded in the domain object as a transient field or the getUserEid() method should be removed.

        Gliffy Diagrams

          Zeplin

            Attachments

              Activity

                People

                Assignee:
                Unassigned Unassigned
                Reporter:
                raydavis Ray Davis (Inactive)
                Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:

                    Git Integration