atomic_admin 1.0.0 → 1.1.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7126d05e212a74be4e464d09c3762b609af1d5dd5766dbeb1ca6f851bf2467f2
4
- data.tar.gz: da655344ed3ae495fb69d4ea486f14646971e8d6787751b879f13ff8830a6ee5
3
+ metadata.gz: b625a67a9d862fc3a6de28702d21bcff133db94852681e71e53fb5550dc34b7b
4
+ data.tar.gz: 70ba323f076abdfcf245005cbfcdb55c882866bb1626ceab0909591b8afd1904
5
5
  SHA512:
6
- metadata.gz: 446925f0ee4be4be1894558e28a4eacbe01650d50e252030d5220fc093bf056f96873762c93c6a38ec06861d0a2cf58c4554d673b4b5d853b34d4d3485827a5c
7
- data.tar.gz: '062380e349f098af9ece86a42154415e2d52b117cfb1d75677afac4a825ddee0e40ffc86905b4fae6f77bf2d4b78cac5a48cacbe03839baf6dc125f1f3b69c3f'
6
+ metadata.gz: 405ba65b9b8ad2d229b89a3d4f176173af15cc42005685d403b9b1524b0902701103ee8a49b2bb6c1013b37d097cc3495c70dec02e9a1a6266fbd3a52193720e
7
+ data.tar.gz: b2006e527199b2619ba4809b99d41e99e999fff209bd731413ae7647bcba13f5a9fb4beb95af9a1c69308120fda89fd7603d16eee97f01c07cf7a04f15dfff80
@@ -1,20 +1,10 @@
1
1
  module AtomicAdmin
2
- class ApplicationController < ActionController::API
3
- include AtomicAdmin::JwtToken
4
- # before_action :authenticate_user! # Use validate_token instead for now
5
- before_action :validate_token
6
- before_action :only_admins!
7
-
8
- private
9
-
10
- def only_admins!
11
- user_not_authorized unless current_user.admin?
12
- end
13
-
14
-
15
- def user_not_authorized(message = "Not Authorized")
16
- render json: { message: message, }, status: 401
17
- end
2
+ BASE_CONTROLLER = if AtomicAdmin.authenticating_base_controller_class
3
+ AtomicAdmin.authenticating_base_controller_class.constantize
4
+ else
5
+ AtomicAdmin::AuthenticatingApplicationController
6
+ end
18
7
 
8
+ class ApplicationController < BASE_CONTROLLER
19
9
  end
20
10
  end
@@ -1,5 +1,10 @@
1
1
  module AtomicAdmin
2
2
  class AtomicTenantClientIdStrategyController < ApplicationController
3
+
4
+ if AtomicAdmin.client_id_strategy_before_action.present?
5
+ before_action AtomicAdmin.client_id_strategy_before_action, only: [:create, :update]
6
+ end
7
+
3
8
  def pinned_client_id_params
4
9
  params.permit(:iss, :client_id, :application_instance_id)
5
10
  end
@@ -8,7 +13,7 @@ module AtomicAdmin
8
13
  AtomicTenant::PinnedClientId.find_by(id: params[:id])
9
14
  end
10
15
 
11
- def search
16
+ def search
12
17
  page = AtomicTenant::PinnedClientId
13
18
  .where(application_instance_id: params[:application_instance_id])
14
19
  .order(:id).paginate(page: params[:page], per_page: 30)
@@ -1,5 +1,9 @@
1
1
  module AtomicAdmin
2
2
  class AtomicTenantPlatformGuidStrategyController < ApplicationController
3
+ if AtomicAdmin.platform_guid_strategy_before_action.present?
4
+ before_action AtomicAdmin.platform_guid_strategy_before_action, only: [:create, :update]
5
+ end
6
+
3
7
  def pinned_platform_guid_params
4
8
  params.permit(:iss, :platform_guid, :application_id, :application_instance_id)
5
9
  end
@@ -8,7 +12,7 @@ module AtomicAdmin
8
12
  AtomicTenant::PinnedPlatformGuid.find(params[:id])
9
13
  end
10
14
 
11
- def search
15
+ def search
12
16
  page = AtomicTenant::PinnedPlatformGuid
13
17
  .where(application_instance_id: params[:application_instance_id])
14
18
  .order(:id).paginate(page: params[:page], per_page: 30)
@@ -19,7 +23,7 @@ module AtomicAdmin
19
23
  }
20
24
  end
21
25
 
22
- # def index
26
+ # def index
23
27
  # page = AtomicTenant::PinnedPlatformGuid.all.order(:id).paginate(page: params[:page], per_page: 30)
24
28
  # render json: {
25
29
  # pinned_platform_guids: page,
@@ -0,0 +1,18 @@
1
+ module AtomicAdmin
2
+ class AuthenticatingApplicationController < ActionController::API
3
+ include AtomicAdmin::JwtToken
4
+ # before_action :authenticate_user! # Use validate_token instead for now
5
+ before_action :validate_token
6
+ before_action :only_admins!
7
+
8
+ private
9
+
10
+ def only_admins!
11
+ user_not_authorized unless current_user.admin?
12
+ end
13
+
14
+ def user_not_authorized(message = "Not Authorized")
15
+ render json: { message: message, }, status: 401
16
+ end
17
+ end
18
+ end
@@ -1,3 +1,3 @@
1
1
  module AtomicAdmin
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.1"
3
3
  end
data/lib/atomic_admin.rb CHANGED
@@ -3,5 +3,11 @@ require "atomic_admin/engine"
3
3
  require "atomic_admin/jwt_token"
4
4
 
5
5
  module AtomicAdmin
6
- # Your code goes here...
6
+ # Base controller class to inherit from. If this is set it is responsible for
7
+ # all authentication
8
+ mattr_accessor :authenticating_base_controller_class, default: nil
9
+
10
+ # Before action hooks to allow custom validation
11
+ mattr_accessor :client_id_strategy_before_action, default: nil
12
+ mattr_accessor :platform_guid_strategy_before_action, default: nil
7
13
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: atomic_admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Benoit
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-11-19 00:00:00.000000000 Z
11
+ date: 2025-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -46,6 +46,7 @@ files:
46
46
  - app/controllers/atomic_admin/atomic_tenant_client_id_strategy_controller.rb
47
47
  - app/controllers/atomic_admin/atomic_tenant_deployment_controller.rb
48
48
  - app/controllers/atomic_admin/atomic_tenant_platform_guid_strategy_controller.rb
49
+ - app/controllers/atomic_admin/authenticating_application_controller.rb
49
50
  - app/jobs/atomic_admin/application_job.rb
50
51
  - app/mailers/atomic_admin/application_mailer.rb
51
52
  - app/models/atomic_admin/application_record.rb
@@ -77,7 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
77
78
  - !ruby/object:Gem::Version
78
79
  version: '0'
79
80
  requirements: []
80
- rubygems_version: 3.4.19
81
+ rubygems_version: 3.4.10
81
82
  signing_key:
82
83
  specification_version: 4
83
84
  summary: Engine to provide apis that power the atomic jolt admin app