/** * Set a link to the user of the current session * (the 'authenticated user') in the API object. * This link enables users a convenient way to see * which is the logged-in user, using the system. */ private void setAuthenticatedUser(Api api) { QueryReturnValue returnValue = runQuery(QueryType.GetUserBySessionId, new QueryParametersBase()); DbUser authenticatedUser = (DbUser)returnValue.getReturnValue(); User user = new User(); user.setId(authenticatedUser.getId().toString()); LinkHelper.addLinks(user); api.setAuthenticatedUser(user); api.setEffectiveUser(user); //currently the authenticated and effective users are the same one, //but if and when impersonation is introduced, they may be different. }