diff --git a/tailbone/static/css/perms.css b/tailbone/static/css/perms.css index 6a85e107..7db6a2c0 100644 --- a/tailbone/static/css/perms.css +++ b/tailbone/static/css/perms.css @@ -3,6 +3,10 @@ * Permission Lists ******************************/ +div.field-wrapper.permissions { + overflow: visible; +} + div.field-wrapper.permissions div.field div.group { margin-bottom: 10px; } diff --git a/tailbone/views/roles.py b/tailbone/views/roles.py index 78d78d38..2217c314 100644 --- a/tailbone/views/roles.py +++ b/tailbone/views/roles.py @@ -74,18 +74,24 @@ def PermissionsFieldRenderer(permissions, *args, **kwargs): for groupkey in sorted(permissions, key=lambda k: permissions[k]['label'].lower()): inner = HTML.tag('p', c=permissions[groupkey]['label']) perms = permissions[groupkey]['perms'] + rendered = False for key in sorted(perms, key=lambda p: perms[p]['label'].lower()): checked = has_permission(Session(), role, key, include_guest=False, include_authenticated=False) - label = perms[key]['label'] - if readonly: - span = HTML.tag('span', c="[X]" if checked else "[ ]") - inner += HTML.tag('p', class_='perm', c=span + ' ' + label) - else: - inner += tags.checkbox(self.name + '-' + key, - checked=checked, label=label) - html += HTML.tag('div', class_='group', c=inner) + if checked or not readonly: + label = perms[key]['label'] + if readonly: + span = HTML.tag('span', c="[X]" if checked else "[ ]") + inner += HTML.tag('p', class_='perm', c=span + ' ' + label) + else: + inner += tags.checkbox(self.name + '-' + key, + checked=checked, label=label) + rendered = True + if rendered: + html += HTML.tag('div', class_='group', c=inner) + if not html: + return "(none granted)" return html def render(self, **kwargs):