[BlueBream] security on links

Ilshad Khabibullin astoon.net at gmail.com
Sun Jul 25 04:57:41 EDT 2010


browser:menu and viewlets have this behavior out the box, viewlet are more
component I think.

But often you need more custom decisions, then you have
zope.security.canAccess or other zope.security API methods.

This is example from code which iterates on contained objects and it shows a
links in these contexts (i.e. forums):

adminLinks = getMultiAdapter((self.context, self.request, self),
IContentProvider, name='links')
...
for forum in self.context.values():
    ...
   yield {...
'adminLinks': zope.security.canAccess(adminLinks, 'render') and
adminLinks.render(forum) or u''
 }

These IContentProvider adapters are declared in zcml with permissions and
`locate="True"`. Then that links displayed when defined permission allowed
on the a forum.

2010/7/25 Justin Ryan <justin.ryan at reliefgarden.org>

> Hiya..
>
> I want to restrict some links to display only for principals with access to
> the link target, e.g. an add, edit, admin page, based on permissions.
>
> For the life of me, I can't find an example of this.. Any pointers would be
> helpful.
>
> _______________________________________________
> bluebream mailing list
> bluebream at zope.org
> https://mail.zope.org/mailman/listinfo/bluebream
>
>


-- 
Ilshad R. Khabibullin
http://astoon.zwiki.org
+7 922 600 56 06
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/bluebream/attachments/20100725/2a34933c/attachment.html 


More information about the bluebream mailing list