Error: AUTHENTICATED_USER.hasRoles()
Hello, I can't figure out what arguments the hasRoles function takes. I have tried a lot but it all gives an attribute error. I have these 2 roles - StationMan and ChannelMan - and I need to test whether the logged-in user is either one of them. But what arguments must I pass to the function ? -- ************************ Gitte Wange Jensen System Squid Developer MMManager Aps +45 29 72 79 72 gitte@mmmanager.org ************************
As a list if I remember... <dtml-if "AUTHENTICATED_USER.hasRoles(['StationMan', 'ChannelMan'])"> ----- Original Message ----- From: "Gitte Wange" <gitte@mmmanager.org> To: <zope@zope.org> Sent: Wednesday, April 04, 2001 1:17 AM Subject: [Zope] Error: AUTHENTICATED_USER.hasRoles()
Hello,
I can't figure out what arguments the hasRoles function takes. I have tried a lot but it all gives an attribute error.
I have these 2 roles - StationMan and ChannelMan - and I need to test whether the logged-in user is either one of them.
But what arguments must I pass to the function ?
-- ************************ Gitte Wange Jensen
System Squid Developer MMManager Aps +45 29 72 79 72
gitte@mmmanager.org ************************
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
The method you're trying to use is called has_role() and not hasRoles(). Here are some examples of usage: <dtml-var "AUTHENTICATED_USER.has_role('Manager')"> Returns true if one of the user's roles matches the one given. <dtml-var "AUTHENTICATED_USER.has_role(['Manager', 'Knight_of_the_Round_Table'])"> Returns true if one of the user's roles matches one of the listed roles. __Luciano Gitte Wange wrote:
Hello,
I can't figure out what arguments the hasRoles function takes. I have tried a lot but it all gives an attribute error.
I have these 2 roles - StationMan and ChannelMan - and I need to test whether the logged-in user is either one of them.
But what arguments must I pass to the function ?
-- ************************ Gitte Wange Jensen
System Squid Developer MMManager Aps +45 29 72 79 72
gitte@mmmanager.org ************************
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
participants (3)
-
Gitte Wange -
Luciano Ramalho -
Zopista