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

Steve Swinsburg s.swinsburg at lancaster.ac.uk
Thu Jul 16 06:35:29 PDT 2009


Hi Phuc,

Setting the last param (provided) to false should still work even for  
provided users. The Javadoc isn't very indepth on what this param does  
but in the web services it defaults to false and you can't override it  
and this works for both internal and external (LDAP) users.

cheers,
Steve





On 16 Jul 2009, at 14:33, Phuc Bui wrote:

> Hi all,
> We can see the difference between eid and uid here:
> This is a user from external database, he has eid and uid like this
> --------
> User has EID :nlu05130030 and UserID :  
> 400d093e-6ba4-44e0-8738-1468c968d627
> --------
> And following user is internal user
> --------
> hunglephi has EID : hunglephi has UserID :
> 439d9eed-dd08-4a25-b04c-ddd50509344d
> --------
> Look the same !!!
>
> And code to add member to site are:
> addedSite.addMember(EID, role, true, false); -> that also works for  
> internal
> user
> addedSite.addMember(UID, role, true, false); -> that works for all
> addedSite.addMember(UID, role, true, true); -> that does NOT work for
> external user (no effect) -> although API says last parameter (means
> provided): If true, from an external provider ???
>
> In short,
> To get UID from EID use this method: String UID =
> UserDirectoryService.getUserByEid(eid).getId();
> Then add member to site by: site.addMember(UID, role, true, false);
>
> Thanks for all,
> Phuc Bui
>
> -----Original Message-----
> From: Steve Swinsburg [mailto:s.swinsburg at lancaster.ac.uk]
> Sent: Thursday, July 16, 2009 4:56 PM
> To: Thomas Amsler
> Cc: Phuc Bui; Sakai Mailing List
> Subject: Re: [Building Sakai] Use Sakai API to add members to site
>
> Ok so "the EID is the one you login with" is the better explanation
> then.
>
> 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"
>>>
>



More information about the sakai-dev mailing list