Skip to content

Commit

Permalink
introduced frontend body tag for views with no, or just view permision.
Browse files Browse the repository at this point in the history
  • Loading branch information
djay committed Sep 10, 2015
1 parent 512cb00 commit b8b55c1
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions plone/app/layout/globals/layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,13 +180,16 @@ def bodyClass(self, template, view):
if self.icons_visible():
body_classes.append('icons-on')

# who is allowed to view this view.
# HACK: there must be a less dodgy way to do this?
for permission,roles in getattr(view, '__ac_permissions__', tuple()):
body_classes.append('viewpermission-' + normalizer.normalize(permission))
# permissions required. Useful to theme frontend and backend differently
permissions = []
if not getattr(view, '__ac_permissions__'):
# should we have this special permission if it requires none?
body_classes.append('viewpermission-none')
permissions = ['none']
for permission,roles in getattr(view, '__ac_permissions__', tuple()):
permissions.append(normalizer.normalize(permission))
if 'none' in permissions or 'view' in permissions:
body_classes.append('frontend')
for permission in permissions:
body_classes.append('viewpermission-' + permission)

# class for user roles
membership = getToolByName(context, "portal_membership")
Expand Down

0 comments on commit b8b55c1

Please sign in to comment.