• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

uclibs / application_portfolio / 25579460050

08 May 2026 09:04PM UTC coverage: 73.019% (+3.2%) from 69.82%
25579460050

push

circleci

web-flow
Libappo1 23 implement sso (#421)

* Add Shibboleth SSO authentication flow with environment gating.

Route production logins through Apache-backed Shibboleth, preserve existing users by email and role, auto-provision new users as active viewers, and keep local Devise login available for development/test only.

Made-with: Cursor

* Rubocop fix

* Force re-authentication with Shibboleth on production login.

Route production login links through the Shibboleth Login handler with forceAuthn so users must re-authenticate after app logout while preserving normal local Devise flow in development/test.

Made-with: Cursor

* Require first-login profile verification for Shibboleth users.

Remove self-signup entry points in Shibboleth mode, force users without department/title to complete profile details, and lock identity fields while allowing self-service department/title updates.

Made-with: Cursor

* Complete passwordless auth cleanup for routes, views, and tests.

Remove password reset routes/templates, switch local sign-in and test helpers to email-only flow, clean remaining password-related UI/test references, and refactor profile-completion guard logic to satisfy RuboCop complexity checks.

Made-with: Cursor

* Update Devise locale messaging for passwordless authentication.

Replace password-specific failure and account message text with neutral account-access wording so user-facing flash and mail subjects align with the Shibboleth-first flow.

Made-with: Cursor

* Allow profile updates without passwords in Devise registrations.

Override registration updates to use update_without_password so users can edit profile fields in the passwordless flow, and add a controller spec to prevent regressions.

Made-with: Cursor

* Redirect profile updates to dashboard and remove password wording.

Send users to the dashboard after profile edits and update the profile page action label to remove the remaining change-password reference.

Made-with: Cursor

* Add return... (continued)

156 of 158 new or added lines in 11 files covered. (98.73%)

866 of 1186 relevant lines covered (73.02%)

17.64 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

90.77
/app/controllers/users_controller.rb
1
# frozen_string_literal: true
2

3
# UsersController
4
class UsersController < ApplicationController
2✔
5
  include ApplicationHelper
2✔
6
  include SoftwareRecordsHelper
2✔
7
  before_action :retrieve_user, only: %i[show edit update destroy user_status]
2✔
8
  before_action :authenticate_user!
2✔
9
  before_action :navigation, except: %i[edit update]
2✔
10
  before_action :ensure_self_or_admin, only: %i[edit update]
2✔
11
  access root_admin: :all,
2✔
12
         manager: %i[edit update], owner: %i[edit update], viewer: %i[edit update], user: %i[edit update],
13
         message: 'Permission Denied ! <br/> Please contact the administrator for more info.'
14
  helper_method :sort_column, :sort_direction
2✔
15

16
  def index
2✔
17
    @users = User.order("#{sort_column} #{sort_direction}")
4✔
18
    @active = 'users'
4✔
19
    $page_title = 'Manage Users | UCL Application Portfolio'
4✔
20
  end
21

22
  def edit
2✔
23
    $page_title = 'Edit Users | UCL Application Portfolio'
2✔
24
    @safe_return_to = safe_return_to_path
2✔
25
    render :edit
2✔
26
  end
27

28
  def update
2✔
29
    $page_title = 'Edit Users | UCL Application Portfolio'
8✔
30
    if current_user.role.to_s == 'root_admin'
8✔
31
      @user.first_name = params[:first_name]
4✔
32
      @user.last_name = params[:last_name]
4✔
33
      @user.email = params[:email]
4✔
34
      @user.roles = params[:roles]
4✔
35
      @user.active = params[:active]
4✔
36
    end
37

38
    @user.title = params[:title]
8✔
39
    @user.department = params[:department]
8✔
40

41
    if !@user.changed?
8✔
42
      redirect_to redirect_target_after_update, notice: 'No changes were made.'
2✔
43
    elsif @user.save
6✔
44
      redirect_to redirect_target_after_update, notice: 'User was successfully updated.'
6✔
45
    else
46
      render :edit
×
47
    end
48
  end
49

50
  def show
2✔
51
    $page_title = "#{@user.first_name} #{@user.last_name} | UCL Application Portfolio"
2✔
52
    render :show
2✔
53
  end
54

55
  def retrieve_user
2✔
56
    @user = User.find(params[:id])
18✔
57
    @controller = params[:controller]
18✔
58
  end
59

60
  def user_status
2✔
61
    if @user.active.to_s == 'true'
4✔
62
      @user.active = false
4✔
63
      @user.save
4✔
64
      redirect_to users_show_path(params[:id]), notice: 'User was successfully de-activated.'
4✔
65
    else
66
      @user.active = true
×
67
      @user.save
×
68
      redirect_to users_show_path(params[:id]), notice: 'User was successfully activated.'
×
69
    end
70
  end
71

72
  def destroy
2✔
73
    if @user.destroy
2✔
74
      redirect_to session[:previous], notice: 'User was successfully deleted.'
2✔
75
    else
76
      render :index
×
77
    end
78
  end
79

80
  private
2✔
81

82
  def sort_column
2✔
83
    User.column_names.include?(params[:sort]) ? params[:sort] : 'first_name'
8✔
84
  end
85

86
  def sort_direction
2✔
87
    %w[asc desc].include?(params[:direction]) ? params[:direction] : 'asc'
8✔
88
  end
89

90
  def ensure_self_or_admin
2✔
91
    return if current_user.role.to_s == 'root_admin' || current_user.id == @user.id
10✔
92

NEW
93
    redirect_to dashboard_path, alert: 'Permission Denied ! <br/> Please contact the administrator for more info.'
×
94
  end
95

96
  def redirect_target_after_update
2✔
97
    return_to = safe_return_to_path
8✔
98
    return return_to if return_to.present?
8✔
99
    return myprofile_path if current_user.id == @user.id
6✔
100

101
    users_show_path(params[:id])
2✔
102
  end
103

104
  def safe_return_to_path
2✔
105
    url_from(params[:return_to])
10✔
106
  end
107
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc