<%namespace name="base" file="/base/base.mako"/>

### ${_('Repository Access Permissions')}

${h.secure_form(h.route_path('edit_repo_perms', repo_name=c.repo_name), request=request)}

${_('None')} | ${_('Read')} | ${_('Write')} | ${_('Admin')} | ${_('User/User Group')} |  |
--- | --- | --- | --- | --- | --- | ---
## USERS %for _user in c.rhodecode_db_repo.permissions(): %if getattr(_user, 'admin_row', None) or getattr(_user, 'owner_row', None):

${h.radio('admin_perm_%s' % _user.user_id,'repository.none', disabled="disabled")}

${h.radio('admin_perm_%s' % _user.user_id,'repository.read', disabled="disabled")}

${h.radio('admin_perm_%s' % _user.user_id,'repository.write', disabled="disabled")}

${h.radio('admin_perm_%s' % _user.user_id,'repository.admin', 'repository.admin', disabled="disabled")}

${base.gravatar(_user.email, 16, user=_user, tooltip=True)} ${h.link_to_user(_user.username)} %if getattr(_user, 'admin_row', None): (${_('super-admin')}) %endif %if getattr(_user, 'owner_row', None): (${_('owner')}) %endif

%elif _user.username == h.DEFAULT_USER and c.rhodecode_db_repo.private:
${_('private repository')} | ${base.gravatar(h.DEFAULT_USER_EMAIL, 16)} ${h.DEFAULT_USER} - ${_('only users/user groups explicitly added here will have access')} | ${_('un-set private mode')}
%else: <% used_by_n_rules = len(getattr(_user, 'branch_rules', None) or []) %>

${h.radio('u_perm_%s' % _user.user_id,'repository.none', checked=_user.permission=='repository.none', disabled="disabled" if (used_by_n_rules and _user.username != h.DEFAULT_USER) else None)}

${h.radio('u_perm_%s' % _user.user_id,'repository.read', checked=_user.permission=='repository.read', disabled="disabled" if (used_by_n_rules and _user.username != h.DEFAULT_USER) else None)}

${h.radio('u_perm_%s' % _user.user_id,'repository.write', checked=_user.permission=='repository.write')}

${h.radio('u_perm_%s' % _user.user_id,'repository.admin', checked=_user.permission=='repository.admin')}

${base.gravatar(_user.email, 16, user=_user, tooltip=True)} % if _user.username == h.DEFAULT_USER: ${h.DEFAULT_USER} % if _user.active: - ${_('permission for other logged in and anonymous users')} % else: - ${_('permission for other logged in users')} % endif % else: % if getattr(_user, 'duplicate_perm', None): ${h.link_to_user(_user.username)} (${_('inactive duplicate')}) % else: ${h.link_to_user(_user.username)} % endif %if getattr(_user, 'branch_rules', None): % if used_by_n_rules == 1: (${_('used by {} branch rule, requires write or higher permissions').format(used_by_n_rules)}) % else: (${_('used by {} branch rules, requires write or higher permissions').format(used_by_n_rules)}) % endif %endif % endif

%if _user.username != h.DEFAULT_USER and getattr(_user, 'branch_rules', None) is None: ${_('Remove')} %elif _user.username == h.DEFAULT_USER: ${_('set private mode')} %endif

%endif %endfor

## USER GROUPS %for _user_group in c.rhodecode_db_repo.permission_user_groups(with_members=True):

${h.radio('g_perm_%s' % _user_group.users_group_id,'repository.none', checked=_user_group.permission=='repository.none')}

${h.radio('g_perm_%s' % _user_group.users_group_id,'repository.read', checked=_user_group.permission=='repository.read')}

${h.radio('g_perm_%s' % _user_group.users_group_id,'repository.write', checked=_user_group.permission=='repository.write')}

${h.radio('g_perm_%s' % _user_group.users_group_id,'repository.admin', checked=_user_group.permission=='repository.admin')}

${base.user_group_icon(_user_group, tooltip=True)} %if c.is_super_admin: ${_user_group.users_group_name} %else: ${h.link_to_group(_user_group.users_group_name)} %endif (${_('members')}: ${len(_user_group.members)})

${_('Remove')}

%endfor
|  |  |  |  | ${_('Add user/user group')} |

${h.submit('save',_('Save'),class_="btn btn-primary")} ${h.reset('reset',_('Reset'),class_="btn btn-danger")}
${h.end_form()}