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

<% elems = [ (_('User ID'), c.user.user_id, '', ''), (_('Created on'), h.format_date(c.user.created_on), '', ''), (_('Source of Record'), c.user.extern_type, '', ''),

(_('Last login'), c.user.last_login or '-', '', ''), (_('Last activity'), c.user.last_activity, '', ''),

(_('Repositories'), len(c.user.repositories), '', [x.repo_name for x in c.user.repositories]), (_('Repository groups'), len(c.user.repository_groups), '', [x.group_name for x in c.user.repository_groups]), (_('User groups'), len(c.user.user_groups), '', [x.users_group_name for x in c.user.user_groups]),

(_('Owned Artifacts'), len(c.user.artifacts), '', [x.file_uid for x in c.user.artifacts]),

(_('Reviewer of pull requests'), len(c.user.reviewer_pull_requests), '', ['Pull Request #{}'.format(x.pull_request.pull_request_id) for x in c.user.reviewer_pull_requests]), (_('Assigned to review rules'), len(c.user_to_review_rules), '', [x for x in c.user_to_review_rules]),

(_('Member of User groups'), len(c.user.group_member), '', [x.users_group.users_group_name for x in c.user.group_member]), (_('Force password change'), c.user.user_data.get('force_password_change', 'False'), '', ''), ] %>

### ${base.gravatar_with_user(c.user.username, 16, tooltip=False, _class='pull-left')} - ${_('Access Permissions')}

Name | Value | Action
--- | --- | ---
% for elem in elems: ${base.tr_info_entry(elem)} % endfor

### ${_('Force Password Reset')}

${h.secure_form(h.route_path('user_disable_force_password_reset', user_id=c.user.user_id), request=request)}
${_("Clear the forced password change flag.")}
${h.end_form()}

${h.secure_form(h.route_path('user_enable_force_password_reset', user_id=c.user.user_id), request=request)}
${_("When this is enabled user will have to change they password when they next use RhodeCode system. This will also forbid vcs operations until someone makes a password change in the web interface")}
${h.end_form()}

### ${_('Personal Repository Group')}

${h.secure_form(h.route_path('user_create_personal_repo_group', user_id=c.user.user_id), request=request)}

%if c.personal_repo_group:
${_('Users personal repository group')} : ${h.link_to(c.personal_repo_group.group_name, h.route_path('repo_group_home', repo_group_name=c.personal_repo_group.group_name))}
%else:
${_('This user currently does not have a personal repository group')}
${_('New group will be created at: `/%(path)s`') % {'path': c.personal_repo_group_name}}
%endif
${h.end_form()}

### ${_('Delete User')}

${h.secure_form(h.route_path('user_delete', user_id=c.user.user_id), request=request)}

${_ungettext('This user owns %s repository.', 'This user owns %s repositories.', len(c.user.repositories)) % len(c.user.repositories)} | ${_('Detach repositories')} | ${_('Delete repositories')}
${_ungettext('This user owns %s repository group.', 'This user owns %s repository groups.', len(c.user.repository_groups)) % len(c.user.repository_groups)} | ${_('Detach repository groups')} | ${_('Delete repositories')}
${_ungettext('This user owns %s user group.', 'This user owns %s user groups.', len(c.user.user_groups)) % len(c.user.user_groups)} | ${_('Detach user groups')} | ${_('Delete repositories')}
${_ungettext('This user owns %s pull request.', 'This user owns %s pull requests.', len(c.user.user_pull_requests)) % len(c.user.user_pull_requests)} | ${_('Detach pull requests')} | ${_('Delete pull requests')}
${_ungettext('This user owns %s artifact.', 'This user owns %s artifacts.', len(c.user.artifacts)) % len(c.user.artifacts)} | ${_('Detach Artifacts')} | ${_('Delete Artifacts')}

% if len(c.user.repositories) > 0 or len(c.user.repository_groups) > 0 or len(c.user.user_groups) > 0: % endif

${_('New owner for detached objects')}:
${base.gravatar_with_user(c.detach_user.email, 16, tooltip=True)}

${_("When selecting the detach option, the depending objects owned by this user will be assigned to the above user.")}
${_("The delete option will delete the user and all his owned objects!")}

% if c.can_delete_user_message:

${c.can_delete_user_message}

% endif

${h.end_form()}