Skip to content

Commit

Permalink
Remove redundant :: prefix from Doorkeeper constant
Browse files Browse the repository at this point in the history
  • Loading branch information
floehopper committed Oct 10, 2023
1 parent b6c4279 commit c548f11
Show file tree
Hide file tree
Showing 13 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def current_resource_owner
end

def application_making_request
@_application_making_request ||= ::Doorkeeper::Application.find(doorkeeper_token.application_id) if doorkeeper_token
@_application_making_request ||= Doorkeeper::Application.find(doorkeeper_token.application_id) if doorkeeper_token
end

private
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/root_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ class RootController < ApplicationController
skip_after_action :verify_authorized

def index
applications = ::Doorkeeper::Application.where(show_on_dashboard: true).can_signin(current_user)
applications = Doorkeeper::Application.where(show_on_dashboard: true).can_signin(current_user)

@applications_and_permissions = zip_permissions(applications, current_user)
end

def signin_required
@application = ::Doorkeeper::Application.find_by(id: session.delete(:signin_missing_for_application))
@application = Doorkeeper::Application.find_by(id: session.delete(:signin_missing_for_application))
end

def privacy_notice; end
Expand Down
2 changes: 1 addition & 1 deletion app/jobs/permission_updater.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
class PermissionUpdater < PushUserUpdatesJob
def perform(uid, application_id)
user = User.find_by(uid:)
application = ::Doorkeeper::Application.find_by(id: application_id)
application = Doorkeeper::Application.find_by(id: application_id)
# It's possible they've been deleted between when the job was scheduled and run.
return if user.nil? || application.nil?
return unless application.supports_push_updates?
Expand Down
2 changes: 1 addition & 1 deletion app/jobs/reauth_enforcer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class ReauthEnforcer < PushUserUpdatesJob
def perform(uid, application_id)
application = ::Doorkeeper::Application.find_by(id: application_id)
application = Doorkeeper::Application.find_by(id: application_id)
# It's possible the application has been deleted between when the job was scheduled and run.
return if application.nil?
return unless application.supports_push_updates?
Expand Down
2 changes: 1 addition & 1 deletion app/models/doorkeeper/application.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require "doorkeeper/orm/active_record/application"

# rubocop:disable Rails/ApplicationRecord
class ::Doorkeeper::Application < ActiveRecord::Base
class Doorkeeper::Application < ActiveRecord::Base
# rubocop:enable Rails/ApplicationRecord
has_many :supported_permissions, dependent: :destroy

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def resolve
private

def applications
::Doorkeeper::Application.includes(:supported_permissions)
Doorkeeper::Application.includes(:supported_permissions)
end
end
end
6 changes: 3 additions & 3 deletions config/initializers/doorkeeper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
# Use a custom class for generating the access token.
# See https://doorkeeper.gitbook.io/guides/configuration/other-configurations#custom-access-token-generator
#
# access_token_generator '::Doorkeeper::JWT'
# access_token_generator 'Doorkeeper::JWT'

# The controller +Doorkeeper::ApplicationController+ inherits from.
# Defaults to +ActionController::Base+ unless +api_only+ is set, which changes the default to
Expand Down Expand Up @@ -119,7 +119,7 @@
# If you wish to use another hashing implementation, you can override
# this strategy as follows:
#
# hash_token_secrets using: '::Doorkeeper::Hashing::MyCustomHashImpl'
# hash_token_secrets using: 'Doorkeeper::Hashing::MyCustomHashImpl'
#
# Keep in mind that changing the hashing function will invalidate all existing
# secrets, if there are any.
Expand All @@ -134,7 +134,7 @@
# If you wish to use bcrypt for application secret hashing, uncomment
# this line instead:
#
# hash_application_secrets using: '::Doorkeeper::SecretStoring::BCrypt'
# hash_application_secrets using: 'Doorkeeper::SecretStoring::BCrypt'

# When the above option is enabled, and a hashed token or secret is not found,
# you can allow to fall back to another strategy. For users upgrading
Expand Down
2 changes: 1 addition & 1 deletion lib/user_permissions_controller_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module UserPermissionsControllerMethods

def visible_applications(user)
if user.api_user?
applications = ::Doorkeeper::Application.includes(:supported_permissions)
applications = Doorkeeper::Application.includes(:supported_permissions)
if current_user.superadmin?
api_user_authorised_apps = user.authorisations.not_revoked.pluck(:application_id)
applications.where(id: api_user_authorised_apps)
Expand Down
2 changes: 1 addition & 1 deletion script/make_oauth_work_in_dev
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def deverise_uri(uri)
end

puts "Updating SSO config so that it works in development..."
applications = ::Doorkeeper::Application.where(retired: false)
applications = Doorkeeper::Application.where(retired: false)
applications.each do |application|
local_config = values_for_app(application)
if local_config.present?
Expand Down
2 changes: 1 addition & 1 deletion test/integration/superadmin_application_edit_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class SuperAdminApplicationEditTest < ActionDispatch::IntegrationTest

# normal user who's authorised to use app
@user = create(:user)
::Doorkeeper::AccessToken.create!(resource_owner_id: @user.id, application_id: @application.id, token: "1234")
Doorkeeper::AccessToken.create!(resource_owner_id: @user.id, application_id: @application.id, token: "1234")
end

should "be able to enable push updates to applications" do
Expand Down
2 changes: 1 addition & 1 deletion test/jobs/push_user_updates_job_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class TestJob < PushUserUpdatesJob
foo_app, _bar_app = *create_list(:application, 2)

# authenticate access
::Doorkeeper::AccessToken.create!(resource_owner_id: user.id, application_id: foo_app.id, token: "1234")
Doorkeeper::AccessToken.create!(resource_owner_id: user.id, application_id: foo_app.id, token: "1234")

assert_enqueued_with(job: TestJob, args: [user.uid, foo_app.id]) do
TestJob.perform_on(user)
Expand Down
2 changes: 1 addition & 1 deletion test/models/doorkeeper/application_test.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require "test_helper"

class ::Doorkeeper::ApplicationTest < ActiveSupport::TestCase
class Doorkeeper::ApplicationTest < ActiveSupport::TestCase
should "have a signin supported permission on create" do
assert_not_nil create(:application).signin_permission
end
Expand Down
2 changes: 1 addition & 1 deletion test/models/user_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1110,7 +1110,7 @@ def setup
end

def authenticate_access(user, app)
::Doorkeeper::AccessToken.create!(resource_owner_id: user.id, application_id: app.id)
Doorkeeper::AccessToken.create!(resource_owner_id: user.id, application_id: app.id)
end

def assert_user_has_permissions(expected_permissions, application, user)
Expand Down

0 comments on commit c548f11

Please sign in to comment.