[Building Sakai] CourseManagementAdministration removeSectionMembership(..) ignores SecuityAdvisor ?

Nguni Phakela nguni52 at gmail.com
Thu Aug 30 07:15:24 PDT 2012


Hi Aall,

This is the scenario:

I am doing an ajax call and it takes a while to do the processing and the
browser times out.

So I started the call inside a thread and then keep polling the thread to
see if the thread has completed.

The code worked fine before introducing a thread. However, in the thread it
seems the session has been lost, as a result BasePreferencesService is
giving an error when trying to commit the PreferencesEdit (line 355)

ResourcePropertiesEdit rp = preferencesEdit.getProperties.
rp.addProperty("test", "test");
preferencesService.commit(preferencesEdit);   // this part is throwing the
error

It would seem that the session manager is null.

How can we establish a session using the securityAdvisor and creating a new
securityAdvisor and pushing it

Am I missing something or doing something wrong?

Kind Regards,
Nguni

On Wed, Aug 22, 2012 at 11:44 AM, David Wafula <davidwaf at gmail.com> wrote:

> Dear all,
> Using 2.8.0.
>
> The following code ignores the use of SecurityAdvisor when calling
> CourseManagementAdministration.removeSectionMembership():
>
> SecurityAdvisor localSecAdvisor=new SecurityAdvisor() {...}
> try{
>   securityService.pushAdvisor( localSecAdvisor);
>  courseManagementAdministration.removeSectionMembership(user.getEid(),
> sectionId)
> }finally{
>   securityService.popAdvisor( localSecAdvisor);
> }
>
>
> but works with this :
>
> Session localSakaiSession = null;
> User currentUser = null;
> try{
>
>             currentUser = userDirectoryService.getCurrentUser();
>            localSakaiSession = sessionManager.getCurrentSession();
>             localSakaiSession.setUserId("admin");
>             localSakaiSession.setUserEid("admin");
> ...
> ...
>
> }finally{
>            localSakaiSession.setUserEid(currentUser.getEid());
>             localSakaiSession.setUserId(currentUser.getId());
> }
>
>
> Is the try..finally safe when using
> localSakaiSession.setUserId("admin") etc ?
>
> Thanks.
> --
> 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"
>



-- 
Nguni Phakela
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20120830/2405fff7/attachment.html 


More information about the sakai-dev mailing list