glib-web 0.4.52 → 0.4.54
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/concerns/glib/auth/policy.rb +17 -18
- data/app/helpers/glib/json_ui/view_builder.rb +7 -0
- data/app/views/json_ui/garage/actions/index.json.jbuilder +1 -0
- data/lib/glib/json_crawler/action_crawlers/windows_open.rb +10 -7
- data/lib/glib/json_crawler/{covarage.rb → coverage.rb} +4 -4
- data/lib/glib/json_crawler/router.rb +2 -2
- data/lib/glib/json_crawler.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ecdaf7a5551b21c24cdaf87798c3d8d23bcad631
|
4
|
+
data.tar.gz: f286b63e80b6e71459809b245931fc4a55974fbb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c288e2f16adecd42e54a7f7b2840f6a77c6d10a890e8e22ef6917ed9000b564c9df7934cc021bb86582f53f7c406790f1c2b2631424a0bae78328a4bf841cd02
|
7
|
+
data.tar.gz: fda78f4480c7be505f7fc0addbfc03586b9d364207845e17d49f69cfb6da27a4a5673439d101e6f7c335e7aec71a7a11cb911ad225b3c033388defbea619d559
|
@@ -115,26 +115,25 @@ module Glib::Auth
|
|
115
115
|
self.before_action(options.slice(:only, :except, :if, :unless)) do |controller|
|
116
116
|
resource_name ||= resource_name_from_controller
|
117
117
|
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
118
|
+
begin
|
119
|
+
if !(resource_key = options[:class]).nil?
|
120
|
+
resource = case resource_key
|
121
|
+
when false
|
122
|
+
resource_name.to_sym
|
123
|
+
when Symbol, Class
|
124
|
+
resource_key
|
125
|
+
else
|
126
|
+
raise "Invalid resource class: #{resource_key}"
|
127
|
+
end
|
128
|
+
|
129
|
+
authorize resource
|
130
|
+
elsif (resource_instance = controller.instance_variable_get("@#{resource_name}"))
|
131
|
+
authorize resource_instance
|
124
132
|
else
|
125
|
-
|
133
|
+
authorize resource_name.camelize.constantize
|
126
134
|
end
|
127
|
-
|
128
|
-
|
129
|
-
# if (policy = policy(resource)) && policy.class.instance_variable_defined?(:@manage_permission)
|
130
|
-
# skip_authorization if policy.manage?
|
131
|
-
# else
|
132
|
-
# authorize resource
|
133
|
-
# end
|
134
|
-
elsif (resource_instance = controller.instance_variable_get("@#{resource_name}"))
|
135
|
-
authorize resource_instance
|
136
|
-
else
|
137
|
-
authorize resource_name.camelize.constantize
|
135
|
+
rescue Pundit::NotAuthorizedError => e
|
136
|
+
raise_access_denied(e.record, e.policy)
|
138
137
|
end
|
139
138
|
|
140
139
|
verify_authorized
|
@@ -146,6 +146,13 @@ module Glib
|
|
146
146
|
class TabBar < View
|
147
147
|
color :color
|
148
148
|
|
149
|
+
def buttons(block)
|
150
|
+
json.buttons do
|
151
|
+
block.call page.menu_builder
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
# Should be deprecated
|
149
156
|
def tabButtons(block)
|
150
157
|
json.tabButtons do
|
151
158
|
block.call page.menu_builder
|
@@ -25,6 +25,7 @@ json_ui_page json do |page|
|
|
25
25
|
end
|
26
26
|
|
27
27
|
reload_counter = params[:reload_counter].to_i
|
28
|
+
reload_counter = 0 if reload_counter > 5
|
28
29
|
template.thumbnail title: "windows/reload with URL (counter: #{reload_counter})", onClick: ->(action) do
|
29
30
|
action.windows_reload url: json_ui_garage_url(path: 'actions/index', reload_counter: reload_counter + 1)
|
30
31
|
end
|
@@ -3,17 +3,20 @@ module Glib
|
|
3
3
|
class WindowsOpen < ActionCrawler
|
4
4
|
def initialize http, args, controller
|
5
5
|
@http = http
|
6
|
-
|
6
|
+
if (url = args['url'])
|
7
|
+
json = @http.get url, controller
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
unless json.nil?
|
10
|
+
crawl json['header']&.[]('childViews')
|
11
|
+
crawl json['body']&.[]('childViews')
|
12
|
+
crawl json['footer']&.[]('childViews')
|
12
13
|
|
13
|
-
|
14
|
-
|
14
|
+
json['rightNavButtons']&.each do |button|
|
15
|
+
click button
|
16
|
+
end
|
15
17
|
end
|
16
18
|
end
|
19
|
+
|
17
20
|
end
|
18
21
|
end
|
19
22
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module Glib
|
2
2
|
module JsonCrawler
|
3
|
-
class
|
3
|
+
class Coverage
|
4
4
|
@@files = []
|
5
|
-
@@
|
5
|
+
@@coverage_files = Set.new
|
6
6
|
|
7
7
|
def self.files
|
8
8
|
@@files
|
@@ -12,8 +12,8 @@ module Glib
|
|
12
12
|
@@files = files
|
13
13
|
end
|
14
14
|
|
15
|
-
def self.
|
16
|
-
@@
|
15
|
+
def self.coverage_files
|
16
|
+
@@coverage_files
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
@@ -17,7 +17,7 @@ module Glib
|
|
17
17
|
|
18
18
|
def self.step(http, args)
|
19
19
|
if controller = http.controller
|
20
|
-
Glib::JsonCrawler::
|
20
|
+
Glib::JsonCrawler::Coverage.coverage_files.add(http.controller.class.instance_method(http.action_name).source_location.first)
|
21
21
|
end
|
22
22
|
|
23
23
|
if args.is_a?(Hash) && args['rel'] != 'nofollow'
|
@@ -31,7 +31,7 @@ module Glib
|
|
31
31
|
child = case action
|
32
32
|
when 'initiate_navigation'
|
33
33
|
JsonCrawler::NavInitiate.new(http, params, action)
|
34
|
-
when 'windows/open-v1', 'dialogs/open-v1'
|
34
|
+
when 'windows/open-v1', 'dialogs/open-v1', 'windows/reload-v1'
|
35
35
|
JsonCrawler::WindowsOpen.new(http, params, action)
|
36
36
|
# when 'http/delete-v1'
|
37
37
|
# JsonCrawler::ActionHttp.new(:delete, http, params, action)
|
data/lib/glib/json_crawler.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require_relative './json_crawler/http'
|
2
2
|
require_relative './json_crawler/router'
|
3
3
|
require_relative './json_crawler/action_crawler'
|
4
|
-
require_relative './json_crawler/
|
4
|
+
require_relative './json_crawler/coverage'
|
5
5
|
|
6
6
|
require_relative './json_crawler/action_crawlers/nav_initiate'
|
7
7
|
require_relative './json_crawler/action_crawlers/windows_open'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glib-web
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.54
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ''
|
@@ -197,7 +197,7 @@ files:
|
|
197
197
|
- lib/glib/json_crawler/action_crawlers/forms_submit.rb
|
198
198
|
- lib/glib/json_crawler/action_crawlers/nav_initiate.rb
|
199
199
|
- lib/glib/json_crawler/action_crawlers/windows_open.rb
|
200
|
-
- lib/glib/json_crawler/
|
200
|
+
- lib/glib/json_crawler/coverage.rb
|
201
201
|
- lib/glib/json_crawler/http.rb
|
202
202
|
- lib/glib/json_crawler/router.rb
|
203
203
|
- lib/glib/value.rb
|