## snippet for displaying permissions overview for users ## usage: ## <%namespace name="p" file="/base/perms_summary.html"/> ## ${p.perms_summary(c.perm_user.permissions)} <%def name="perms_summary(permissions, show_all=False, actions=True)">
%for section in sorted(permissions.keys()):
${section.replace("_"," ").capitalize()} %if section != 'global':
${_('show')}: ${h.checkbox('perms_filter_none_%s' % section, 'none', 'checked', class_='perm_filter filter_%s' % section, section=section, perm_type='none')} ${h.checkbox('perms_filter_read_%s' % section, 'read', 'checked', class_='perm_filter filter_%s' % section, section=section, perm_type='read')} ${h.checkbox('perms_filter_write_%s' % section, 'write', 'checked', class_='perm_filter filter_%s' % section, section=section, perm_type='write')} ${h.checkbox('perms_filter_admin_%s' % section, 'admin', 'checked', class_='perm_filter filter_%s' % section, section=section, perm_type='admin')}
%endif
%if not permissions[section]: ${_('No permissions defined yet')} %else:
## global permission box %if section == 'global': %if actions: %endif %for k in permissions[section]: %if actions: %endif %endfor %else: ## none/read/write/admin permissions on groups/repos etc %if actions: %endif %for k, section_perm in sorted(permissions[section].items(), key=lambda s: {'none':0, 'read':1,'write':2,'admin':3}.get(s[1].split('.')[-1])): %if section_perm.split('.')[-1] != 'none' or show_all: %if actions: %endif %endif %endfor %endif
${_('Permission')}${_('Edit Permission')}
${h.get_permission_name(k)} ${_('edit')}
${_('Name')} ${_('Permission')}${_('Edit Permission')}
%if section == 'repositories': ${k} %elif section == 'repositories_groups': ${k} %elif section == 'user_groups': ##${k} ${k} %endif ${section_perm} %if section == 'repositories': ${_('edit')} %elif section == 'repositories_groups': ${_('edit')} %elif section == 'user_groups': ##${_('edit')} %endif
%endif %endfor