hasRole vs. has_role
Hello, I ran into some problems with these two methods. What is the difference between them? Here my problem: User has role 'PLAYER' but *not* 'MODERATOR' <dtml-unless "_.SecurityGetUser().has_role('MODERATOR')"> Has role MODERATOR </dtml-unless> doesn't print. Which is what I exspected. But <dtml-unless "_.SecurityGetUser().hasRole('MODERATOR')"> Has role MODERATOR </dtml-unless> does print the message. Why? Regards Ulrich -- Searchengine Know How - Webpromotion - Optimization - Internal Search World Wide Web Publisher, Ulrich Wisser, Odensvag 13, S-14571 Norsborg http://www.publisher.de Tel: +46-8-53460905 Fax: +46-8-534 609 06
hasRole is deprecated, see in AccessControl.User: warnings.warn('BasicUser.hasRole is deprecated, please use ' 'BasicUser.allowed instead; hasRole was an alias for allowed, but ' 'you may have ment to use has_role.', DeprecationWarning) Florent Ulrich Wisser <u.wisser@publisher.de> wrote:
I ran into some problems with these two methods. What is the difference between them?
Here my problem: User has role 'PLAYER' but *not* 'MODERATOR'
<dtml-unless "_.SecurityGetUser().has_role('MODERATOR')"> Has role MODERATOR </dtml-unless>
doesn't print. Which is what I exspected. But
<dtml-unless "_.SecurityGetUser().hasRole('MODERATOR')"> Has role MODERATOR </dtml-unless>
does print the message. Why? -- Florent Guillaume, Nuxeo (Paris, France) +33 1 40 33 79 87 http://nuxeo.com mailto:fg@nuxeo.com
participants (2)
-
Florent Guillaume -
Ulrich Wisser