# HG changeset patch # User Marcin Kuzminski # Date 2017-08-08 15:06:58 # Node ID 72acb5fbafcb129e92c5f43dcc4d5f5b8cff045e # Parent 29e0af0782578a75e941b6985f8e54c48daf1149 perms: updated perms summary for users - expose edit of local (user) settings and global ones - expose the inherit flag to show if permissions are inherited diff --git a/rhodecode/templates/base/perms_summary.mako b/rhodecode/templates/base/perms_summary.mako --- a/rhodecode/templates/base/perms_summary.mako +++ b/rhodecode/templates/base/perms_summary.mako @@ -41,7 +41,7 @@ ${_('Permission')} %if actions: - ${_('Edit Permission')} + ${_('Edit Permission')} %endif @@ -56,7 +56,8 @@ _selected_vals = [x.partition(prefix)[-1] for x in _selected] return admin, _selected_vals, _selected %> - <%def name="glob(lbl, val, val_lbl=None, custom_url=None)"> + + <%def name="glob(lbl, val, val_lbl=None, edit_url=None, edit_global_url=None)"> ${lbl} @@ -64,7 +65,8 @@ %if val[0]: %if not val_lbl: - ${h.bool2icon(True)} + ## super admin case + True %else: ${val_lbl}.admin %endif @@ -82,24 +84,62 @@ %endif %if actions: - - ${_('edit')} - + + % if edit_url or edit_global_url: + + + % if edit_url: + ${_('edit')} + % else: + - + % endif + + + + % if edit_global_url: + ${_('edit global')} + % else: + - + % endif + + + % else: + + + ${_('edit global')} + + % endif + %endif - ${glob(_('Super admin'), get_section_perms('hg.admin', permissions[section]))} + ${glob(_('Repository default permission'), get_section_perms('repository.', permissions[section]), 'repository', + edit_url=None, edit_global_url=h.route_path('admin_permissions_object'))} + + ${glob(_('Repository group default permission'), get_section_perms('group.', permissions[section]), 'group', + edit_url=None, edit_global_url=h.route_path('admin_permissions_object'))} - ${glob(_('Repository default permission'), get_section_perms('repository.', permissions[section]), 'repository', h.route_path('admin_permissions_object'))} - ${glob(_('Repository group default permission'), get_section_perms('group.', permissions[section]), 'group', h.route_path('admin_permissions_object'))} - ${glob(_('User group default permission'), get_section_perms('usergroup.', permissions[section]), 'usergroup', h.route_path('admin_permissions_object'))} + ${glob(_('User group default permission'), get_section_perms('usergroup.', permissions[section]), 'usergroup', + edit_url=None, edit_global_url=h.route_path('admin_permissions_object'))} + + ${glob(_('Super admin'), get_section_perms('hg.admin', permissions[section]), + edit_url=h.url('edit_user', user_id=c.user.user_id, anchor='admin'), edit_global_url=None)} - ${glob(_('Create repositories'), get_section_perms('hg.create.', permissions[section]), custom_url=h.route_path('admin_permissions_global'))} - ${glob(_('Fork repositories'), get_section_perms('hg.fork.', permissions[section]), custom_url=h.route_path('admin_permissions_global'))} - ${glob(_('Create repository groups'), get_section_perms('hg.repogroup.create.', permissions[section]), custom_url=h.route_path('admin_permissions_global'))} - ${glob(_('Create user groups'), get_section_perms('hg.usergroup.create.', permissions[section]), custom_url=h.route_path('admin_permissions_global'))} + ${glob(_('Inherit permissions'), get_section_perms('hg.inherit_default_perms.', permissions[section]), + edit_url=h.url('edit_user_global_perms', user_id=c.user.user_id), edit_global_url=None)} + + ${glob(_('Create repositories'), get_section_perms('hg.create.', permissions[section]), + edit_url=h.url('edit_user_global_perms', user_id=c.user.user_id), edit_global_url=h.route_path('admin_permissions_object'))} + ${glob(_('Fork repositories'), get_section_perms('hg.fork.', permissions[section]), + edit_url=h.url('edit_user_global_perms', user_id=c.user.user_id), edit_global_url=h.route_path('admin_permissions_object'))} + + ${glob(_('Create repository groups'), get_section_perms('hg.repogroup.create.', permissions[section]), + edit_url=h.url('edit_user_global_perms', user_id=c.user.user_id), edit_global_url=h.route_path('admin_permissions_object'))} + + ${glob(_('Create user groups'), get_section_perms('hg.usergroup.create.', permissions[section]), + edit_url=h.url('edit_user_global_perms', user_id=c.user.user_id), edit_global_url=h.route_path('admin_permissions_object'))} %else: