Zope Newbie needs help with DTML
Hi all, I couldn't get this code to work in Zope. Can some one help me please? ##################################################### <dtml-if "AUTHENTICATED_USER.getRoles() =='<dtml-var X>'"> Then execute code <dtml-else> Permission Denied! </dtml-if> ##################################################### The .getRoles() method returns a string of more than one roles ('Manager','Owner','*******'). Assume that <dtml-var X> = Owner ,how do i chop off the return of getRoles() to validate the above statement? thanks, -- Mike Tran Shuffle Master Gaming Inc.
You can't nest DTML you need to do the following: <dtml-if "X in AUTHENTICATED_USER.getRoles()"> Then execute code <dtml-else> Permission Denied! </dtml-if> getRoles() returns a list and you want to see if X is in this list. But you probably want to replace the AUTHENTICATED_USER with _.SecurityGetUser() - something to do with more security hth Laurie -----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Mike Doanh Tran Sent: Tuesday, December 18, 2001 11:24 AM To: zope@zope.org Cc: lazug@lazug.org Subject: [Zope] Zope Newbie needs help with DTML Hi all, I couldn't get this code to work in Zope. Can some one help me please? ##################################################### <dtml-if "AUTHENTICATED_USER.getRoles() =='<dtml-var X>'"> Then execute code <dtml-else> Permission Denied! </dtml-if> ##################################################### The .getRoles() method returns a string of more than one roles ('Manager','Owner','*******'). Assume that <dtml-var X> = Owner ,how do i chop off the return of getRoles() to validate the above statement? thanks, -- Mike Tran Shuffle Master Gaming Inc. _______________________________________________ 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 )
Mike, what are you trying to do? sounds like you want: <dtml-if "AUTHENTICATED_USER.hasRole('Manager')"> Then execute code <dtml-else> Permission Denied! </dtml-if> HTH, garry On 18 Dec 2001, at 10:24, Mike Doanh Tran wrote: From: Mike Doanh Tran <mtran@shufflemasterrd.com> Organization: Shufflemaster To: zope@zope.org Copies to: lazug@lazug.org Subject: [Zope] Zope Newbie needs help with DTML Date sent: Tue, 18 Dec 2001 10:24:14 -0700
Hi all,
I couldn't get this code to work in Zope. Can some one help me please?
##################################################### <dtml-if "AUTHENTICATED_USER.getRoles() =='<dtml-var X>'"> Then execute code <dtml-else> Permission Denied! </dtml-if> #####################################################
The .getRoles() method returns a string of more than one roles ('Manager','Owner','*******'). Assume that <dtml-var X> = Owner ,how do i chop off the return of getRoles() to validate the above statement?
thanks,
-- Mike Tran Shuffle Master Gaming Inc.
_______________________________________________ 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 )
+-------------------------------------------+ Garry Steedman mailto:gs@styrax.com Styrax Associates http://www.styrax.com/ "The Good Man has no shape." +-------------------------------------------+
participants (3)
-
Garry Steedman -
Laurie Nason -
Mike Doanh Tran