show.html.haml 8 KB
Newer Older
1
%h3.page-title
2
  User:
3 4
  = @user.name
  - if @user.blocked?
5
    %span.cred (Blocked)
6
  - if @user.admin
7 8 9
    %span.cred (Admin)

  .pull-right
10
    = link_to edit_admin_user_path(@user), class: "btn btn-grouped" do
11
      %i.fa.fa-pencil-square-o
12 13
      Edit
%hr
14 15 16 17 18 19 20 21 22
%ul.nav.nav-tabs
  %li.active
    %a{"data-toggle" => "tab", href: "#account"} Account
  %li
    %a{"data-toggle" => "tab", href: "#profile"} Profile
  %li
    %a{"data-toggle" => "tab", href: "#groups"} Groups
  %li
    %a{"data-toggle" => "tab", href: "#projects"} Projects
23 24
  %li
    %a{"data-toggle" => "tab", href: "#ssh-keys"} SSH keys
25

26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
.tab-content
  #account.tab-pane.active
    .row
      .col-md-6
        .panel.panel-default
          .panel-heading
            Account:
          %ul.well-list
            %li
              %span.light Name:
              %strong= @user.name
            %li
              %span.light Username:
              %strong
                = @user.username
            %li
              %span.light Email:
              %strong
                = mail_to @user.email
            - @user.emails.each do |email|
              %li
                %span.light Secondary email:
                %strong= email.email
49
                = link_to remove_email_admin_user_path(@user, email), data: { confirm: "Are you sure you want to remove #{email.email}?" }, method: :delete, class: "btn-tiny btn btn-remove pull-right", title: 'Remove secondary email', id: "remove_email_#{email.id}" do
50
                  %i.fa.fa-times
51

52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
            %li
              %span.light Can create groups:
              %strong
                = @user.can_create_group ? "Yes" : "No"
            %li
              %span.light Personal projects limit:
              %strong
                = @user.projects_limit
            %li
              %span.light Member since:
              %strong
                = @user.created_at.stamp("Nov 12, 2031")
            - if @user.confirmed_at
              %li
                %span.light Confirmed at:
                %strong
                  = @user.confirmed_at.stamp("Nov 12, 2031")
69
            - else
70 71 72 73 74
              %li
                %span.light Confirmed:
                %strong.cred
                  No

Ben Bodenmiller's avatar
Ben Bodenmiller committed
75 76 77 78 79 80 81 82
            %li
              %span.light Current sign-in at:
              %strong
                - if @user.current_sign_in_at
                  = @user.current_sign_in_at.stamp("Nov 12, 2031")
                - else
                  never

83 84 85 86 87 88 89
            %li
              %span.light Last sign-in at:
              %strong
                - if @user.last_sign_in_at
                  = @user.last_sign_in_at.stamp("Nov 12, 2031")
                - else
                  never
90

Ben Bodenmiller's avatar
Ben Bodenmiller committed
91 92 93 94 95
            %li
              %span.light Sign-in count:
              %strong
                = @user.sign_in_count

96 97 98 99
            - if @user.ldap_user?
              %li
                %span.light LDAP uid:
                %strong
100
                  = @user.ldap_identity.extern_uid
101

102 103 104 105 106
            - if @user.created_by
              %li
                %span.light Created by:
                %strong
                  = link_to @user.created_by.name, [:admin, @user.created_by]
107

108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133
      .col-md-6
        - unless @user == current_user
          - if @user.blocked?
            .alert.alert-info
              %h4 This user is blocked
              %p Blocking user has the following effects:
              %ul
                %li User will not be able to login
                %li User will not be able to access git repositories
                %li User will be removed from joined projects and groups
                %li Personal projects will be left
                %li Owned groups will be left
              %br
              = link_to 'Unblock user', unblock_admin_user_path(@user), method: :put, class: "btn btn-new", data: { confirm: 'Are you sure?' }
          - else
            .alert.alert-warning
              %h4 Block this user
              %p Blocking user has the following effects:
              %ul
                %li User will not be able to login
                %li User will not be able to access git repositories
                %li User will be removed from joined projects and groups
                %li Personal projects will be left
                %li Owned groups will be left
              %br
              = link_to 'Block user', block_admin_user_path(@user), data: { confirm: 'USER WILL BE BLOCKED! Are you sure?' }, method: :put, class: "btn btn-remove"
134

135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159
          .alert.alert-danger
            %h4
              Remove user
            %p Deleting a user has the following effects:
            %ul
              %li All user content like authored issues, snippets, comments will be removed
              - rp = @user.personal_projects.count
              - unless rp.zero?
                %li #{pluralize rp, 'personal project'} will be removed and cannot be restored
              - if @user.solo_owned_groups.present?
                %li
                  Next groups with all content will be removed:
                  %strong #{@user.solo_owned_groups.map(&:name).join(', ')}
            %br
            = link_to 'Remove user', [:admin, @user], data: { confirm: "USER #{@user.name} WILL BE REMOVED! Are you sure?" }, method: :delete, class: "btn btn-remove"

  #profile.tab-pane
    .row
      .col-md-6
        .panel.panel-default
          .panel-heading
            = @user.name
          %ul.well-list
            %li
              = image_tag avatar_icon(@user.email, 60), class: "avatar s60"
160
            %li
161 162 163 164 165 166
              %span.light Profile page:
              %strong
                = link_to user_path(@user) do
                  = @user.username
      .col-md-6
        = render 'users/profile', user: @user
167

168
  #groups.tab-pane
169
    - if @user.group_members.present?
170
      .panel.panel-default
171
        .panel-heading Groups:
172
        %ul.well-list
173
          - @user.group_members.each do |user_group|
174
            - group = user_group.group
175
            %li.group_member
176 177
              %span{class: ("list-item-name" unless user_group.owner?)}
                %strong= link_to group.name, admin_group_path(group)
178 179
              .pull-right
                %span.light= user_group.human_access
180
                - unless user_group.owner?
181
                  = link_to group_group_member_path(group, user_group), data: { confirm: remove_user_from_group_message(group, @user) }, method: :delete, remote: true, class: "btn-tiny btn btn-remove", title: 'Remove user from group' do
182
                    %i.fa.fa-times.fa-inverse
183 184
    - else
      .nothing-here-block This user has no groups.
185

186 187 188 189 190 191 192 193 194 195
  #projects.tab-pane
    - if @user.groups.any?
      .panel.panel-default
        .panel-heading Group projects
        %ul.well-list
          - @user.groups.each do |group|
            %li
              %strong= group.name
              – access to
              #{pluralize(group.projects.count, 'project')}
196

197 198 199 200 201 202 203 204 205 206
    .row
      .col-md-6
        = render 'users/projects', projects: @personal_projects

      .col-md-6
        .panel.panel-default
          .panel-heading Joined projects (#{@joined_projects.count})
          %ul.well-list
            - @joined_projects.sort_by(&:name_with_namespace).each do |project|
              - tm = project.team.find_tm(@user.id)
207
              %li.project_member
208
                .list-item-name
Vinnie Okada's avatar
Vinnie Okada committed
209
                  = link_to admin_namespace_project_path(project.namespace, project), class: dom_class(project) do
210 211 212 213 214 215 216 217
                    = project.name_with_namespace

                - if tm
                  .pull-right
                    - if tm.owner?
                      %span.light Owner
                    - else
                      %span.light= tm.human_access
218

219
                      - if tm.respond_to? :project
Vinnie Okada's avatar
Vinnie Okada committed
220
                        = link_to namespace_project_team_member_path(project.namespace, project, @user), data: { confirm: remove_from_project_team_message(project, @user) }, remote: true, method: :delete, class: "btn-tiny btn btn-remove", title: 'Remove user from project' do
221
                          %i.fa.fa-times
222
  #ssh-keys.tab-pane
223
    = render 'profiles/keys/key_table', admin: true