motor-admin 0.1.58 → 0.1.60
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/app/controllers/motor/auth_tokens_controller.rb +36 -0
- data/app/controllers/motor/icons_controller.rb +2 -0
- data/app/controllers/motor/resource_methods_controller.rb +2 -0
- data/config/routes.rb +1 -0
- data/lib/motor/admin.rb +12 -0
- data/lib/motor/build_schema/find_icon.rb +0 -1
- data/lib/motor/version.rb +1 -1
- data/ui/dist/{main-ba741735a93c9314bbfa.css.gz → main-96c4a62d2fb789ab1080.css.gz} +0 -0
- data/ui/dist/main-96c4a62d2fb789ab1080.js.gz +0 -0
- data/ui/dist/manifest.json +5 -5
- metadata +5 -5
- data/app/controllers/motor/schemas_controller.rb +0 -11
- data/ui/dist/main-ba741735a93c9314bbfa.js.gz +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d709fb5b88f56a20cb9c2f906f3540b53278e04becc96598556dba70a0dcb4f
|
4
|
+
data.tar.gz: 5ffca9ae9451e2aa373957116c1b9b6607f5aba3bc1fa1cee555682c1a2987be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 944babec34990e1889a52e76f652ca725dda31f4bcbb75aefc47cb715beca9a1a6127d6c5aa1e70437beafdf6a0c9cfaaaf3cf29a901524980812e23134cefaa
|
7
|
+
data.tar.gz: c79c99d0491e3c02c05296f0ace0ace54bbeeef1cd11f927b49f5edd814503f3e5f0f5a017c184e97bbce9a4b02b7279db36333a8b3fb796fb6125f283e8604a
|
data/README.md
CHANGED
@@ -93,7 +93,7 @@ Intelligence search can be opened via the top right corner button or using <kbd>
|
|
93
93
|
|
94
94
|
### Authorization
|
95
95
|
|
96
|
-
Motor Admin allows to set row-level and column-level permissions via [cancan](https://github.com/CanCanCommunity/cancancan) gem. Admin UI permissions should be defined in `app/models/motor/ability.rb` file in `Motor::Ability` class. See [Motor Admin guide](https://github.com/omohokcoj/motor-admin/blob/master/guides/
|
96
|
+
Motor Admin allows to set row-level and column-level permissions via [cancan](https://github.com/CanCanCommunity/cancancan) gem. Admin UI permissions should be defined in `app/models/motor/ability.rb` file in `Motor::Ability` class. See [Motor Admin guide](https://github.com/omohokcoj/motor-admin/blob/master/guides/defining_permissions.md) and [CanCan documentation](https://github.com/CanCanCommunity/cancancan/blob/develop/docs/Defining-Abilities.md) to learn how to define user permissions.
|
97
97
|
|
98
98
|
### Optimized for Mobile
|
99
99
|
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Motor
|
4
|
+
class AuthTokensController < ApiBaseController
|
5
|
+
GENERIC_TOKEN_TTL = 2.hours
|
6
|
+
|
7
|
+
skip_authorization_check
|
8
|
+
|
9
|
+
def create
|
10
|
+
return render json: {} unless current_user
|
11
|
+
|
12
|
+
if defined?(Devise::JWT)
|
13
|
+
respond_with_devise_jwt
|
14
|
+
elsif defined?(JWT)
|
15
|
+
respond_with_generic_jwt
|
16
|
+
else
|
17
|
+
render json: {}
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def respond_with_devise_jwt
|
24
|
+
warden.set_user(current_user)
|
25
|
+
|
26
|
+
render json: { token: request.env['warden-jwt_auth.token'] }
|
27
|
+
end
|
28
|
+
|
29
|
+
def respond_with_generic_jwt
|
30
|
+
payload = { uid: current_user.id, exp: GENERIC_TOKEN_TTL.from_now.to_i }
|
31
|
+
token = JWT.encode(payload, Rails.application.secrets.secret_key_base)
|
32
|
+
|
33
|
+
render json: { token: token }
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
data/config/routes.rb
CHANGED
@@ -5,6 +5,7 @@ Motor::Admin.routes.draw do
|
|
5
5
|
scope 'api', as: :api do
|
6
6
|
resources :run_queries, only: %i[show create]
|
7
7
|
resources :send_alerts, only: %i[create]
|
8
|
+
resources :auth_tokens, only: %i[create]
|
8
9
|
resources :queries, only: %i[index show create update destroy]
|
9
10
|
resources :tags, only: %i[index]
|
10
11
|
resources :configs, only: %i[index create]
|
data/lib/motor/admin.rb
CHANGED
@@ -65,6 +65,18 @@ module Motor
|
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
68
|
+
initializer 'warden.configure.dispatch_requests' do
|
69
|
+
next unless defined?(Warden::JWTAuth)
|
70
|
+
|
71
|
+
config.after_initialize do
|
72
|
+
Warden::JWTAuth.configure do |config|
|
73
|
+
config.dispatch_requests += [
|
74
|
+
['POST', /\A#{Regexp.escape(Motor::Admin.routes.url_helpers.motor_api_auth_tokens_path)}\z/]
|
75
|
+
]
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
68
80
|
initializer 'motor.active_storage.extensions' do
|
69
81
|
config.after_initialize do
|
70
82
|
next unless defined?(ActiveStorage::Engine)
|
data/lib/motor/version.rb
CHANGED
File without changes
|
Binary file
|
data/ui/dist/manifest.json
CHANGED
@@ -2068,11 +2068,11 @@
|
|
2068
2068
|
"mail-opened.svg": "icons/mail-opened.svg",
|
2069
2069
|
"mail.svg": "icons/mail.svg",
|
2070
2070
|
"mailbox.svg": "icons/mailbox.svg",
|
2071
|
-
"main-
|
2072
|
-
"main-
|
2073
|
-
"main-
|
2074
|
-
"main.css": "main-
|
2075
|
-
"main.js": "main-
|
2071
|
+
"main-96c4a62d2fb789ab1080.css.gz": "main-96c4a62d2fb789ab1080.css.gz",
|
2072
|
+
"main-96c4a62d2fb789ab1080.js.LICENSE.txt": "main-96c4a62d2fb789ab1080.js.LICENSE.txt",
|
2073
|
+
"main-96c4a62d2fb789ab1080.js.gz": "main-96c4a62d2fb789ab1080.js.gz",
|
2074
|
+
"main.css": "main-96c4a62d2fb789ab1080.css",
|
2075
|
+
"main.js": "main-96c4a62d2fb789ab1080.js",
|
2076
2076
|
"man.svg": "icons/man.svg",
|
2077
2077
|
"manual-gearbox.svg": "icons/manual-gearbox.svg",
|
2078
2078
|
"map-2.svg": "icons/map-2.svg",
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: motor-admin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.60
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pete Matsyburka
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-06-
|
11
|
+
date: 2021-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord-filter
|
@@ -131,6 +131,7 @@ files:
|
|
131
131
|
- app/controllers/motor/application_controller.rb
|
132
132
|
- app/controllers/motor/assets_controller.rb
|
133
133
|
- app/controllers/motor/audits_controller.rb
|
134
|
+
- app/controllers/motor/auth_tokens_controller.rb
|
134
135
|
- app/controllers/motor/configs_controller.rb
|
135
136
|
- app/controllers/motor/dashboards_controller.rb
|
136
137
|
- app/controllers/motor/data_controller.rb
|
@@ -140,7 +141,6 @@ files:
|
|
140
141
|
- app/controllers/motor/resource_methods_controller.rb
|
141
142
|
- app/controllers/motor/resources_controller.rb
|
142
143
|
- app/controllers/motor/run_queries_controller.rb
|
143
|
-
- app/controllers/motor/schemas_controller.rb
|
144
144
|
- app/controllers/motor/send_alerts_controller.rb
|
145
145
|
- app/controllers/motor/tags_controller.rb
|
146
146
|
- app/controllers/motor/ui_controller.rb
|
@@ -1490,8 +1490,8 @@ files:
|
|
1490
1490
|
- ui/dist/icons/zoom-money.svg.gz
|
1491
1491
|
- ui/dist/icons/zoom-out.svg.gz
|
1492
1492
|
- ui/dist/icons/zoom-question.svg.gz
|
1493
|
-
- ui/dist/main-
|
1494
|
-
- ui/dist/main-
|
1493
|
+
- ui/dist/main-96c4a62d2fb789ab1080.css.gz
|
1494
|
+
- ui/dist/main-96c4a62d2fb789ab1080.js.gz
|
1495
1495
|
- ui/dist/manifest.json
|
1496
1496
|
homepage:
|
1497
1497
|
licenses:
|
Binary file
|