Web Services Exercise

This is where it goes.

Possible Example

Hi, Luke

That's exactly what I want to do! Thank you very much for understanding
my problem. Right now I got stuck with writing a webservice that passes
in only the username to get an individual username's sites.

Here is what I was thinking to do:

1) Use SakaiLogin to login with admin\admin account. It returns a
sessionid as a string.
2) Write a webservice that only passes in the username to get the sites
for that
user.
3) Pass in the SakaiLogin admin session.

In this way we can avoid using each individual user's username and pwd
to log in by calling SakaiLogin.jws. But I got stuck with the second
step. I couldn't find any method in SakaiScript.jws or SakaiSites.jws to
do this. Could you give me some help in doing that?

Thanks a lot.

Peggy

----Original Message----
From: Luke FERNANDEZ LFERNANDEZ@weber.edu
Sent: Friday, August 25, 2006 3:57 PM
To: Wang, Ying
Subject: Re: Sakai Sites

Can't you use SakaiLogin and an admin username and password? This
should provide a session that you can use for other WebService calls.
In other words, you may be able to get an individual username's sites by
calling SakaLogin with Sakai admin username/password which will return a
session. Then, with that session, do the site query Web Services call
passing in the username.

Luke

>>>>>> "Wang, Ying" <peggyw@bu.edu> 8/25/2006 1:43 pm >>>

Date

Thanks a lot for your quick reply.

In that case do I need to get a sessionid by calling the SakaiLogin.jws
(which requires passing in both userid and password) , then pass in the
sessionid and establish the session?

Peggy

Aug 25, 2006 2:47 PM EDT
From Josh Holtzman <jholtzman@berkeley.edu>
Subject Re: Sakai Sites
Body How about using
AuthzGroupService.getAuthzGroupsIsAllowed(userId,
"site.visit", null);

The only AuthzGroups with "site.visit" should be sites, so this should

return the authzGroups (formerly realms) for all of the user's visitable

sites.

Josh

Ernie Souhrada wrote:

>> If you can get a list of all of the sites and iterate through them,

you

>> could use a function like this, although it's clearly a suboptimal
>> solution.
>>
>> public boolean checkForMemberInSite(String sessionid, String siteid,

>> String userid) throws AxisFault
>> {
>> Session session = establishSession(sessionid);
>>
>> try {
>> Site site = SiteService.getSite(siteid); Member member =
>> site.getMember(userid); if (member == null)

Unknown macro: { return false; }

else

Unknown macro: { >> return true; }

} catch (Exception e)

}
>>
>>
>> —
>> Ernie Souhrada
>> Sr. Network Ninja
>> The rSmart Group
>> ICQ: 3596422
>> TEL: 602-490-0484
>> EML: ews@rsmart.com
>>
>>
>> ----Original Message----
>> From: Wang, Ying peggyw@bu.edu
>> Sent: Friday, August 25, 2006 11:24 AM
>> To: webservices@collab.sakaiproject.org
>> Subject: Sakai Sites
>>
>> Hi, All
>>
>>
>> Does anyone know how to write a webservice that only passes in a

user's

>> userid (without passing in the user's password) to get the sites for

>> that user? Is it possible?
>>
>> Your help will be greatly appreciated.
>>
>>
>>
>> Peggy Wang
>>
>>
>> [see attachment: "message0.html", size: 942 bytes]
>>
>>
>> Attachments:
>>
>> message0.html
>>

https://collab.sakaiproject.org//access/content/attachment/738ea6be-560f

>> -4c48-80f5-418d5f313a60/message0.html
>>
>> ----------------------
>> This automatic notification message was sent by Sakai Collab
>> (https://collab.sakaiproject.org//portal) from the Project: Web

Services

>> site.
>> You can modify how you receive notifications at My Workspace >
>> Preferences.
>>
>> ----------------------
>> This automatic notification message was sent by Sakai Collab

(https://collab.sakaiproject.org//portal) from the Project: Web Services
site.

>> You can modify how you receive notifications at My Workspace >

Preferences.

>>
>>


Josh Holtzman
Educational Technology Services, UC Berkeley jholtzman@berkeley.edu
510.643.7380

Peggy Wang
Information Technology Services
Boston University School of Management
595 Commonwealth Ave
Boston MA 02215
(617)358-1614

Example from Chuck

There isa web service that does this already and gives you a nice DOM tree:

http://collab.sakaiproject.org/sakai-axis/SakaiSite.jws