[Building Sakai] How to enable a user MyWorkspace from code?

Manuel Pérez manuelpg07 at gmail.com
Mon Jan 18 14:46:21 PST 2010


Thank you so much, it works perfect

Greetings

El 18 de enero de 2010 11:35, Matthew Buckett <matthew.buckett at oucs.ox.ac.uk
> escribió:

> 2010/1/15 Manuel Pérez <manuelpg07 at gmail.com>:
> > Hi Steve, thanks for your reply,
> >
> > What I need is that once I created the user, as next step create
> MyWorkspace
> > for that user. The problem is that I don´t know that statement used to
> make
> > the initial login. I need a set of instructions that generate the user
> > MyWorkspace once it is created.
> >
> > UserEdit ue = UserDirectoryService.addUser("
> > teststudent1", "teststudent1");
> >             ue.setEmail("test at student1.es");
> >             ue.setFirstName("test1");
> >             ue.setLastName("student1");
> >             ue.setPassword("sakai");
> >             ue.setType("user");
> >             UserDirectoryService.commitEdit(ue);
>
> You just need to switch to be acting as the newly created user and the
> attempt to get the new users MyWorkspace. Somthing like this:
>
>  Session sakaiSession = SessionManager.getCurrentSession();
>  sakaiSession.setUserId(ue.getId());
>  sakaiSession.setUserEid(ue.getEid());
>  String userSiteId = SiteService.getUserSiteId(ue.getId());
>  // This should create the new user site and return it.
>  Site userSite = SiteService.getSite(userSiteId);
>
>
> --
>  Matthew Buckett
>  VLE Developer, LTG, Oxford University Computing Services
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20100118/8f7efcb5/attachment.html 


More information about the sakai-dev mailing list