atomic_admin 0.1.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7126d05e212a74be4e464d09c3762b609af1d5dd5766dbeb1ca6f851bf2467f2
|
4
|
+
data.tar.gz: da655344ed3ae495fb69d4ea486f14646971e8d6787751b879f13ff8830a6ee5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 446925f0ee4be4be1894558e28a4eacbe01650d50e252030d5220fc093bf056f96873762c93c6a38ec06861d0a2cf58c4554d673b4b5d853b34d4d3485827a5c
|
7
|
+
data.tar.gz: '062380e349f098af9ece86a42154415e2d52b117cfb1d75677afac4a825ddee0e40ffc86905b4fae6f77bf2d4b78cac5a48cacbe03839baf6dc125f1f3b69c3f'
|
@@ -2,15 +2,12 @@ module AtomicAdmin
|
|
2
2
|
class ApplicationController < ActionController::API
|
3
3
|
include AtomicAdmin::JwtToken
|
4
4
|
# before_action :authenticate_user! # Use validate_token instead for now
|
5
|
-
before_action :validate_admin_app_token
|
6
5
|
before_action :validate_token
|
7
6
|
before_action :only_admins!
|
8
7
|
|
9
8
|
private
|
10
9
|
|
11
10
|
def only_admins!
|
12
|
-
return if @admin_app_validated
|
13
|
-
|
14
11
|
user_not_authorized unless current_user.admin?
|
15
12
|
end
|
16
13
|
|
@@ -9,35 +9,38 @@ module AtomicAdmin
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def search
|
12
|
-
tenant_deployments = AtomicTenant::LtiDeployment
|
13
|
-
|
14
|
-
.
|
15
|
-
|
12
|
+
tenant_deployments = AtomicTenant::LtiDeployment.
|
13
|
+
where(application_instance_id: params[:application_instance_id]).
|
14
|
+
joins("LEFT OUTER JOIN public.atomic_lti_deployments"\
|
15
|
+
" ON atomic_tenant_lti_deployments.iss = atomic_lti_deployments.iss"\
|
16
|
+
" AND atomic_tenant_lti_deployments.deployment_id = atomic_lti_deployments.deployment_id").
|
17
|
+
order(:id).
|
18
|
+
paginate(page: params[:page], per_page: 30)
|
16
19
|
|
17
|
-
|
20
|
+
rows = tenant_deployments.pluck(
|
21
|
+
"atomic_tenant_lti_deployments.id",
|
22
|
+
"atomic_tenant_lti_deployments.iss",
|
23
|
+
"atomic_tenant_lti_deployments.deployment_id",
|
24
|
+
"atomic_tenant_lti_deployments.application_instance_id",
|
25
|
+
"atomic_lti_deployments.client_id",
|
26
|
+
"atomic_lti_deployments.platform_guid",
|
27
|
+
)
|
18
28
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
page = pairs.reduce([]) do |acc, pair|
|
30
|
-
iss = pair[0]
|
31
|
-
deployment_ids = pair[1]
|
32
|
-
|
33
|
-
deployments = AtomicLti.get_deployments(iss: iss, deployment_ids: deployment_ids)
|
34
|
-
acc.concat(deployments)
|
29
|
+
page = rows.map do |row|
|
30
|
+
{
|
31
|
+
id: row[0],
|
32
|
+
iss: row[1],
|
33
|
+
deployment_id: row[2],
|
34
|
+
application_instance_id: row[3],
|
35
|
+
client_id: row[4],
|
36
|
+
platform_guid: row[5],
|
37
|
+
}
|
35
38
|
end
|
36
39
|
|
37
40
|
render json: {
|
38
41
|
deployments: page,
|
39
42
|
page: params[:page],
|
40
|
-
total_pages: tenant_deployments.total_pages
|
43
|
+
total_pages: tenant_deployments.total_pages,
|
41
44
|
}
|
42
45
|
end
|
43
46
|
|
@@ -30,8 +30,6 @@ module AtomicAdmin
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def validate_token
|
33
|
-
return if @admin_app_validated
|
34
|
-
|
35
33
|
token = decoded_jwt_token(request)
|
36
34
|
raise InvalidTokenError if Rails.application.secrets.auth0_client_id != token["aud"]
|
37
35
|
|
@@ -52,16 +50,6 @@ module AtomicAdmin
|
|
52
50
|
raise GraphQL::ExecutionError, "Unauthorized: Invalid token."
|
53
51
|
end
|
54
52
|
end
|
55
|
-
|
56
|
-
def validate_admin_app_token
|
57
|
-
_bearer, jwt = request.headers['Authorization'].split(' ')
|
58
|
-
@atomic_admin_params = AtomicAdmin::JwtToken.decode(jwt, Rails.application.secrets.atomic_admin_shared_key)
|
59
|
-
@admin_app_validated = true
|
60
|
-
rescue JWT::DecodeError, InvalidTokenError => e
|
61
|
-
# fall back to regular app jwt
|
62
|
-
Rails.logger.error "JWT Error occured with admin app token #{e.inspect}"
|
63
|
-
@admin_app_validated = false
|
64
|
-
end
|
65
53
|
|
66
54
|
protected
|
67
55
|
|
@@ -78,4 +66,4 @@ module AtomicAdmin
|
|
78
66
|
end
|
79
67
|
|
80
68
|
end
|
81
|
-
end
|
69
|
+
end
|
data/lib/atomic_admin/version.rb
CHANGED
metadata
CHANGED
@@ -1,29 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: atomic_admin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.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:
|
11
|
+
date: 2024-11-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '7.0'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '9.0'
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - "
|
27
|
+
- - ">="
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: '7.0'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '9.0'
|
27
33
|
description: Engine to provide apis that power the atomic jolt admin app
|
28
34
|
email:
|
29
35
|
- nick.benoit@atomicjolt.com
|
@@ -71,7 +77,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
71
77
|
- !ruby/object:Gem::Version
|
72
78
|
version: '0'
|
73
79
|
requirements: []
|
74
|
-
rubygems_version: 3.4.
|
80
|
+
rubygems_version: 3.4.19
|
75
81
|
signing_key:
|
76
82
|
specification_version: 4
|
77
83
|
summary: Engine to provide apis that power the atomic jolt admin app
|