[prev in list] [next in list] [prev in thread] [next in thread] 

List:       zope3-users
Subject:    [Zope3-Users] how to know if a principal has the right permissions
From:       Lorenzo Gil Sanchez <lgs () sicem ! biz>
Date:       2006-08-27 19:55:31
Message-ID: 1156708531.2570.13.camel () localhost ! localdomain
[Download RAW message or body]

Hello,

I have a INewsItem content type that anonynmous users can see but only
editors can create/edit/remove. I have a view which list all my news
items. I want to show links from this view to the add, edit and remove
views for every news item but only if the principal is an editor.

So, from my ListNewsView class I want to make a method called 'canEdit'
and in the ZPT for that view I can write something like:

 <a  href="./edit.html" tal:condition="view/canEdit">Change news ...</a>

The question is: how do I know if the current principal has permission
for a specific view? Something like:

def canEdit(self):
   ppal = self.request.principal
   return canView('edit', INewsItem, ppal)

Thanks in advance

Lorenzo Gil

_______________________________________________
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic