[Building Sakai] programmatically add participant to a course site

David Horwitz david.horwitz at uct.ac.za
Wed Jun 8 08:35:57 PDT 2011


David,

You might want to also look at the CourseManagement API - this allows 
you to define course groups that can be added to sites (using the 
Provider Id field in Realms)

https://confluence.sakaiproject.org/display/CM/Course+Management+API
https://source.sakaiproject.org/release/edu-services/1.1.1/apidocs/index.html

D

On 06/08/2011 11:57 AM, David Wafula wrote:
> Thanks a mill. Just what i needed...
>
> On Wed, Jun 8, 2011 at 11:27 AM, Miguel Carro Pellicer 
> <farreri.sakai at gmail.com <mailto:farreri.sakai at gmail.com>> wrote:
>
>     The class are you looking for  org.sakaiproject.site.api.SiteService.
>
>     Example of code:
>
>     //Get the Site Object having the siteId string
>     Site site = siteService.getSite(siteId);
>     //Getting the userId having the externalId (Eid).
>     String userid = userDirectoryService.getUserByEid(userEid).getId();
>
>     //Adding member to the site with "maintain" profile
>     //The first argument true is active to set if the user is active or not
>     //The second argument false means provided
>     //This method "addMember" is not implemented in Site class, is extended from AuthzGroup
>
>     site.addMember(userid,"maintain",true,false);
>     siteService.save(site);
>
>     If you have any doubt with this example, just write an email :D
>
>     Hope this helps, Miguel.
>
>
>     El 08/06/2011 11:16, David Wafula escribió:
>>     Dear all,
>>
>>     Could you point me to programmatically  adding a user to a course
>>     site ( i assume Site info tool API ?) . I have been blindly
>>     trying to search for such a service class, something like
>>     UserDirectoryService, that i could use  in my code, hopefully via
>>     spring.
>>
>>     Regards,
>>     -- 
>>     David Wafula
>>
>>
>>     _______________________________________________
>>     sakai-dev mailing list
>>     sakai-dev at collab.sakaiproject.org  <mailto:sakai-dev at collab.sakaiproject.org>
>>     http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>>
>>     TO UNSUBSCRIBE: send email tosakai-dev-unsubscribe at collab.sakaiproject.org  <mailto:sakai-dev-unsubscribe at collab.sakaiproject.org>  with a subject of "unsubscribe"
>
>     -- 
>
>     cid:image001.jpg at 01C9F98A.71C74E60<http://www.samoo.es/>
>
>     <http://www.samoo.es/>
>
>     *Miguel Carro Pellicer*
>
>     *Technical Manager - Director técnico*
>
>     miguel.carro at samoo.es <mailto:miguel.carro at samoo.es>
>
>     +34 - 96 393 69 15 <tel:%2B34%20-%2096%20393%2069%2015>
>
>     www.samoo.es <http://www.samoo.es>
>
>     Este  correo  y  sus archivos asociados son privados y
>     confidenciales y va dirigido  exclusivamente  a su destinatario.
>     Si recibe este correo sin ser el  destinatario del mismo, le
>     rogamos proceda a su eliminación y lo ponga en  conocimiento del
>     emisor. La difusión por cualquier medio del contenido de  este 
>     correo podría ser sancionada conforme a lo previsto en las leyes
>     españolas, Ley Orgánica 15/1999 de Protección de Datos de Carácter
>     Personal.  No  se autoriza la utilización con fines comerciales o
>     para su incorporación a ficheros automatizados de las direcciones
>     del emisor o del destinatario.”
>
>     This mail and its attached files are confidential and are only and
>     exclusively intended to their addressee. In case you may receive
>     this mail not being its addressee, we beg you to let us know the
>     error by reply and to proceed to destroy it. The circulation by
>     any mean of this mail could be penalised in accordance with the
>     Spanish legislation. Is not allowed the use of both, the
>     transmitter and the addressee’s, address with a commercial aim, or
>     in order to be incorporated to automated data process or to any
>     kind of files.
>
>     P Antes de imprimir este correo electrónico piense bien si es
>     necesario hacerlo. El medioambiente es cosa de todos.
>
>
>     _______________________________________________
>     sakai-dev mailing list
>     sakai-dev at collab.sakaiproject.org
>     <mailto: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
>     <mailto:sakai-dev-unsubscribe at collab.sakaiproject.org> with a
>     subject of "unsubscribe"
>
>
>
>
> -- 
> David Wafula
>
>
> _______________________________________________
> 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"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20110608/5691b5df/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/jpeg
Size: 3022 bytes
Desc: not available
Url : http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20110608/5691b5df/attachment.jpe 


More information about the sakai-dev mailing list