[Building Sakai] Use Sakai API to add members to site

Jon Gorrono jpgorrono at ucdavis.edu
Thu Jul 16 14:00:49 PDT 2009


Yes, It works well for us but I'm sure there's a more ideal solution....

I've attached a patch that is the commit I made way back in 2-4-x days :)

The patch is against our UserDirectoryProvider implementation (which
also implements DisplayAdvisorUDP), in the impl of getDisplayId(User)
and so will be useless as a patch to anyone but us... but it shows the
code specific to the feature.

We add a function to the tool reg file for each tool we want to show a
different displayid than the default, which for us is the part of the
email address before the '@' or mailid.  For gradebook, we want to
display a 'student id' which looks like a SSN but isn't. So we
indicate that in the reg file:

                <configuration name="displayid.value" value="student" />
                <!-- <configuration name="displayid.value"
value="kerberos" /> -->
                <!-- configuration name="displayid.value" value="mothra" /> -->
                <!-- configuration name="displayid.value" value="mail" /> -->

.... since there can't be a 'current' tool in all circumstances, the
code assumes the default ('mail').

On Thu, Jul 16, 2009 at 11:57 AM, Thomas Amsler<tpamsler at ucdavis.edu> wrote:
> Jon, you did some work w.r.t. the context
> Best,
> -- Thomas
>
>
>
> Jon,
>
> You did some experimenting with context aware displayId, right?
>
>
>
> ---------- Forwarded message ----------
> From: Zhen Qian <zqian at umich.edu>
> Date: Thu, Jul 16, 2009 at 11:30 AM
> Subject: Re: [Building Sakai] Use Sakai API to add members to site
> To: Thomas Amsler <tpamsler at ucdavis.edu>
> Cc: Steve Swinsburg <s.swinsburg at lancaster.ac.uk>, Phuc Bui
> <phucbui2006 at yahoo.com.vn>, Sakai Mailing List
> <sakai-dev at collab.sakaiproject.org>
>
>
> Thomas:
>
> I am very interested in the federated ID lookup service as mentioned
> below. Is it in svn somewhere? Like UCDavis, UMich also have a
> Kerberos login id, a 8-digit student/faculty/staff id, email address,
> etc. In Site Info, instructor wants to see the 8-digit id along with
> user name and user login id.
>
> SAK-10868 is about retrieving display name depend on context. Can we
> do something similar to display id depends on context?
>
> Thanks,
>
> - Zhen
> On Jul 16, 2009, at 2:10 PM, Thomas Amsler wrote:
>
>> On Thu, Jul 16, 2009 at 2:56 AM, Steve
>> Swinsburg<s.swinsburg at lancaster.ac.uk> wrote:
>>>
>>> Ok so "the EID is the one you login with" is the better explanation then.
>>
>> Not really. It all depends on what kind of ID management your
>> institutions has. For example here at UCD, we have a loginID, Kerberos
>> ID, but once the user has logged in, we replace that stored ID with
>> our "Enterprise ID". To support all of that, we have written a
>> federated ID lookup service that tries to resolve any kind of ID that
>> the user enters or the system is using.
>>
>> So, the point is that some institutions have one ID for pretty much
>> everything and there are other ones that have to deal with several
>> different IDs (login, EID, email, studentId, etc.) This really all
>> depends on what kind of ID management is used. This issue is actually
>> more profound because sakai2 is lacking any kind of context related ID
>> management. For example, in Gradebook our Instructors would like to
>> see the studentID as the displayID, and in other cases, they want to
>> see their email address as the displayID, etc.
>>
>>>
>>> Enterprise ID is a foreign concept for pretty much everyone outside the
>>> US
>>> so that term itself can be confusing. At least in universities where I
>>> have
>>> performed integrations the student/staff number is the only thing that
>>> can
>>> consistently identify someone, and that is never used publicly. That
>>> would
>>> be considered the Enterprise ID in those cases.
>>>
>>> cheers,
>>> Steve
>>>
>>> On 15 Jul 2009, at 21:14, Thomas Amsler wrote:
>>>
>>>> W.R.T. "The eid is the human readable one": This is not always the
>>>> case and may be a bit misleading in as much as that folks may
>>>> associate the EID with the DisplayID. The EID should be the
>>>> institution's enterprise ID, which may or may not be human readable.
>>>> Since folks tend to assume that the EID is human readable, they tend
>>>> to use it as the displayId. This "misconception" in sakai2 has hurt us
>>>> quite a bit and required us to locally modify/fix sakai2.
>>>>
>>>> Best,
>>>> -- Thomas
>>>>
>>>>
>>>>
>>>>
>>>> On Wed, Jul 15, 2009 at 6:53 AM, Steve
>>>> Swinsburg<s.swinsburg at lancaster.ac.uk> wrote:
>>>>>
>>>>> Hi Phuc,
>>>>> You need to use the userId, not the eid. The eid is the human readable
>>>>> one,
>>>>> ie jsmith26, the userId is the internal one. To get it, just do this:
>>>>> String userid = UserDirectoryService.getUserByEid(eid).getId();
>>>>>
>>>>> cheers,
>>>>> Steve
>>>>> ---
>>>>> Steve Swinsburg
>>>>> Portal Systems Developer
>>>>> Centre for e-Science
>>>>> Lancaster University
>>>>> Lancaster
>>>>> LA1 4YT
>>>>> email: s.swinsburg at lancaster.ac.uk
>>>>> phone: +44 (0) 1524 594870
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On 15 Jul 2009, at 14:47, Phuc Bui wrote:
>>>>>
>>>>> Dear all,
>>>>> I use this API org.sakaiproject.site.api.Site to add members to site
>>>>> -------------------------------------------
>>>>> addMember
>>>>> void addMember(String userId,
>>>>>              String roleId,
>>>>>              boolean active,
>>>>>              boolean provided)
>>>>> Add a member to the AuthzGroup.
>>>>> Parameters:
>>>>> userId - The user.
>>>>> role - The role name.
>>>>> active - The active flag.
>>>>> provided - If true, from an external provider.
>>>>> -----------------------------------------
>>>>>
>>>>> But when I used it, I got following warning, though I called
>>>>> site.addMember(uid, roleId, true, true)
>>>>> ------------------------------------
>>>>> WARN: refreshAuthzGroup: cannot find eid for user: nluthuyntt
>>>>> (2009-07-15
>>>>> 20:25:
>>>>> 46,064
>>>>> http-8080-Processor23_org.sakaiproject.authz.impl.DbAuthzGroupService)
>>>>> WARN: refreshAuthzGroup: cannot find eid for user: nlu05130095
>>>>> (2009-07-15
>>>>> 20:25
>>>>> :46,065
>>>>> http-8080-Processor23_org.sakaiproject.authz.impl.DbAuthzGroupService)
>>>>> WARN: refreshAuthzGroup: cannot find eid for user: nlu05130030
>>>>> (2009-07-15
>>>>> 20:25
>>>>> :46,066
>>>>> http-8080-Processor23_org.sakaiproject.authz.impl.DbAuthzGroupService)
>>>>> WARN: refreshAuthzGroup: cannot find eid for user: nlu05130148
>>>>> (2009-07-15
>>>>> 20:25
>>>>> :46,068
>>>>> http-8080-Processor23_org.sakaiproject.authz.impl.DbAuthzGroupService)
>>>>> WARN: refreshAuthzGroup: cannot find eid for user: nlu05130072
>>>>> (2009-07-15
>>>>> 20:25
>>>>> :46,069
>>>>> http-8080-Processor23_org.sakaiproject.authz.impl.DbAuthzGroupService)
>>>>> -----------------------------------
>>>>> I have implemented UserDirectoryProvider to read user’s data from
>>>>> external
>>>>> database and I can log in by those id (such as nluthuyntt, nlu05130095
>>>>> …)
>>>>>
>>>>> What should I do more ?
>>>>>
>>>>> Thanks,
>>>>> Phuc Bui
>>>>> _______________________________________________
>>>>> sakai-dev mailing list
>>>>> sakai-dev at collab.sakaiproject.org
>>>>> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>>>>>
>>>>> TO UNSUBSCRIBE: send email
>>>>> to sakai-dev-unsubscribe at collab.sakaiproject.org with a subject of
>>>>> "unsubscribe"
>>>>>
>>>>> _______________________________________________
>>>>> sakai-dev mailing list
>>>>> sakai-dev at collab.sakaiproject.org
>>>>> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>>>>>
>>>>> TO UNSUBSCRIBE: send email to
>>>>> sakai-dev-unsubscribe at collab.sakaiproject.org
>>>>> with a subject of "unsubscribe"
>>>>>
>>>
>>>
>> _______________________________________________
>> sakai-dev mailing list
>> sakai-dev at collab.sakaiproject.org
>> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>>
>> TO UNSUBSCRIBE: send email to
>> sakai-dev-unsubscribe at collab.sakaiproject.org with a subject of
>> "unsubscribe"
>>
>>
> ________________________________
> This automatic notification message was sent by SmartSite at UCDavis
> (https://smartsite.ucdavis.edu:8443/portal) from the UCD Sakai Dev site.
> You can modify how you receive notifications at My Workspace > Preferences.
>



-- 
Jon Gorrono
PGP Key: 5434509D
email{>+++++++++[>+++++++++++>++++++++++++>+++++++>+++++<<<<-]>+++++++.>++++.<---.>-.+++..---.-.+.>+.<++++++.<----.+.---.>+.<++++++++.>---.>>+.<<<----.-.>++.}
http{ats.ucdavis.edu}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SAK-1800.patch.ucd
Type: application/octet-stream
Size: 6451 bytes
Desc: not available
Url : http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20090716/30b27307/attachment.obj 


More information about the sakai-dev mailing list