Skip to content
Open
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
d50a5e0
Add api folder and committee api controller
jvitorbarros15 Jan 16, 2026
2b9cead
updated controller, added routes and added a format_committees helper…
usmannsiddiqui Jan 20, 2026
c6fd0cb
Add Render JSON and keys to_s
jvitorbarros15 Jan 20, 2026
215cc48
Api key set in .envrc
usmannsiddiqui Jan 20, 2026
6cbd4ce
Removed some .md docs from version control
usmannsiddiqui Jan 20, 2026
15d9cf1
Merge main
jvitorbarros15 Feb 2, 2026
ccbad19
Replace ENV API key auth with ExternalApp token authentication and ad…
jvitorbarros15 Feb 2, 2026
77caf9a
Rubocop Corrections
jvitorbarros15 Feb 2, 2026
06f70e2
Add committee_role_normalizer and request specs
jvitorbarros15 Feb 3, 2026
2a81bc6
Merge branch 'main' into api-controller
jvitorbarros15 Feb 3, 2026
1e5aa60
Fix Student name with student_fname and student_lname and add interna…
jvitorbarros15 Feb 3, 2026
4dc14fe
Remove normalizer and moved it to FAMS_TOOL
jvitorbarros15 Feb 4, 2026
214bb98
Simplified Routes for API and add basic spec for committee_records_co…
jvitorbarros15 Feb 4, 2026
3e1dce5
Refactor committee formatting to reduce RuboCop complexity
jvitorbarros15 Feb 4, 2026
e3f5d38
Merge branch 'main' into api-controller
jvitorbarros15 Feb 4, 2026
c822da2
Simplified the API controller objects and add join scope methods
jvitorbarros15 Feb 5, 2026
7d949d6
Add more rspec tests for API controller
jvitorbarros15 Feb 9, 2026
481d26b
Merge main
jvitorbarros15 Feb 9, 2026
d608160
Add request specs for committee records response structure
jvitorbarros15 Feb 9, 2026
4718825
Add request spec for multiple committee memberships response
jvitorbarros15 Feb 10, 2026
2e93edf
Add gem rswag
jvitorbarros15 Feb 12, 2026
553e627
Add rswag initial documentation
jvitorbarros15 Feb 12, 2026
8ace73c
Add rswag docs with auth (working)
jvitorbarros15 Feb 19, 2026
2e9f672
Fix rswag spec (All tests passing)
jvitorbarros15 Feb 20, 2026
05943a8
Rubocop corrections
jvitorbarros15 Feb 20, 2026
b40fe34
added a class for fams tools
madhurakhandkar Feb 24, 2026
049a3a5
Add the Rswag documentation back, move gem rswag to global scope, rem…
jvitorbarros15 Feb 24, 2026
f764690
Merge branch 'api-controller' of https://github.com/psu-libraries/etd…
madhurakhandkar Feb 24, 2026
b02b68e
Resolve merge conflict in committee_records_spec.rb, keeping remote c…
madhurakhandkar Feb 24, 2026
f8df7f4
Fix RuboCop Rswag DSL issues, exclude Rswag spec from problematic cop…
jvitorbarros15 Feb 25, 2026
14f3b55
Remove more comments froom api controller
jvitorbarros15 Feb 25, 2026
42d7a5b
Resolve merge conflict in routes.rb and keep admin mounts for Sidekiq…
jvitorbarros15 Feb 25, 2026
5634d04
Merge branch 'api-controller' of https://github.com/psu-libraries/etd…
jvitorbarros15 Feb 25, 2026
42b3050
Remove response 400 using x-api-key from committee_records_spec
jvitorbarros15 Feb 25, 2026
1938712
Switch committee records API auth from Bearer token to X-API-KEY header
usmannsiddiqui Feb 26, 2026
817af32
Rubocop corrections
jvitorbarros15 Feb 27, 2026
ff06adf
Fix committee_records_controller_spec.rb changing the authorization h…
jvitorbarros15 Feb 27, 2026
45d1dbe
Enable swagger_filter to dynamically set host from request
usmannsiddiqui Mar 17, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,4 @@ config/settings/*.local.yml
config/environments/*.local.yml

/config/master.key
docs/development/
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ group :development, :test do
# Coverage report
gem 'simplecov', '~> 0.17.0'
gem 'mutex_m'
# API documentation
gem 'rswag'
Comment on lines +99 to +100
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will actually need to be moved up into the global scope. This is why CI is failing, the RSwag engine is used to display the documentation in production, but we don't have it installing in production environments.

end

group :development do
Expand Down
19 changes: 19 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,9 @@ GEM
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
json (2.16.0)
json-schema (6.1.0)
addressable (~> 2.8)
bigdecimal (>= 3.1, < 5)
jwt (2.10.1)
base64
language_server-protocol (3.17.0.5)
Expand Down Expand Up @@ -402,6 +405,21 @@ GEM
rspec-retry (0.6.2)
rspec-core (> 3.3)
rspec-support (3.13.2)
rswag (2.17.0)
rswag-api (= 2.17.0)
rswag-specs (= 2.17.0)
rswag-ui (= 2.17.0)
rswag-api (2.17.0)
activesupport (>= 5.2, < 8.2)
railties (>= 5.2, < 8.2)
rswag-specs (2.17.0)
activesupport (>= 5.2, < 8.2)
json-schema (>= 2.2, < 7.0)
railties (>= 5.2, < 8.2)
rspec-core (>= 2.14)
rswag-ui (2.17.0)
actionpack (>= 5.2, < 8.2)
railties (>= 5.2, < 8.2)
rubocop (1.81.7)
json (~> 2.3)
language_server-protocol (~> 3.17.0.2)
Expand Down Expand Up @@ -599,6 +617,7 @@ DEPENDENCIES
rsolr (~> 2.5.0)
rspec-rails (~> 7.0.0)
rspec-retry (~> 0.6.0)
rswag
sassc-rails (~> 2.1.2)
seedbank (~> 0.5.0)
selenium-webdriver (~> 4.26)
Expand Down
111 changes: 111 additions & 0 deletions app/controllers/api/v1/committee_records_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
module Api
module V1
class CommitteeRecordsController < ApplicationController
# Skip CSRF token verification for API requests
skip_before_action :verify_authenticity_token

# Authentication filter
before_action :authenticate_api_key

# POST /api/v1/committee_records/faculty_committees
# Expected params: { access_id: "xyz123" }
# Returns: JSON with all committee memberships for the faculty member
#
# Example request:
# curl -X POST http://localhost:3000/api/v1/committee_records/faculty_committees \
# -H "Content-Type: application/json" \
# -H "Authorization: Bearer your_token_here"\
# -d '{"access_id": "aab27"}'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have swagger documentation now, so these comments are redundant. Also, a lot of the comments in this class are redundant. If the code speaks for itself, you don't need comments. It would be best to remove them.


def faculty_committees
access_id = params[:access_id]
# Validate required parameter
if access_id.blank?
render json: { error: 'access_id is required' }, status: :bad_request
return
end

# Find all committee memberships for this faculty member
# Note: We search by access_id which is the PSU ID
committee_memberships = CommitteeMember
.joins(:submission).where('submissions.status LIKE "released for publication%" OR submissions.status = "waiting for publication release"')
.includes(:committee_role, submission: [:author, :degree, :program])
.where(access_id: access_id)

render json: {
faculty_access_id: access_id,
committees: format_committees(committee_memberships)
}, status: :ok
rescue StandardError => e
render json: { error: e.message }, status: :internal_server_error
end

private

# Authenticate using API Key from environment variable
# The API Key should be passed in the Authorization header
def authenticate_api_key
raw = request.headers["Authorization"].to_s.strip

token =
if raw.downcase.start_with?("bearer ")
raw.split(" ", 2).last.to_s.strip
else
raw
end

@api_token = ApiToken.includes(:external_app).find_by(token: token)
return unauthorized! unless @api_token

@external_app = @api_token.external_app
@api_token.update_column(:last_used_at, Time.current)

true
end

def unauthorized!
render json: { error: "Unauthorized" }, status: :unauthorized
end

def format_committees(committee_memberships)
committee_memberships.map { |membership| committee_payload(membership) }
end

def committee_payload(membership)
submission = membership.submission
author = submission&.author

# Build the committee data object
{
# Committee member info
committee_member_id: membership.id,

# Committee role
role: membership.committee_role&.name,
role_code: membership.committee_role&.code,

# Student information
student_fname: author&.first_name,
student_lname: author&.last_name,
student_access_id: author&.access_id,

# Submission information
submission_id: submission.id,
title: submission.title,
degree_name: submission.degree&.name,
program_name: submission.program&.name,
semester: submission.semester,
year: submission.year,

# Important dates
approval_started_at: membership.approval_started_at,
final_submission_approved_at: submission.final_submission_approved_at,

# Status information
submission_status: submission.status,
committee_member_status: membership.status
}
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<div>
<h3 class='control-label mb-3'> <%= I18n.t("#{current_partner.id}.accessible_version_heading")%></h3>
<p> <%= I18n.t("#{current_partner.id}.accessible_version_notice")%> </p>
</div>
4 changes: 4 additions & 0 deletions app/views/author/submissions/edit_final_submission.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@
<%= render partial: '/shared/federal_funding_checkbox', locals: {f: f} %>
<% end %>

<% unless current_partner.sset? %>
<%= render partial: 'accessible_version_disclaimer' %>
<% end %>

<%= render 'shared/copyright_statement' %>
<%= f.input :has_agreed_to_terms, label: 'I agree to copyright statement', as: :boolean, wrapper: :vertical_boolean, required: true %>

Expand Down
14 changes: 14 additions & 0 deletions config/initializers/rswag_api.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Rswag::Api.configure do |c|

# Specify a root folder where Swagger JSON files are located
# This is used by the Swagger middleware to serve requests for API descriptions
# NOTE: If you're using rswag-specs to generate Swagger, you'll need to ensure
# that it's configured to generate files in the same folder
c.openapi_root = Rails.root.to_s + '/swagger'

# Inject a lambda function to alter the returned Swagger prior to serialization
# The function will have access to the rack env for the current request
# For example, you could leverage this to dynamically assign the "host" property
#
#c.swagger_filter = lambda { |swagger, env| swagger['host'] = env['HTTP_HOST'] }
end
16 changes: 16 additions & 0 deletions config/initializers/rswag_ui.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Rswag::Ui.configure do |c|

# List the Swagger endpoints that you want to be documented through the
# swagger-ui. The first parameter is the path (absolute or relative to the UI
# host) to the corresponding endpoint and the second is a title that will be
# displayed in the document selector.
# NOTE: If you're using rspec-api to expose Swagger files
# (under openapi_root) as JSON or YAML endpoints, then the list below should
# correspond to the relative paths for those endpoints.

c.swagger_endpoint '/api-docs/v1/swagger.yaml', 'API V1 Docs'

# Add Basic Auth in case your API is private
# c.basic_auth_enabled = true
# c.basic_auth_credentials 'username', 'password'
end
5 changes: 5 additions & 0 deletions config/locales/partners/en/graduate/graduate.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,11 @@ en:
message: "Before proceeding to your final submission, you must pay the $10 thesis fee. The fee can be paid at the <a href='https://secure.gradsch.psu.edu/paymentportal/' target='_blank'>Payment Section</a> of the Fox Graduate School Thesis and Dissertation Information <a href='https://gradschool.psu.edu/completing-your-degree/thesis-and-dissertation-information/' target='_blank'>webpage</a>."
dissertation:
message: "Before proceeding to your final submission, you must pay the $50 dissertation fee. The fee can be paid at the <a href='https://secure.gradsch.psu.edu/paymentportal/' target='_blank'>Payment Section</a> of the Fox Graduate School Thesis and Dissertation Information <a href='https://gradschool.psu.edu/completing-your-degree/thesis-and-dissertation-information/' target='_blank'>webpage</a>."
accessible_version_heading: 'Accessible Version Generation Privacy Notice'
accessible_version_notice: |
When your PDF is downloaded for the first time, an accessible version will be created to meet ADA Title II requirements.
Your file will be temporarily processed by Adobe to generate an accessible format.
Images will be temporarily sent to AWS Bedrock for AI-generated alt-text.
admin:
umg: 'cn=umg/psu.sas.etda-graduate-admins,dc=psu,dc=edu'
submission:
Expand Down
5 changes: 5 additions & 0 deletions config/locales/partners/en/honors/honors.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,11 @@ en:
restricted_attr:
description_html: 'The option selected secures the body of the thesis for a period of two years. Selection of this option requires that an invention disclosure (ID) be filed with the Office of Technology Management (OTM) prior to submission of the final honors thesis and confirmed by OTM. At the end of the two-year period, the work will be released automatically for open access unless a written request is made to extend this option for an additional year. The written request for an extension should be sent 30 days prior to the end of the two-year period to the Honors College Records Department, 10 Schreyer Honors College, The Pennsylvania State University, University Park, PA 16802, or by e-mail to %{link}. Please note: No one will be able to view your work under this option.'
scope: final_withheld
accessible_version_heading: 'Accessible Version Generation Privacy Notice'
accessible_version_notice: |
When your PDF is downloaded for the first time, an accessible version will be created to meet ADA Title II requirements.
Your file will be temporarily processed by Adobe to generate an accessible format.
Images will be temporarily sent to AWS Bedrock for AI-generated alt-text.
download:
login_html: 'Login using your Penn State access account to view the paper.'
approver:
Expand Down
5 changes: 5 additions & 0 deletions config/locales/partners/en/milsch/milsch.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,11 @@ en:
scope: final_withheld
download:
login_html: 'Login using your Penn State access account to view the paper.'
accessible_version_heading: 'Accessible Version Generation Privacy Notice'
accessible_version_notice: |
When your PDF is downloaded for the first time, an accessible version will be created to meet ADA Title II requirements.
Your file will be temporarily processed by Adobe to generate an accessible format.
Images will be temporarily sent to AWS Bedrock for AI-generated alt-text.
approver:
review_form:
file_list_heading: "Files I need to review:"
Expand Down
15 changes: 12 additions & 3 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
require 'sidekiq/web'

Rails.application.routes.draw do
mount Rswag::Api::Engine => '/api-docs'
mount Rswag::Ui::Engine => '/api-docs'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you can get this to work, moving this into the :admin namespace and wrapping it in :admin authentication would be ideal. We don't need this to be public.


devise_for :approvers, path: 'approver'
devise_for :authors, path: 'author'
Expand All @@ -18,10 +20,14 @@

get '/', to: redirect(path: '/main')

mount Sidekiq::Web => '/sidekiq'

mount OkComputer::Engine, at: "/healthcheck"

namespace :api do
namespace :v1 do
post "committee_records/faculty_committees"
end
end

## works: get '/committee_members/autocomplete', to: 'ldap_lookup#autocomplete', as: :committee_members_autocomplete
get '/committee_members/autocomplete', to: 'application#autocomplete', as: :committee_members_autocomplete

Expand All @@ -43,6 +49,10 @@
resources :approval_configurations, except: [:new, :create, :destroy]
resources :authors, except: [:new, :create, :show, :destroy]

authenticate :admin do
mount Sidekiq::Web => '/sidekiq'
end
Comment on lines 49 to 53
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some things in here that aren't a part of your changes. Have you merged recent changes from main in recently?


get '/custom_report', to: 'reports#custom_report_index', as: :custom_report_index
patch '/custom_report_export', to: 'reports#custom_report_export', defaults: { format: 'csv' }, as: :custom_report_export
get '/committee_report', to: 'reports#committee_report_index', as: :committee_report_index
Expand All @@ -53,7 +63,6 @@
patch '/committee_member_report_export', to: 'reports#committee_member_report_export', defaults: { format: 'csv' }, as: :committee_member_report_export
patch '/graduate_data_report_export', to: 'reports#graduate_data_report_export', defaults: { format: 'json' }, as: :graduate_data_report_export


get '/authors/contact_list', to: 'authors#email_contact_list', as: :email_contact_list

get '/submissions/:id/edit', to: 'submissions#edit', as: :edit_submission
Expand Down
8 changes: 4 additions & 4 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@
t.index ["name"], name: "index_degrees_on_name", unique: true
end

create_table "external_apps", charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t|
create_table "external_apps", charset: "utf8mb4", force: :cascade do |t|
t.string "name"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
Expand Down Expand Up @@ -277,7 +277,7 @@
t.index ["name", "code"], name: "index_programs_on_name_and_code", unique: true
end

create_table "remediated_final_submission_files", charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t|
create_table "remediated_final_submission_files", charset: "utf8mb4", force: :cascade do |t|
t.bigint "submission_id", null: false
t.bigint "final_submission_file_id", null: false
t.text "asset"
Expand Down Expand Up @@ -342,9 +342,9 @@
t.string "lionpath_semester"
t.string "academic_program"
t.string "degree_checkout_status"
t.datetime "author_release_warning_sent_at", precision: nil
t.datetime "acknowledgment_page_submitted_at", precision: nil
t.string "candidate_number"
t.datetime "acknowledgment_page_submitted_at", precision: nil
t.datetime "author_release_warning_sent_at", precision: nil
t.string "extension_token"
t.datetime "last_lionpath_export_at", precision: nil
t.index ["author_id"], name: "submissions_author_id_fk"
Expand Down
Loading