Skip to content

Commit

Permalink
[CPDLP-3843] Remove token access for NPQ (NPQ Post Separation Cleanup)
Browse files Browse the repository at this point in the history
  • Loading branch information
leandroalemao committed Dec 19, 2024
1 parent b003427 commit 431ef8d
Show file tree
Hide file tree
Showing 10 changed files with 2 additions and 37 deletions.
5 changes: 0 additions & 5 deletions app/controllers/api/v1/ecf_participants_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,6 @@ def ecf_participant_params
params.permit(:id, filter: %i[cohort updated_since])
end

def access_scope
LeadProviderApiToken
.joins(cpd_lead_provider: [:lead_provider])
end

def lead_provider
current_user.lead_provider
end
Expand Down
6 changes: 0 additions & 6 deletions app/controllers/api/v1/participants_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@ module V1
class ParticipantsController < Api::ApiController
include ApiTokenAuthenticatable
include ParticipantActions

private

def access_scope
LeadProviderApiToken.joins(cpd_lead_provider: [:lead_provider])
end
end
end
end
4 changes: 0 additions & 4 deletions app/controllers/api/v3/delivery_partners_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@ def delivery_partner_params
.permit(:id, :sort, filter: %i[cohort])
end

def access_scope
LeadProviderApiToken.joins(cpd_lead_provider: [:lead_provider])
end

def serializer_class
Api::V3::DeliveryPartnerSerializer
end
Expand Down
4 changes: 0 additions & 4 deletions app/controllers/api/v3/ecf/partnerships_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,6 @@ def ecf_partnership_params
.permit(:id, :sort, filter: %i[cohort updated_since delivery_partner_id])
end

def access_scope
LeadProviderApiToken.joins(cpd_lead_provider: [:lead_provider])
end

def serializer_class
Api::V3::ECF::PartnershipSerializer
end
Expand Down
4 changes: 0 additions & 4 deletions app/controllers/api/v3/ecf/schools_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ def ecf_schools_query
)
end

def access_scope
LeadProviderApiToken.joins(cpd_lead_provider: [:lead_provider])
end

def serializer_class
Api::V3::ECF::SchoolSerializer
end
Expand Down
4 changes: 0 additions & 4 deletions app/controllers/api/v3/ecf/transfers_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@ def ecf_transfer_params
.permit(:participant_id, filter: %i[updated_since])
end

def access_scope
LeadProviderApiToken.joins(cpd_lead_provider: [:lead_provider])
end

def serializer_class
TransferSerializer
end
Expand Down
4 changes: 0 additions & 4 deletions app/controllers/api/v3/ecf/unfunded_mentors_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ def ecf_unfunded_mentors_query
)
end

def access_scope
LeadProviderApiToken.joins(cpd_lead_provider: [:lead_provider])
end

def serializer_class
Api::V3::ECF::UnfundedMentorSerializer
end
Expand Down
4 changes: 0 additions & 4 deletions app/controllers/api/v3/participant_declarations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,6 @@ def participant_declaration_for_lead_provider
@participant_declaration_for_lead_provider ||= ParticipantDeclaration.for_lead_provider(cpd_lead_provider).find(params[:id])
end

def access_scope
LeadProviderApiToken.joins(cpd_lead_provider: [:lead_provider]) + LeadProviderApiToken.joins(cpd_lead_provider: [:npq_lead_provider])
end

def serializer_class
ParticipantDeclarationSerializer
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/concerns/api_token_authenticatable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@ def check_access_scope
end

def access_scope
ApiToken.all
LeadProviderApiToken.joins(cpd_lead_provider: [:lead_provider])
end
end
2 changes: 1 addition & 1 deletion spec/requests/api/v3/statements_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require "rails_helper"

RSpec.describe "statements endpoint spec", type: :request do
let(:cpd_lead_provider) { create(:cpd_lead_provider) }
let(:cpd_lead_provider) { create(:cpd_lead_provider, :with_lead_provider) }
let(:token) { LeadProviderApiToken.create_with_random_token!(cpd_lead_provider:) }
let(:bearer_token) { "Bearer #{token}" }

Expand Down

0 comments on commit 431ef8d

Please sign in to comment.