atomic_admin 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/atomic_admin/application_controller.rb +6 -16
- data/app/controllers/atomic_admin/atomic_tenant_client_id_strategy_controller.rb +6 -1
- data/app/controllers/atomic_admin/atomic_tenant_platform_guid_strategy_controller.rb +6 -2
- data/app/controllers/atomic_admin/authenticating_application_controller.rb +18 -0
- data/lib/atomic_admin/version.rb +1 -1
- data/lib/atomic_admin.rb +7 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9fdbae3728b9807bc8477641ebd88b83a1dfb8e54dfacdbbf345c9b3eea15fea
|
4
|
+
data.tar.gz: c4a95263554cd8519ecc77629e51c1e62d54ef2f3daef0360e7b8e397cff7b11
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 58ae7a7f756d6f1f1189b29450fb5871a363eaae04af8edb72ea03da96c18bd9226b7bb2f789b1331e314cecf3c9376686927d2b39a74e10b6fac24000a7cf2e
|
7
|
+
data.tar.gz: 97b98e1fc0dac3dc691b0b095d4d74f4923e231d4786b35734a931ba59b89e356a9761b297172e9a9d7013e3be4a28e6d3b94689d68e541b17a008df87ce3380
|
@@ -1,20 +1,10 @@
|
|
1
1
|
module AtomicAdmin
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
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
|
data/lib/atomic_admin/version.rb
CHANGED
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
|
-
#
|
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.
|
4
|
+
version: 1.1.0
|
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
|
11
|
+
date: 2024-12-11 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.
|
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
|