[Building Sakai] Effecting permissions when using role switcher

David Wafula davidwaf at gmail.com
Thu Dec 1 05:13:48 PST 2011


A million thanks. That works!!!. I wish javadocs could have hinted that in
the beginning.

regards

On Thu, Dec 1, 2011 at 3:06 PM, Stephen Marquard <stephen.marquard at uct.ac.za
> wrote:

> This is how the portal does it:
>
> String roleswitchvalue =
> SecurityService.getUserEffectiveRole(SiteService.siteReference(siteId));
> // checks the session for a role swap value
>
> but it will be null (most of the time) unless the user has explicitly
> switched roles in the site using the "view as" functionality.
>
> Regards
> Stephen
>
>
> --
> Stephen Marquard, Acting Director
> Centre for Educational Technology, University of Cape Town
> http://www.cet.uct.ac.za
> Email / IM (Jabber/XMPP): stephen.marquard at uct.ac.za
> Phone: +27-21-650-5037 Cell: +27-83-500-5290
>
>
> >>> David Wafula <davidwaf at gmail.com> 12/1/2011 12:15 PM >>>
> On Thu, Dec 1, 2011 at 10:59 AM, Stephen Marquard <
> stephen.marquard at uct.ac.za> wrote:
>
> >
> > Also you would need to pass a real site id - it would be meaningless
> to
> > set the "view as" role in a template authzgroup like
> > !group.template.course.
> >
> >
>
> I have tried this, still no luck:
>
> String currentSiteId = toolManager.getCurrentPlacement().getContext();
> String
> effectiveRole=securityService.getUserEffectiveRole(currentSiteId);
>
> effectiveRole is still null.
>
> I even tried:
>
>  String currentSiteId =
> toolManager.getCurrentPlacement().getContext();
>  Site site = siteService.getSite(currentSiteId);
>  String idToUse=site.getId();
>
> String effectiveRole=securityService.getUserEffectiveRole(idToUse);
>
> Still null.
>
> And this:
>
> AuthzGroup ag = authzGroupService.getAuthzGroup(currentSiteId);
> String effectiveRole=securityService.getUserEffectiveRole(ag,getId());
>
> Null.
>
> Am sure am missing something somewhere.
>
> --
> David Wafula
>
>
>
>
>
> ###
>
> UNIVERSITY OF CAPE TOWN
>
> This e-mail is subject to the UCT ICT policies and e-mail disclaimer
> published on our website at
> http://www.uct.ac.za/about/policies/emaildisclaimer/ or obtainable from
> +27 21 650 9111. This e-mail is intended only for the person(s) to whom
> it is addressed. If the e-mail has reached you in error, please notify
> the author. If you are not the intended recipient of the e-mail you may
> not use, disclose, copy, redirect or print the content. If this e-mail
> is not related to the business of UCT it is sent by the sender in the
> sender's individual capacity.
>
> ###
>
>


-- 
David Wafula
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20111201/7abeb622/attachment.html 


More information about the sakai-dev mailing list