[daisy] Running Example under daisy 2.0
Marc Portier
mpo at outerthought.org
Mon Dec 11 05:02:33 CST 2006
Paul Focke wrote:
> On Friday 08 December 2006 19:39, Greg Sieranski wrote:
<snip what"script that didn't run for testuser" />
> Hi,
>
> Perhaps you can check is if the user is in the correct role.
> repository.isInRole("Administrator");
> or you can just always switch role to administrator to be sure.
> repository.switchRole(adminRole.getId());
>
> And another little tip. You might want to have a look at daisy-utils.js which
> contains a few convenience methods for getting a repository instance. Have a
> look here
> http://cocoondev.org/daisydocs-1_5/daisywiki/general/60/198.html
>
Greg,
as for completing your understanding of Daisy's role model:
http://cocoondev.org/daisydocs-1_5/repository/general/37.html
specially this part:
> A user has one or more roles. After logging in, it is both possible to
> have just one role active and let the user manually switch between
> his/her roles, or to have all roles of a user active at the same time
> (which is the behaviour traditionally associated with user groups). If a
> user has a default role, this role will be active after login. If no
> default role for the user is specified, all its roles will become active
> after login, with the exception of the Administrator role
it's not because testuser "HAS" the administration role, that he "IS"
actively taking that role in his current session.
Taking that up in the current session requires the kind of API calls
Paul showed.
Historical perspective: this 'switching between active roles' has been
foreseen to allow end users (specially administrators when e.g. testing
ACL's) to choose which rights they want to execute at a given time,
without needing to re-authenticate.
as explained above the traditional approach 'give me all my roles and
associated rights" is available as well.
HTH,
-marc=
--
Marc Portier http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
Read my weblog at http://blogs.cocoondev.org/mpo/
mpo at outerthought.org mpo at apache.org
More information about the daisy
mailing list