summaryrefslogtreecommitdiff
path: root/app/views/admin/users/show.html.haml
blob: 71c12a18783d151bed7aafa1dbfc16ad231c64d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
%h3.page-title
  %span.cgray User:
  = @user.name
  - if @user.blocked?
    %span.cred (Blocked)
  - if @user.admin
    %span.cred (Admin)

  .pull-right
    = link_to edit_admin_user_path(@user), class: "btn grouped" do
      %i.icon-edit
      Edit
%hr

.row
  .col-md-6
    .ui-box
      .title
        Account:
        .pull-right
          = image_tag avatar_icon(@user.email, 32), class: "avatar s32"
      %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
        %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")
        - else
          %li
            %span.light Confirmed:
            %strong.cred
              No

        %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

        - if @user.ldap_user?
          %li
            %span.light LDAP uid:
            %strong
              = @user.extern_uid

        - if @user.created_by
          %li
            %span.light Created by:
            %strong
              = link_to @user.created_by.name, [:admin, @user.created_by]

    - unless @user == current_user
      - if @user.blocked?
        .alert.alert-info
          %h4 This user is blocked
          %br
          %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
          = link_to 'Unblock user', unblock_admin_user_path(@user), method: :put, class: "btn btn-new", data: { confirm: 'Are you sure?' }
      - else
        .alert
          %h4 Block this user
          %br
          %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
          = link_to 'Block user', block_admin_user_path(@user), data: { confirm: 'USER WILL BE BLOCKED! Are you sure?' }, method: :put, class: "btn btn-remove"

      .alert.alert-error
        %h4
          Remove user
        %br
        %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(', ')}
        = link_to 'Remove user', [:admin, @user], data: { confirm: "USER #{@user.name} WILL BE REMOVED! Are you sure?" }, method: :delete, class: "btn btn-remove"

  .col-md-6
    - if @user.users_groups.present?
      .ui-box
        .title Groups:
        %ul.well-list
          - @user.users_groups.each do |user_group|
            - group = user_group.group
            %li.users_group
              %strong= link_to group.name, admin_group_path(group)
              .pull-right
                %span.light= user_group.human_access
                - unless user_group.owner?
                  = link_to group_users_group_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
                    %i.icon-remove.icon-white

    .ui-box
      .title Projects (#{@projects.count})
      %ul.well-list
        - @projects.sort_by(&:name_with_namespace).each do |project|
          - tm = project.team.find_tm(@user.id)
          %li.users_project
            = link_to admin_project_path(project), class: dom_class(project) do
              = project.name_with_namespace

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

                  - if tm.respond_to? :project
                    = link_to project_team_member_path(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
                      %i.icon-remove