[Building Sakai] Course Site creation

Nguni Phakela nguni52 at gmail.com
Mon Feb 3 15:03:06 PST 2014


HI Jaco,

I think you can use a security advisor for *site.add*

securityAdvisor = new SecurityAdvisor() {
                @Override
                public SecurityAdvice isAllowed(String userId, String
function, String reference) {
                    if (SiteService.SECURE_ADD_SITE.equals(function)) {
                        return SecurityAdvice.ALLOWED;
                    } else {
                        return SecurityAdvice.NOT_ALLOWED;
                    }
                }
            };

            securityService.pushAdvisor(securityAdvisor);


I think then you shouldn't be receiving any PermissionExceptions when
trying to create a site.


Let me know if that is helpful.



Cheers,

Nguni


--
Nguni Phakela


On Sun, Feb 2, 2014 at 8:56 PM, Jaco Gillman <jaco at opencollab.co.za> wrote:

> Hi All
>
> I try to create Course Site programatically but keep on getting *PermissionException
> user=null lock=site.add.* I manage to create new users etc, but can't
> create Course Sites.
>
> Found an example online that shows how to create a user session for admin
> (ie batch job usage where admin permissions is needed), I am not creating
> these sites in a Batch Job, it is being doing via a tool, and after I log
> in as admin... am I missing something here?
>
> Regards,
>
> *Jaco Gillman*
>
> Java Developer
>
> opencollab
>
> *Tel*: +27 21 970 4017  |  *Fax*: +27 21 914 3098
>
> *Email*: jaco at opencollab.co.za  |  *Skype*: gillmanjc
>
> *Web*: www.opencollab.co.za
>
>
> ------------------------------
> See OpenCollab email disclaimer at http://www.opencollab.co.
> za/email-disclaimer
> _______________________________________________
> 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/20140204/41d7ef80/attachment.html 


More information about the sakai-dev mailing list