Details
-
Type:
Bug
-
Status: RESOLVED
-
Priority:
Minor
-
Resolution: Won't Fix
-
Affects Version/s: 2.4.0, 2.4.1
-
Fix Version/s: None
-
Component/s: Authz service (Pre-K1/2.6)
-
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.