ucb_rails_user 6.2.2 → 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +18 -1
  3. data/app/assets/config/ucb_rails_user_manifest.js +1 -0
  4. data/app/assets/stylesheets/ucb_rails_user/components/impersonations.css +12 -0
  5. data/app/assets/stylesheets/ucb_rails_user/components/loader.css +41 -0
  6. data/app/assets/stylesheets/ucb_rails_user/components/users_table.css +54 -0
  7. data/app/assets/stylesheets/ucb_rails_user/main.css +1 -0
  8. data/app/assets/stylesheets/ucb_rails_user/pagy_tailwind.css +21 -0
  9. data/app/assets/stylesheets/ucb_rails_user/user.css +29 -0
  10. data/app/controllers/concerns/ucb_rails_user/auth_concerns.rb +1 -0
  11. data/app/controllers/concerns/ucb_rails_user/users_controller_concerns.rb +2 -5
  12. data/app/helpers/ucb_rails_user/users_helper.rb +1 -0
  13. data/app/helpers/ucb_rails_user_helper.rb +0 -15
  14. data/app/views/ucb_rails_user/home/logged_in.html.erb +6 -0
  15. data/app/views/ucb_rails_user/home/not_logged_in.html.erb +5 -0
  16. data/app/views/ucb_rails_user/impersonations/index.html.erb +32 -0
  17. data/app/views/ucb_rails_user/lps/_form.html.erb +20 -0
  18. data/app/views/ucb_rails_user/lps/_modal.html.erb +15 -0
  19. data/app/views/ucb_rails_user/lps/_results.html.erb +44 -0
  20. data/app/views/ucb_rails_user/lps/search.js.erb +5 -0
  21. data/app/views/ucb_rails_user/users/_form.html.erb +15 -0
  22. data/app/views/ucb_rails_user/users/_search_results.html.erb +33 -0
  23. data/app/views/ucb_rails_user/users/_user.html.erb +18 -0
  24. data/app/views/ucb_rails_user/users/edit.html.erb +3 -0
  25. data/app/views/ucb_rails_user/users/index.html.erb +34 -0
  26. data/app/views/ucb_rails_user/users/new.html.erb +19 -0
  27. data/app/views/ucb_rails_user/users/search.js.erb +4 -0
  28. data/lib/ucb_rails_user/configuration/email.rb +2 -58
  29. data/lib/ucb_rails_user/engine.rb +14 -0
  30. data/lib/ucb_rails_user/version.rb +1 -1
  31. data/lib/ucb_rails_user.rb +0 -2
  32. metadata +94 -60
  33. data/app/assets/stylesheets/ucb_rails_user/components/_impersonations.sass +0 -13
  34. data/app/assets/stylesheets/ucb_rails_user/components/_loader.sass +0 -46
  35. data/app/assets/stylesheets/ucb_rails_user/components/_users_table.sass +0 -10
  36. data/app/assets/stylesheets/ucb_rails_user/components/index.sass +0 -3
  37. data/app/assets/stylesheets/ucb_rails_user/main.sass +0 -6
  38. data/app/views/ucb_rails_user/home/logged_in.html.haml +0 -5
  39. data/app/views/ucb_rails_user/home/not_logged_in.html.haml +0 -5
  40. data/app/views/ucb_rails_user/impersonations/index.html.haml +0 -20
  41. data/app/views/ucb_rails_user/lps/_form.html.haml +0 -19
  42. data/app/views/ucb_rails_user/lps/_modal.html.haml +0 -9
  43. data/app/views/ucb_rails_user/lps/_results.html.haml +0 -34
  44. data/app/views/ucb_rails_user/lps/search.js.haml +0 -3
  45. data/app/views/ucb_rails_user/users/_form.html.haml +0 -14
  46. data/app/views/ucb_rails_user/users/_search_results.html.haml +0 -24
  47. data/app/views/ucb_rails_user/users/_user.html.haml +0 -11
  48. data/app/views/ucb_rails_user/users/edit.html.haml +0 -3
  49. data/app/views/ucb_rails_user/users/index.html.haml +0 -22
  50. data/app/views/ucb_rails_user/users/new.html.haml +0 -16
  51. data/app/views/ucb_rails_user/users/search.js.haml +0 -4
  52. data/lib/ucb_rails_user/configuration/exception_notification.rb +0 -21
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: efe7e7bf9c4bbb077db1f44cd527f013d21680939c0e1d1a758d4d0b1c9d0bc0
4
- data.tar.gz: 66415e3e6c99d3c02784798c45a0a0b17655f7cfa76cccccfe7318b4417f4f91
3
+ metadata.gz: 3a52f47b67f3941ef82192caf5fd352e71e9d85074d366da8a6a44897fbafd82
4
+ data.tar.gz: 64fa7bda12ce85ba806ebc4000131d700a8317ef5d95e2f49079f099d1f33ea9
5
5
  SHA512:
6
- metadata.gz: 39a42d7834c1091def09ab550ff44847d60b0ef74cfbf1795d2177972f117ed46f24866480eeb8ce2ce1c9e394903f38fee9657b5bde2643aac24ee080db02dc
7
- data.tar.gz: 893606deb44e416f20532d62fc9ac34fe6a39f66543686c70851435f70177420b195b5c5276e376ac68cf448b673b70a18e764260df724faa644df0a7e1064c0
6
+ metadata.gz: 4c0288fd05fee9438c59fd518bbb143721b43c8109aec25248ba162f8a8e3ce2abd70ab96b228caa37dbdc111288d9be1c3ccb804deb191afce17e683bb07de3
7
+ data.tar.gz: ee2fb735c92576d9cd596721ed3c6f3d4f30e2899725ce522c99121c3c05d3e77385d4b32b1c2aef80a13d27a5901ec3192de3b6990e751c4f7d77d4f09ed5c3
data/README.md CHANGED
@@ -27,7 +27,7 @@ See [this wiki page](https://github.com/ucb-ist-eas/ucb_rails_user/wiki/Upgradin
27
27
  ## Prerequisites
28
28
 
29
29
  * Ruby >= 3.0
30
- * Rails >= 6.0
30
+ * Rails >= 8.0
31
31
 
32
32
  Older versions may work as well, but they haven't been tested.
33
33
 
@@ -273,3 +273,20 @@ If you're using the `HomeController` provided by this engine for your home page,
273
273
  * `not_logged_in.html.haml`
274
274
 
275
275
  One of those two views will render when the user hits the home page, depending on whether or not they're currently logged in.
276
+
277
+ ## Session Timeouts
278
+
279
+ While we would want to have session timeouts be the same across apps, we have noticed that some apps use cookies for sessions, some ActiveRecord and some not explicitly stated at all (Cookies). This is the general pattern that we are trying to follow. The major part is the `expire_after` and trying to keep that as close to the `30.miutees` as we can with the apps that we support. Obviously, some apps may need to have a different timeout.
280
+
281
+ ```ruby
282
+ # cookie_key generates the session key in the form _app_name_session.
283
+ cookie_key = '_' + Rails.application.class.module_parent.name.underscore + '_session'
284
+
285
+ # Set user sessions to expire after 30 minutes of inactivity.
286
+ Rails.application.config.session_store :cookie_store, key: cookie_key, expire_after: 30.minutes
287
+
288
+ There is a new session timeout gem that can be used as well. It has a nice Javascript popup to let the user know that their session has expired. It can be found at: https://gitlab.com/ucb-bit/cad/aa/ucb_rails_session_timeout
289
+
290
+ ## Version 8+
291
+
292
+ This version removes both the emailing setup functionality as well as the error reporting functionality. Those are both in the [UcbRailsDefaults] (https://gitlab.com/ucb-bit/cad/aa/ucb_rails_defaults) gem. This gem's dependencies have been slimmed down so that only the basics to run the gem are required. This makes it easier to upgrade the including apps.
@@ -0,0 +1 @@
1
+ //= link_tree ../javascripts/ucb_rails_user .js
@@ -0,0 +1,12 @@
1
+ @media screen and (min-width: 768px) {
2
+ .impersonation-form {
3
+ width: 300px; } }
4
+
5
+ .recent-impersonations {
6
+ margin-top: 24px;
7
+ padding-bottom: 200px; }
8
+ .recent-impersonations ul {
9
+ padding-left: 0px; }
10
+ .recent-impersonations li {
11
+ list-style-type: none;
12
+ font-size: 110%; }
@@ -0,0 +1,41 @@
1
+ .ucb-rails-user-loader,
2
+ .ucb-rails-user-loader:after {
3
+ border-radius: 50%;
4
+ width: 6em;
5
+ height: 6em; }
6
+
7
+ .ucb-rails-user-loader {
8
+ display: none;
9
+ margin: 60px auto;
10
+ font-size: 10px;
11
+ position: relative;
12
+ text-indent: -9999em;
13
+ border-top: 0.8em solid rgba(0, 50, 97, 0.2);
14
+ border-right: 0.8em solid rgba(0, 50, 97, 0.2);
15
+ border-bottom: 0.8em solid rgba(0, 50, 97, 0.2);
16
+ border-left: .8em solid #003261;
17
+ -webkit-transform: translateZ(0);
18
+ -ms-transform: translateZ(0);
19
+ transform: translateZ(0);
20
+ -webkit-animation: load8 1.1s infinite linear;
21
+ animation: load8 1.1s infinite linear; }
22
+
23
+ @-webkit-keyframes load8 {
24
+ 0% {
25
+ -webkit-transform: rotate(0deg);
26
+ transform: rotate(0deg); }
27
+ 100% {
28
+ -webkit-transform: rotate(360deg);
29
+ transform: rotate(360deg); } }
30
+
31
+ @keyframes load8 {
32
+ 0% {
33
+ -webkit-transform: rotate(0deg);
34
+ transform: rotate(0deg); }
35
+ 100% {
36
+ -webkit-transform: rotate(360deg);
37
+ transform: rotate(360deg); } }
38
+
39
+ .ucb-rails-user-loader-small {
40
+ margin: 16px;
41
+ font-size: 6px; }
@@ -0,0 +1,54 @@
1
+ .ucb-rails-users-table-header {
2
+ margin-top: 16px;
3
+ margin-bottom: 16px; }
4
+
5
+ .ucb-rails-users-table-header a {
6
+ margin-top: 16px; }
7
+
8
+ table.ucb-rails-users-table {
9
+ border-spacing: 0px;
10
+ margin-top: 16px;
11
+ }
12
+
13
+ table.ucb-rails-users-table th {
14
+ border: 1px solid #dee2e6;
15
+ padding: 10px;
16
+ margin: 0px;
17
+ }
18
+
19
+ table.ucb-rails-users-table td {
20
+ text-align: center;
21
+ padding: 10px;
22
+ }
23
+
24
+ table.ucb-rails-users-table tr:nth-child(even) {
25
+ background-color: #00000011;
26
+ }
27
+
28
+
29
+ h1 {
30
+ font-size: 2.5rem;
31
+ }
32
+
33
+ .btn {
34
+ @apply font-bold py-2 px-4 rounded;
35
+ }
36
+ .btn-blue {
37
+ @apply bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 border border-blue-700 rounded text-white;
38
+ }
39
+
40
+ .btn-danger {
41
+ @apply bg-blue-500 text-white;
42
+ }
43
+
44
+ .ucb-rails-user > nav.pagy {
45
+ margin-top: 10px;
46
+ padding: 5px;
47
+ }
48
+
49
+ .ucb-rails-user > nav.pagy a {
50
+ padding: 5px;
51
+ border: 1px solid #99b;
52
+ padding-left: 10px;
53
+ padding-right: 10px;
54
+ }
@@ -0,0 +1 @@
1
+ @import "/user.css"
@@ -0,0 +1,21 @@
1
+ .pagy {
2
+ @apply flex space-x-1 font-semibold text-sm text-gray-500;
3
+ a:not(.gap) {
4
+ @apply block rounded-lg px-3 py-1 bg-gray-200;
5
+ &:hover {
6
+ @apply bg-gray-300;
7
+ }
8
+ &:not([href]) { /* disabled links */
9
+ @apply text-gray-300 bg-gray-100 cursor-default;
10
+ }
11
+ &.current {
12
+ @apply text-white bg-gray-400;
13
+ }
14
+ }
15
+ label {
16
+ @apply inline-block whitespace-nowrap bg-gray-200 rounded-lg px-3 py-0.5;
17
+ input {
18
+ @apply bg-gray-100 border-none rounded-md;
19
+ }
20
+ }
21
+ }
@@ -0,0 +1,29 @@
1
+ .table {
2
+ display: table;
3
+ width: 100%;
4
+ }
5
+ .table-header {
6
+ display: table-header-group;
7
+ width: auto;
8
+ }
9
+
10
+ .cell {
11
+ display: table-cell;
12
+ width: auto;
13
+ clear: both;
14
+ padding: 10px;
15
+ padding-right: 10px;
16
+ font-weight: bold;
17
+ }
18
+
19
+ .table-header > .cell {
20
+ border: 1px solid #aaa;
21
+ }
22
+
23
+ .cell:nth-of-type(even) {
24
+ background-color: #00000080;
25
+ }
26
+
27
+ .cell:nth-of-type(od) {
28
+ background-color: #fff;
29
+ }
@@ -77,6 +77,7 @@ module UcbRailsUser::AuthConcerns
77
77
  @user_session_manager ||= begin
78
78
  logger.debug "creating new user_session_manager"
79
79
  klass = UcbRailsUser[:user_session_manager] || UcbRailsUser::UserSessionManager::ActiveInUserTable
80
+ logger.debug klass.inspect
80
81
  klass.to_s.classify.constantize.new
81
82
  end
82
83
  rescue NameError
@@ -1,5 +1,6 @@
1
1
  module UcbRailsUser::UsersControllerConcerns
2
2
  extend ActiveSupport::Concern
3
+ include Pagy::Backend
3
4
 
4
5
  included do
5
6
  before_action :find_user, :only => [:edit, :update, :destroy]
@@ -8,11 +9,7 @@ module UcbRailsUser::UsersControllerConcerns
8
9
  end
9
10
 
10
11
  def index
11
- @users = UcbRailsUser.user_class.all
12
- respond_to do |format|
13
- format.html { @users = UcbRailsUser.user_class.all }
14
- format.json { render json: UcbRails::UsersDatatable.new(view_context).as_json }
15
- end
12
+ @pagy, @users = pagy(UcbRailsUser.user_class.all, limit: params[:count])
16
13
  end
17
14
 
18
15
  def search
@@ -1,5 +1,6 @@
1
1
  module UcbRailsUser
2
2
  module UsersHelper
3
+ include Pagy::Frontend
3
4
 
4
5
  def link_to_new_user
5
6
  text = 'New User'
@@ -1,17 +1,2 @@
1
- # These methods should be extracted into own gem.
2
1
  module UcbRailsUserHelper
3
-
4
- def ucbr_table_tag(*args)
5
- options = canonicalize_options(args.extract_options!)
6
-
7
- ar_class = args.first
8
- if ar_class.respond_to?(:haml_attributes)
9
- options[:id] ||= ar_class.haml_attributes["id"]
10
- options = ensure_class(options, ar_class.haml_attributes["class"])
11
- end
12
-
13
- bs_table_tag(options) do
14
- yield
15
- end
16
- end
17
2
  end
@@ -0,0 +1,6 @@
1
+ <h1>Home</h1>
2
+
3
+ <p>You are logged in as <%= current_user.full_name %></p>
4
+
5
+ <p><%= link_to "Logout", logout_path %></p>
6
+
@@ -0,0 +1,5 @@
1
+ <h1>Home</h1>
2
+
3
+ <p>You are not logged in</p>
4
+
5
+ <p><%= link_to "Login", login_path() %></p>
@@ -0,0 +1,32 @@
1
+ <h1>Impersonate user</h1>
2
+
3
+ <% if current_user.impersonating? %>
4
+ <div class="clear-impersonation">
5
+ <%= link_to "Stop impersonating #{current_user.impersonation_target.full_name}", admin_stop_impersonation_path, class: "btn btn-primary" %>
6
+ </div>
7
+ <% else %>
8
+ <div class="impersonation-form">
9
+ <%= simple_form_for UcbRailsUser::Impersonation.new, url: admin_impersonations_path, method: :post do |f| %>
10
+ <%= f.input :target, label: "User", input_html: { class: "typeahead" } %>
11
+ <%= f.input :target_id, as: :hidden %>
12
+ <%= f.button :submit, value: "Impersonate", class: "btn btn-primary", disabled: true, data: { impersonate_button: true } %>
13
+ <% end %>
14
+ </div>
15
+ <% end %>
16
+
17
+ <div class="recent-impersonations">
18
+ <% if current_user.recent_impersonations.present? %>
19
+ <h3>Recent impersonations</h3>
20
+ <ul>
21
+ <% current_user.recent_impersonations.each do |imp| %>
22
+ <li>
23
+ <%= link_to full_name_with_uid(imp.target), "#{admin_impersonations_path}?ucb_rails_user_impersonation[target_id]=#{imp.target.id}", method: :post %>
24
+ </li>
25
+ <% end %>
26
+ </ul>
27
+ <% else %>
28
+ <h4>No recent impersonations</h4>
29
+ <% end %>
30
+ </div>
31
+
32
+
@@ -0,0 +1,20 @@
1
+ <%= form_tag('/ucb_rails/ldap_person_search', class: "well form-inline", id: 'lps-form', method: :get, remote: true) do %>
2
+ <%= hidden_field_tag 'search-field-name' %>
3
+ <%= hidden_field_tag 'result-link-http-method' %>
4
+ <%= hidden_field_tag 'result-link-text' %>
5
+ <%= hidden_field_tag 'result-link-class' %>
6
+ <%= hidden_field_tag 'result-link-url' %>
7
+
8
+ <div class="form-group">
9
+ <%= label_tag 'first_name', 'First Name' %>
10
+ <%= text_field_tag 'first_name', nil, class: "form-control" %>
11
+ </div>
12
+
13
+ <div class="form-group">
14
+ <%= label_tag 'last_name', 'Last Name' %>
15
+ <%= text_field_tag 'last_name', nil, class: "form-control" %>
16
+ </div>
17
+
18
+ <%= submit_tag 'Search', id: 'lps-search' %>
19
+ <%= button_to "Clear", "#", id: 'lps-clear', method: :get %>
20
+ <% end %>
@@ -0,0 +1,15 @@
1
+ <%= modal(id: "lps-modal") do %>
2
+ <%= modal_header do %>
3
+ <h3 class="title">Search For Person</h3>
4
+ <%= render partial: "ucb_rails_user/lps/form" %>
5
+ <% end %>
6
+
7
+ <%= modal_body do %>
8
+ <div id="lps-results"></div>
9
+ <% end %>
10
+
11
+ <%= modal_footer do %>
12
+ <div id="matches" class="pull-left"></div>
13
+ <%= modal_footer_close_button %>
14
+ <% end %>
15
+ <% end %>
@@ -0,0 +1,44 @@
1
+ <div class="table-responsive ucb-rails-users-table-wrapper">
2
+ <table class="table table-striped table-bordered table-hover ucb-rails-users-table">
3
+ <thead>
4
+ <tr>
5
+ <th style="width:1%"></th>
6
+ <th>First Name</th>
7
+ <th>Last Name</th>
8
+ <th>Email</th>
9
+ <th>Department</th>
10
+ </tr>
11
+ </thead>
12
+ <tbody>
13
+ <% @lps_entries.each do |entry| %>
14
+ <% entry_id = "ldap_uid_#{entry.uid}" %>
15
+ <tr id="<%= entry_id %>" class="<%= ldap_entry_class(entry) %>">
16
+ <td><%= link_to_ldap_person_entry(entry) %></td>
17
+ <td><%= entry.first_name %></td>
18
+ <td><%= entry.last_name %></td>
19
+ <td><%= entry.email %></td>
20
+ <td><%= entry.departments %></td>
21
+ </tr>
22
+ <% end %>
23
+ </tbody>
24
+ </<table>
25
+ </div>
26
+ <% end %>
27
+
28
+ <script>
29
+ $('#lps-modal table').dataTable({
30
+ "bPaginate": false,
31
+ "bFilter": false,
32
+ "bInfo": false,
33
+ "oLanguage": {
34
+ "sEmptyTable": "No matches for your search."
35
+ },
36
+ "aaSorting": [ [1, "asc"], [2, "asc"] ],
37
+ "aoColumnDefs": [
38
+ { "bSortable": false, "aTargets": [ 0 ] }, // selection link
39
+ { "aDataSort": [ 1, 2 ], "aTargets": [ 1 ] }, // first name
40
+ { "aDataSort": [ 2, 1 ], "aTargets": [ 2 ] }, // last name
41
+ { "aDataSort": [ 3, 1, 2 ], "aTargets": [ 3 ] }, // department
42
+ ]
43
+ });
44
+ </script>
@@ -0,0 +1,5 @@
1
+ <% results = render partial: 'ucb_rails_user/lps/results' %>
2
+ <script>
3
+ $('#lps-results').html('<%= j results %>');
4
+ $('#matches').html('<%= lps_matches %>');
5
+ </script>
@@ -0,0 +1,15 @@
1
+ <%= simple_form_for(@user, url: url, method: method, html: { class: 'form-horizontal' }, wrapper: :horizontal_form) do |f| %>
2
+ <%= f.input :ldap_uid, input_html: { disabled: 'disabled' } %>
3
+ <%= f.input :first_name, input_html: { disabled: 'disabled' } %>
4
+ <%= f.input :last_name, input_html: { disabled: 'disabled' } %>
5
+ <%= f.input :email, input_html: { disabled: 'disabled' } %>
6
+ <%= f.input :alternate_email %>
7
+ <%= f.input :last_login_at, as: :string, input_html: { disabled: 'disabled', value: @user.last_login_at&.strftime("%m/%d/%Y %H:%M:%S") } %>
8
+ <%= f.input :superuser_flag, as: :boolean, label: "Superuser?", wrapper: :horizontal_boolean %>
9
+ <%= f.input :inactive_flag, as: :boolean, label: "Inactive User?", wrapper: :horizontal_boolean %>
10
+
11
+ <div class="form-actions">
12
+ <button type="submit" class="btn btn-primary">Submit</button>
13
+ <%= link_to "Cancel", admin_users_path %>
14
+ </div>
15
+ <% end %>
@@ -0,0 +1,33 @@
1
+ <h3>Search Results</h3>
2
+ <% if @results.empty? %>
3
+ <p>No results matched your search</p>
4
+ <% else %>
5
+ <table class="table table-striped add-user-search-results-table">
6
+ <thead>
7
+ <tr>
8
+ <th>UID</th>
9
+ <th>Employee ID</th>
10
+ <th>First Name</th>
11
+ <th>Last Name</th>
12
+ <th></th>
13
+ </tr>
14
+ </thead>
15
+ <tbody>
16
+ <% @results.each do |person| %>
17
+ <tr>
18
+ <td><%= person.uid %></td>
19
+ <td><%= person.employee_id %></td>
20
+ <td><%= person.first_name %></td>
21
+ <td><%= person.last_name %></td>
22
+ <td>
23
+ <%= form_tag admin_users_path, method: :post do %>
24
+ <%= hidden_field_tag :ldap_uid, person.uid %>
25
+ <%= submit_tag "Add", class: "btn btn-primary" %>
26
+ <% end %>
27
+ </td>
28
+ </tr>
29
+ <% end %>
30
+ </tbody>
31
+ </table>
32
+ <% end %>
33
+
@@ -0,0 +1,18 @@
1
+ <%= turbo_frame_tag "users" do %>
2
+ <tr id="user_<%=user.id%>" class="user">
3
+ <td><%= checkmark(user.superuser?) %></td>
4
+ <td><%= checkmark(user.inactive?) %></td>
5
+ <td><%= user.first_name %></td>
6
+ <td><%= user.last_name %></td>
7
+ <td><%= mail_to(user.email) %></td>
8
+ <td class="dt"><%= user.last_login_at&.strftime("%m/%d/%Y %H:%M:%S") %></td>
9
+ <td class="min"><%= user.ldap_uid %></td>
10
+ <td class="min"><%= user.employee_id %></td>
11
+ <td>
12
+ <%= link_to 'edit', edit_admin_user_path(user), class: 'btn btn-blue', id: dom_id(user, 'edit') %>
13
+ </td>
14
+ <td>
15
+ <%= button_to 'delete', admin_user_path(user), method: :delete, data: { confirm: "Are you sure?" }, class: "btn btn-danger" %>
16
+ </td>
17
+ </tr>
18
+ <% end %>
@@ -0,0 +1,3 @@
1
+ <h1>Edit User</h1>
2
+
3
+ <%= render partial: 'form', locals: { url: admin_user_path(@user), method: :put } %>
@@ -0,0 +1,34 @@
1
+ <div class="ucb-rails-users-table-header clearfix">
2
+ <h1>Users</h1>
3
+ </div>
4
+
5
+ <%= form_with url: "", method: :get, data: { turbo_frame: "users", turbo_action: "advance" } do |form| %>
6
+ Show <%= form.select :count, options_for_select([10, 25, 50, 100], selected: params[:count]), {}, { onchange: "this.form.requestSubmit()" } %>
7
+
8
+ Search <%= form.search_field :query, value: params[:query], oninput: "this.form.requestSubmit()" %>
9
+ <% end %>
10
+
11
+ <div class="table-responsive ucb-rails-users-table-wrapper">
12
+ <table class="table table-striped table-bordered table-hover ucb-rails-users-table">
13
+ <thead>
14
+ <tr>
15
+ <th class="min">Superuser?</th>
16
+ <th class="min">Inactive?</th>
17
+ <th>First Name</th>
18
+ <th>Last Name</th>
19
+ <th>Email</th>
20
+ <th class="dt">Last Login</th>
21
+ <th>UID</th>
22
+ <th>Employee ID</th>
23
+ <th class="min unsorted">Edit</th>
24
+ <th class="min unsorted">Delete</th>
25
+ </tr>
26
+ </thead>
27
+ <tbody class="highlight">
28
+ <%= render partial: "ucb_rails_user/users/user", collection: @users %>
29
+ </tbody>
30
+ </table>
31
+ <div class="ucb-rails-user">
32
+ <%= pagy_nav(@pagy).html_safe %>
33
+ </div>
34
+ </div>
@@ -0,0 +1,19 @@
1
+ <h2>Add New User</h2>
2
+
3
+ <%= form_tag admin_user_search_path, method: :get, remote: true, class: "form-inline user-search-form" do %>
4
+ <%= text_field_tag :first_name, "", placeholder: "First name", class: "form-control" %>
5
+ <%= text_field_tag :last_name, "", placeholder: "Last name", class: "form-control" %>
6
+ <%= text_field_tag :employee_id, "", placeholder: "Employee ID", class: "form-control" %>
7
+ <%= submit_tag "Search", class: "btn btn-primary" %>
8
+ <%= link_to "Cancel", admin_users_path, class: "btn btn-default" %>
9
+ <% end %>
10
+
11
+ <div class="ucb-rails-user-loader">
12
+ Loading...
13
+ </div>
14
+
15
+ <div class="search-results">
16
+ <% if @results %>
17
+ <%= render "results" %>
18
+ <% end %>
19
+ </div>
@@ -0,0 +1,4 @@
1
+ $('.ucb-rails-user-loader').hide();
2
+ $('.search-results').html("<%= j render(partial: 'search_results') %>");
3
+ addDatatablesToNewUserSearchResults();
4
+ $('.search-results').show();
@@ -9,65 +9,9 @@ module UcbRailsUser
9
9
  new(config)
10
10
  end
11
11
 
12
- def initialize(configuration_hash)
13
- return if configuration_hash.nil?
14
- raise(ArgumentError, "expected a Hash, got: #{configuration_hash.inspect}") unless configuration_hash.is_a?(Hash)
15
-
16
- self.hash = configuration_hash
17
- process_configuration
18
- end
19
-
20
- private
21
-
22
- def process_configuration
23
- process_default
24
- process_delivery_method
25
- process_default_url_options
26
- process_raise_delivery_errors
27
- process_sendmail_settings
28
- process_smtp_settings
29
- process_subject_prefix
30
- end
31
-
32
- # This merges values with existing values
33
- def process_default
34
- if hash.has_key?('default')
35
- ActionMailer::Base.default hash['default']
36
- end
37
- end
38
-
39
- def process_delivery_method
40
- ActionMailer::Base.delivery_method = hash.fetch('delivery_method', :smtp).to_sym
41
- end
42
-
43
- def process_default_url_options
44
- if hash.has_key?('default_url_options')
45
- ActionMailer::Base.default_url_options = hash.fetch('default_url_options').symbolize_keys
46
- end
47
- end
48
-
49
- def process_raise_delivery_errors
50
- ActionMailer::Base.raise_delivery_errors = hash.fetch('raise_delivery_errors', true)
51
- end
52
-
53
- def process_sendmail_settings
54
- if hash.has_key?('sendmail_settings')
55
- ActionMailer::Base.sendmail_settings = hash.fetch('sendmail_settings').symbolize_keys
56
- end
57
- end
58
-
59
- def process_smtp_settings
60
- if hash.has_key?('smtp_settings')
61
- ActionMailer::Base.smtp_settings = hash.fetch('smtp_settings').symbolize_keys
62
- end
63
- end
64
-
65
- def process_subject_prefix
66
- prefix = hash.fetch('subject_prefix', '')
67
- prefix = prefix.gsub("{env}", Rails.env)
68
- UcbRailsUser.config.email_subject_prefix = prefix
12
+ def initialize(_configuration_hash)
13
+ puts '***** This is not used anymore. Please use UcbRailsDefaults::Configuration::Email. Configuration will be ignored *****'
69
14
  end
70
15
  end
71
-
72
16
  end
73
17
  end
@@ -1,3 +1,8 @@
1
+ require 'propshaft'
2
+ require 'pagy'
3
+ require 'importmap-rails'
4
+ require 'turbo-rails'
5
+
1
6
  module UcbRailsUser
2
7
  class Engine < ::Rails::Engine
3
8
  config.generators do |g|
@@ -6,6 +11,15 @@ module UcbRailsUser
6
11
  g.fixture_replacement :factory_bot
7
12
  g.factory_bot dir: "spec/factories"
8
13
  end
14
+ initializer "ucb_rails_user.importmap", before: "importmap" do |app|
15
+ # NOTE: this will add pins from this engine to the main app
16
+ # https://github.com/rails/importmap-rails#composing-import-maps
17
+ app.config.importmap.paths << root.join("config/importmap.rb")
18
+
19
+ # NOTE: something about cache; I did not look into it.
20
+ # https://github.com/rails/importmap-rails#sweeping-the-cache-in-development-and-test
21
+ app.config.importmap.cache_sweepers << root.join("app/assets/javascripts")
22
+ end
9
23
  end
10
24
 
11
25
  def self.config(&block)
@@ -1,3 +1,3 @@
1
1
  module UcbRailsUser
2
- VERSION = '6.2.2'
2
+ VERSION = '8.0.0'
3
3
  end
@@ -1,7 +1,5 @@
1
1
  require "ucb_rails_user/engine"
2
2
 
3
- require "haml"
4
- require "haml-rails"
5
3
  require "omniauth"
6
4
  require "omniauth-cas"
7
5
  require "ucb_ldap"