ucb_rails_user 3.0.0 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 22dfe957a0a20c8e4d3d0696e8deabb8e2c1080cbb6bf20cce37dd8ec60c29c2
4
- data.tar.gz: a63c08a5433c35ef7cb9de21b86411d660315f6300acf777ab76b3c83acef3aa
3
+ metadata.gz: 2aa06951596331c10cc4488247690be7789b983bcd75d0dfbaf7848f339f2fce
4
+ data.tar.gz: 4fbb826d46c63e76db14a21d32ea155bc8f87db5c20798b9d345ecc2a2d91456
5
5
  SHA512:
6
- metadata.gz: da3cedb8edd90425af6d8e0bb3d700bc1aa560ff1f76072bf6809b070c383f06956bf676fdbb4a8f6d2408d5562ac053ae545e5e69e76b4480bc292af7d03323
7
- data.tar.gz: e899dd9644a2f493233a7891ed188b500fcd5b793f46ce0c453b652b82ed6de9cb72181e913dcf7c2c08cb990ede6c7407e3e1cebbccca373a8f14b6ad0a4dee
6
+ metadata.gz: 91219b59d56af936ec69898ee7b94776e34ca21e8662450c6c75a28146ae4ca06adcd683a8426976bcdb1f0c57f505eb8243a141d8eec9ba201bd3b6eb666032
7
+ data.tar.gz: 58db7b4561be2a9cbb538cd8fbc2236ff60e508318ad016a091a209fbb1c6b3bb4725a2e2864b03c029a485f7cc3a6b640bffc3da995151628abbe925be33687
@@ -67,6 +67,7 @@ $( window ).on("load", function() {
67
67
  name: 'users',
68
68
  source: usersSource,
69
69
  display: 'name',
70
+ limit: 7, // any higher than this, and the results don't display properly
70
71
  templates: {
71
72
  empty: [
72
73
  '<div class="empty-message">',
@@ -74,7 +75,7 @@ $( window ).on("load", function() {
74
75
  '</div>'
75
76
  ].join('\n'),
76
77
  suggestion: function (data) {
77
- return '<div><strong>' + data.name + '</strong></div>'
78
+ return '<div><strong>' + data.name + '</strong> (' + data.uid + ')</div>'
78
79
  }
79
80
  }
80
81
  });
@@ -4,6 +4,7 @@
4
4
 
5
5
  .recent-impersonations
6
6
  margin-top: 24px
7
+ padding-bottom: 200px
7
8
 
8
9
  ul
9
10
  padding-left: 0px
@@ -8,25 +8,6 @@
8
8
  .twitter-typeahead
9
9
  display: block !important
10
10
 
11
- .tt-hint
12
- display: block
13
- width: 100%
14
- height: 38px
15
- margin-top: -2px
16
- padding: 8px 12px
17
- font-size: 14px
18
- line-height: 1.428571429
19
- color: #999
20
- vertical-align: middle
21
- background-color: #ffffff
22
- border: 1px solid #cccccc
23
- border-radius: 4px
24
- -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075)
25
- box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075)
26
- -webkit-transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s
27
- transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s
28
-
29
-
30
11
  .tt-menu
31
12
  // make this wide enough to accomodate the org unit code and name
32
13
  width: 400px
@@ -41,26 +22,21 @@
41
22
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175)
42
23
  background-clip: padding-box
43
24
 
44
-
45
25
  .tt-suggestion
46
26
  display: block
47
27
  padding: 3px 20px
48
28
  width: 100%
49
29
 
50
-
51
30
  .tt-suggestion.tt-selectable
52
31
  margin: 5px 0px 5px 0px
53
32
 
54
-
55
33
  .tt-suggestion.tt-cursor
56
34
  color: #fff
57
35
  background-color: #428bca
58
36
 
59
-
60
37
  .tt-suggestion.tt-cursor a
61
38
  color: #fff
62
39
 
63
-
64
40
  .tt-suggestion p
65
41
  margin: 0
66
42
 
@@ -28,7 +28,7 @@ module UcbRailsUser::Concerns::UsersController
28
28
 
29
29
  def impersonate_search
30
30
  result = UcbRailsUser::UserSearch.find_users_by_name(params[:q])
31
- render json: result.map { |u| { name: u.full_name, id: u.id } }
31
+ render json: result.map { |u| { name: u.full_name, id: u.id, uid: u.ldap_uid } }
32
32
  end
33
33
 
34
34
  def edit
@@ -113,8 +113,8 @@ module UcbRailsUser::Concerns::UsersController
113
113
 
114
114
  private
115
115
 
116
- def user_params
117
- params.require(:user).permit(
116
+ def user_params(extra_params = [])
117
+ params.require(:user).permit([
118
118
  :superuser_flag,
119
119
  :inactive_flag,
120
120
  :first_name,
@@ -125,7 +125,7 @@ module UcbRailsUser::Concerns::UsersController
125
125
  :last_request_at,
126
126
  :last_logout_at,
127
127
  :last_login_at,
128
- :uid
128
+ :uid] + extra_params
129
129
  )
130
130
  end
131
131
 
@@ -17,5 +17,10 @@ module UcbRailsUser
17
17
  def checkmark(bool, true_string="&#10004;".html_safe, false_string='&nbsp;'.html_safe)
18
18
  bool ? true_string : false_string
19
19
  end
20
+
21
+ def full_name_with_uid(user)
22
+ return "" unless user.present?
23
+ "#{user.full_name} (#{user.ldap_uid})"
24
+ end
20
25
  end
21
26
  end
@@ -2,21 +2,20 @@ module UcbRailsUser::UserSearch
2
2
 
3
3
  def self.find_users_by_name(name)
4
4
  return [] unless name.present?
5
- (name1, name2) = name.split
6
- query = case_insenstive(:first_name, name1)
7
- .or(case_insenstive(:last_name, name1))
8
- if name2.present?
9
- query = query
10
- .or(case_insenstive(:first_name, name2))
11
- .or(case_insenstive(:last_name, name2))
12
- end
5
+ (name1, name2) = name
6
+ .downcase
7
+ .split
8
+ .take(2)
9
+ .reject { |n| n.blank? }
10
+ .map { |n| "#{n}%" }
11
+ query =
12
+ if name1.present? && name2.present?
13
+ User.where("LOWER(first_name) LIKE ? AND LOWER(last_name) LIKE ?", name1, name2)
14
+ .or(User.where("LOWER(last_name) LIKE ? AND LOWER(first_name) LIKE ?", name1, name2))
15
+ else
16
+ User.where("LOWER(first_name) LIKE ? OR LOWER(last_name) LIKE ?", name1, name1)
17
+ end
13
18
  query.order(:last_name, :first_name)
14
19
  end
15
20
 
16
- private
17
-
18
- def self.case_insenstive(column, value)
19
- User.where("LOWER(#{column}) = ?", value.downcase)
20
- end
21
-
22
21
  end
@@ -15,6 +15,6 @@
15
15
  %h3 Recent impersonations
16
16
  %ul
17
17
  - current_user.recent_impersonations.each do |imp|
18
- %li= link_to imp.target.full_name, admin_impersonations_path() + "?ucb_rails_user_impersonation[target_id=#{imp.target.id}]", method: :post
18
+ %li= link_to full_name_with_uid(imp.target), admin_impersonations_path() + "?ucb_rails_user_impersonation[target_id=#{imp.target.id}]", method: :post
19
19
  - else
20
20
  %h4 No recent impersonations
@@ -1,3 +1,3 @@
1
1
  module UcbRailsUser
2
- VERSION = '3.0.0'
2
+ VERSION = '3.0.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ucb_rails_user
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve Downey
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2019-08-17 00:00:00.000000000 Z
14
+ date: 2019-09-09 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rails
@@ -370,7 +370,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
370
370
  - !ruby/object:Gem::Version
371
371
  version: '0'
372
372
  requirements: []
373
- rubygems_version: 3.0.3
373
+ rubyforge_project:
374
+ rubygems_version: 2.7.7
374
375
  signing_key:
375
376
  specification_version: 4
376
377
  summary: Rails engine for UCB user accounts