## 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')}:
%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