glib-web 4.22.0 → 4.23.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/concerns/glib/auth/policy.rb +35 -42
- data/app/controllers/concerns/glib/json/libs.rb +5 -1
- data/app/controllers/concerns/glib/json/new_dynamic_text.rb +0 -0
- data/app/helpers/glib/app_feature_support_helper.rb +0 -0
- data/app/helpers/glib/dynamic_texts_helper.rb +0 -0
- data/app/helpers/glib/json_ui/action_builder/dialogs.rb +2 -0
- data/app/helpers/glib/json_ui/analytics_helper.rb +0 -0
- data/app/helpers/glib/json_ui/generic_builders.rb +0 -0
- data/app/models/glib/active_storage/attachment.rb +0 -0
- data/app/models/glib/active_storage/blob.rb +0 -0
- data/app/models/glib/dynamic_text_record.rb +0 -0
- data/app/models/glib/text.rb +0 -0
- data/app/policies/glib/application_policy.rb +12 -13
- data/app/validators/email_typo_validator.rb +0 -0
- data/app/validators/email_validator.rb +0 -0
- data/app/validators/url_validator.rb +0 -0
- data/app/views/json_ui/garage/actions/_dialogs.json.jbuilder +8 -1
- data/app/views/json_ui/garage/actions/_dialogs_show.json.jbuilder +3 -1
- data/app/views/json_ui/garage/actions/dialogs_oauth_post.json.jbuilder +0 -0
- data/app/views/json_ui/garage/forms/bulk_edit_post.json.jbuilder +0 -0
- data/app/views/json_ui/garage/forms/generic_post.json.jbuilder +0 -0
- data/app/views/json_ui/garage/forms/submission_flow.json.jbuilder +0 -0
- data/app/views/json_ui/garage/forms/submission_flow_post.json.jbuilder +0 -0
- data/app/views/json_ui/garage/forms/submission_indicator.json.jbuilder +0 -0
- data/app/views/json_ui/garage/forms/submission_indicator_post.json.jbuilder +0 -0
- data/app/views/json_ui/garage/home/blank.json.jbuilder +0 -0
- data/app/views/json_ui/garage/home/slow.json.jbuilder +0 -0
- data/app/views/json_ui/garage/lists/autoload_all.json.jbuilder +0 -0
- data/app/views/json_ui/garage/lists/autoload_as_needed.json.jbuilder +0 -0
- data/app/views/json_ui/garage/lists/chat_ui.json.jbuilder +0 -0
- data/app/views/json_ui/garage/lists/fab.json.jbuilder +0 -0
- data/app/views/json_ui/garage/notifications/web_socket.json.jbuilder +0 -0
- data/app/views/json_ui/garage/pages/custom_style_class.json.jbuilder +0 -0
- data/app/views/json_ui/garage/pages/full_width.json.jbuilder +0 -0
- data/app/views/json_ui/garage/pages/full_width_height.json.jbuilder +0 -0
- data/app/views/json_ui/garage/pages/layout.json.jbuilder +0 -0
- data/app/views/json_ui/garage/pages/loading_indicator.json.jbuilder +0 -0
- data/app/views/json_ui/garage/pages/nested_scroll.json.jbuilder +0 -0
- data/app/views/json_ui/garage/pages/redirect_onload.json.jbuilder +0 -0
- data/app/views/json_ui/garage/panels/_styled.json.jbuilder +0 -0
- data/app/views/json_ui/garage/panels/card.json.jbuilder +0 -0
- data/app/views/json_ui/garage/panels/custom.json.jbuilder +0 -0
- data/app/views/json_ui/garage/panels/outlined.json.jbuilder +0 -0
- data/app/views/json_ui/garage/services/dynamic_text.json.jbuilder +0 -0
- data/app/views/json_ui/garage/services/image.json.jbuilder +0 -0
- data/app/views/json_ui/garage/services/index.json.jbuilder +0 -0
- data/app/views/json_ui/garage/tables/_autoload_section.json.jbuilder +0 -0
- data/app/views/json_ui/garage/tables/autoload_all.json.jbuilder +0 -0
- data/app/views/json_ui/garage/tables/autoload_as_needed.json.jbuilder +0 -0
- data/app/views/json_ui/garage/tables/export_import.json.jbuilder +0 -0
- data/app/views/json_ui/garage/tables/pagination.json.jbuilder +1 -1
- data/app/views/json_ui/garage/test_page/selectable.json.jbuilder +7 -0
- data/app/views/json_ui/garage/views/calendar_data.json.jbuilder +0 -0
- data/app/views/json_ui/garage/views/map_data.json.jbuilder +0 -0
- data/app/views/json_ui/garage/views/multimedia.json.jbuilder +0 -0
- data/app/views/layouts/json_ui/no_custom.html.erb +0 -0
- data/lib/generators/glib/install_generator.rb +0 -0
- data/lib/generators/templates/20191017062519_create_texts.rb +0 -0
- data/lib/generators/templates/20191024063257_add_scope_to_texts.rb +0 -0
- data/lib/generators/templates/20191112095018_add_lang_to_texts.rb +0 -0
- data/lib/generators/templates/20191126071051_create_active_storage_tables.active_storage.rb +0 -0
- data/lib/generators/templates/database.yml +0 -0
- data/lib/generators/templates/dynamic_text.rb +0 -0
- data/lib/glib/dynamic_text/config.rb +0 -0
- data/lib/glib/dynamic_text.rb +0 -0
- data/lib/glib/json_crawler/action_crawler.rb +0 -0
- data/lib/glib/json_crawler/action_crawlers/action_http.rb +0 -0
- data/lib/glib/json_crawler/action_crawlers/dialogs_alert.rb +0 -0
- data/lib/glib/json_crawler/action_crawlers/menu.rb +0 -0
- data/lib/glib/json_crawler/action_crawlers/run_multiple.rb +0 -0
- data/lib/glib/json_crawler/action_crawlers/windows_open.rb +0 -0
- data/lib/glib/json_crawler/coverage.rb +0 -0
- data/lib/glib/value.rb +0 -0
- data/lib/glib/version.rb +0 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9044e86258995ce4d869c421c35d5c17d3d2c7127f5129d5a8247bf9b94cc560
|
4
|
+
data.tar.gz: c1f3991fbe7147ffabc04e626aa02e9ce4809957f1618b5c2e73835f2830cb48
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3f10f85edf2d3dc57bb70723b70683691c624295a8ef673c870731449bf0f7222d5786317fa6c77bb3c8a55bc90315864c641e94dbf52eae5fc94de7250bc25
|
7
|
+
data.tar.gz: 447a0021c20e6cd60be6f5d140ae7d25f975927e40686d10d13faf83ad71bef7fbbece7ade06104533a6ff1538606f0900be3580911aa5968f9e6e7ad9166e46
|
@@ -22,8 +22,7 @@ module Glib::Auth
|
|
22
22
|
end
|
23
23
|
|
24
24
|
module Overrides
|
25
|
-
|
26
|
-
public # Override
|
25
|
+
# Override
|
27
26
|
def policy(record, policy_name = nil, context = nil)
|
28
27
|
policy_name ||= record
|
29
28
|
|
@@ -50,11 +49,10 @@ module Glib::Auth
|
|
50
49
|
end
|
51
50
|
|
52
51
|
# Expose protected method
|
53
|
-
|
52
|
+
# Override
|
54
53
|
def policy_scope(*args, **opts)
|
55
54
|
super
|
56
55
|
end
|
57
|
-
|
58
56
|
end
|
59
57
|
|
60
58
|
def glib_raise_forbidden
|
@@ -71,13 +69,11 @@ module Glib::Auth
|
|
71
69
|
policy(record, nil, context).send("#{action}?")
|
72
70
|
end
|
73
71
|
|
74
|
-
public
|
75
72
|
def cannot?(action, record, context = nil)
|
76
73
|
!policy(record, nil, context).send("#{action}?")
|
77
74
|
end
|
78
75
|
|
79
76
|
# Inspired from https://github.com/ryanb/cancan/wiki/Non-RESTful-Controllers
|
80
|
-
public
|
81
77
|
def glib_authorize_resource(*args)
|
82
78
|
options = args.extract_options!
|
83
79
|
resource_name = args.first
|
@@ -104,14 +100,11 @@ module Glib::Auth
|
|
104
100
|
raise_access_denied(resource_instance, policy_instance) unless policy_instance.public_send(query)
|
105
101
|
end
|
106
102
|
|
107
|
-
|
108
|
-
|
109
103
|
class UnauthorizedError < Pundit::NotAuthorizedError
|
110
104
|
end
|
111
105
|
|
112
|
-
|
113
|
-
|
114
106
|
module ClassMethods
|
107
|
+
# rubocop:disable Style/ClassVars
|
115
108
|
def glib_auth_init
|
116
109
|
@@__glib_auth_init = true
|
117
110
|
|
@@ -122,40 +115,40 @@ module Glib::Auth
|
|
122
115
|
def glib_auth_inited?
|
123
116
|
@@__glib_auth_init ||= false
|
124
117
|
end
|
118
|
+
# rubocop:enable Style/ClassVars
|
125
119
|
|
126
120
|
# TODO: Consider deprecating
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
end
|
121
|
+
# def authorize_resource(*args)
|
122
|
+
# options = args.extract_options!
|
123
|
+
# resource_name = args.first
|
124
|
+
|
125
|
+
# self.before_action(options.slice(:only, :except, :if, :unless)) do |controller|
|
126
|
+
# resource_name ||= resource_name_from_controller
|
127
|
+
|
128
|
+
# begin
|
129
|
+
# if !(resource_key = options[:class]).nil?
|
130
|
+
# resource = case resource_key
|
131
|
+
# when false
|
132
|
+
# resource_name.to_sym
|
133
|
+
# when Symbol, Class
|
134
|
+
# resource_key
|
135
|
+
# else
|
136
|
+
# raise "Invalid resource class: #{resource_key}"
|
137
|
+
# end
|
138
|
+
|
139
|
+
# authorize resource
|
140
|
+
# elsif (resource_instance = controller.instance_variable_get("@#{resource_name}"))
|
141
|
+
# authorize resource_instance
|
142
|
+
# else
|
143
|
+
# authorize resource_name.camelize.constantize
|
144
|
+
# end
|
145
|
+
# rescue Pundit::NotAuthorizedError => e
|
146
|
+
# raise_access_denied(e.record, e.policy)
|
147
|
+
# end
|
148
|
+
|
149
|
+
# verify_authorized
|
150
|
+
# end
|
151
|
+
# end
|
159
152
|
end
|
160
153
|
|
161
154
|
def resource_name_from_controller
|
@@ -7,7 +7,7 @@ module Glib::Json::Libs
|
|
7
7
|
helper_method :json_ui_app_bundle_id, :json_ui_app_build_version, :json_ui_app_device_os
|
8
8
|
helper_method :json_ui_app_is_android?, :json_ui_app_is_ios?, :json_ui_app_is_web?
|
9
9
|
# helper_method :json_ui_redirect_back_or_to
|
10
|
-
helper_method :delete_redirect_back_url
|
10
|
+
helper_method :delete_redirect_back_url, :redirect_back_url
|
11
11
|
|
12
12
|
include Glib::Auth::Response
|
13
13
|
helper_method :glib_json_dialog_mode?
|
@@ -171,6 +171,10 @@ module Glib::Json::Libs
|
|
171
171
|
end
|
172
172
|
end
|
173
173
|
|
174
|
+
def redirect_back_url
|
175
|
+
session[REDIRECT_BACK_KEY]
|
176
|
+
end
|
177
|
+
|
174
178
|
def __delete_redirect_back_url(url)
|
175
179
|
session.delete(REDIRECT_BACK_KEY) || url
|
176
180
|
end
|
File without changes
|
File without changes
|
File without changes
|
@@ -15,6 +15,7 @@ class Glib::JsonUi::ActionBuilder
|
|
15
15
|
length :width
|
16
16
|
bool :closeOnBlur
|
17
17
|
bool :updateExisting
|
18
|
+
action :onClose
|
18
19
|
|
19
20
|
# def initialize(json, page)
|
20
21
|
# @json = json
|
@@ -34,6 +35,7 @@ class Glib::JsonUi::ActionBuilder
|
|
34
35
|
length :height
|
35
36
|
bool :closeOnBlur
|
36
37
|
bool :updateExisting
|
38
|
+
action :onClose
|
37
39
|
end
|
38
40
|
|
39
41
|
class Reload < Action
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/app/models/glib/text.rb
CHANGED
File without changes
|
@@ -6,6 +6,7 @@ module Glib
|
|
6
6
|
attr_reader :user, :record, :policy_name, :controller, :request, :params
|
7
7
|
|
8
8
|
private
|
9
|
+
# rubocop:disable Metrics/ParameterLists
|
9
10
|
def initialize(user, record, policy_name, controller, request, params)
|
10
11
|
@user = user
|
11
12
|
@record = record
|
@@ -16,13 +17,14 @@ module Glib
|
|
16
17
|
@params = params
|
17
18
|
@policy_name = policy_name
|
18
19
|
end
|
20
|
+
# rubocop:enable Metrics/ParameterLists
|
19
21
|
|
20
22
|
class << self
|
21
23
|
attr_reader :catch_all
|
22
24
|
|
23
25
|
# This is to define the authorization logic for an action (or a group of actions). It's different from controller's
|
24
26
|
# authorize().
|
25
|
-
private
|
27
|
+
private # Used by child
|
26
28
|
def authorize(*actions, &block)
|
27
29
|
actions.each do |action|
|
28
30
|
if action == :glib_all
|
@@ -33,19 +35,17 @@ module Glib
|
|
33
35
|
# Avoid accidentally redefining multiple times from child policies. But it's okay if the child policy
|
34
36
|
# wants to override the parent's authorization method.
|
35
37
|
raise "Action authorization has been declared: #{action}" if instance_methods(false).include?(method_name.to_sym)
|
38
|
+
|
36
39
|
define_method method_name, &block
|
37
40
|
end
|
38
41
|
end
|
39
42
|
end
|
40
|
-
|
41
43
|
end
|
42
44
|
|
43
|
-
private
|
44
45
|
def catch_all
|
45
46
|
self.class.catch_all
|
46
47
|
end
|
47
48
|
|
48
|
-
private
|
49
49
|
# To ensure the block is called on the policy's instance instead class.
|
50
50
|
def call_catch_all
|
51
51
|
instance_eval(&catch_all)
|
@@ -100,14 +100,17 @@ module Glib
|
|
100
100
|
|
101
101
|
public
|
102
102
|
def method_missing(name, *args, &block)
|
103
|
-
if
|
103
|
+
if respond_to_missing?(name) && catch_all
|
104
104
|
call_catch_all
|
105
105
|
else
|
106
106
|
super
|
107
107
|
end
|
108
108
|
end
|
109
109
|
|
110
|
-
|
110
|
+
def respond_to_missing?(method_name, include_private = false)
|
111
|
+
method_name.to_s.end_with?('?') || super
|
112
|
+
end
|
113
|
+
|
111
114
|
def scope
|
112
115
|
policy_scope_class = Pundit::PolicyFinder.new(@policy_name).scope
|
113
116
|
return unless policy_scope_class
|
@@ -115,15 +118,11 @@ module Glib
|
|
115
118
|
controller.policy_scope(record.class, policy_scope_class: policy_scope_class)
|
116
119
|
end
|
117
120
|
|
118
|
-
public
|
119
121
|
def self.args_builder
|
120
|
-
|
122
|
+
proc { |_controller| [] }
|
121
123
|
end
|
122
124
|
|
123
|
-
|
124
|
-
def helpers
|
125
|
-
controller.helpers
|
126
|
-
end
|
125
|
+
delegate :helpers, to: :controller
|
127
126
|
|
128
127
|
class Scope
|
129
128
|
attr_reader :user, :scope
|
@@ -143,7 +142,7 @@ module Glib
|
|
143
142
|
end
|
144
143
|
end
|
145
144
|
|
146
|
-
private
|
145
|
+
private # Used by child
|
147
146
|
def everyone
|
148
147
|
true
|
149
148
|
end
|
File without changes
|
File without changes
|
File without changes
|
@@ -49,7 +49,14 @@ section.rows builder: ->(template) do
|
|
49
49
|
end
|
50
50
|
|
51
51
|
template.thumbnail title: 'dialogs/open', onClick: ->(action) do
|
52
|
-
action.dialogs_open
|
52
|
+
action.dialogs_open \
|
53
|
+
width: 950,
|
54
|
+
url: json_ui_garage_url(path: 'forms/basic', mode: 'dialog'),
|
55
|
+
disableCloseButton: true,
|
56
|
+
closeOnBlur: true,
|
57
|
+
onClose: ->(saction) do
|
58
|
+
saction.snackbars_alert message: 'dialog closed'
|
59
|
+
end
|
53
60
|
end
|
54
61
|
|
55
62
|
template.thumbnail title: 'dialogs/open (fullscreen on mobile)', onClick: ->(action) do
|
@@ -12,7 +12,9 @@ end
|
|
12
12
|
|
13
13
|
include_form = local_assigns[:include_form]
|
14
14
|
|
15
|
-
action.send "dialogs_#{dialog_mode}", **options,
|
15
|
+
action.send "dialogs_#{dialog_mode}", **options,
|
16
|
+
onClose: ->(action) { action.snackbars_alert message: 'dialog closed' },
|
17
|
+
content: ->(dialog) do
|
16
18
|
dialog.body padding: glib_json_padding_body, childViews: ->(body) do
|
17
19
|
body.markdown text: markdown
|
18
20
|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -9,7 +9,7 @@ per_page = 20
|
|
9
9
|
page_index = params[:page]&.to_i || 1
|
10
10
|
|
11
11
|
page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
|
12
|
-
scroll.panels_table
|
12
|
+
scroll.panels_table firstSection: ->(section) do
|
13
13
|
section.header cellViews: ->(header) do
|
14
14
|
header.label text: 'Name'
|
15
15
|
header.label text: 'Status'
|
@@ -79,6 +79,13 @@ page.body padding: glib_json_padding_body, childViews: ->(body) do
|
|
79
79
|
form.fields_check id: 'check3', name: 'user[foo][]', label: 'Option 3', checkValue: true
|
80
80
|
|
81
81
|
form.spacer height: 8
|
82
|
+
|
83
|
+
form.h2 text: 'Timezone'
|
84
|
+
form.fields_timeZone name: 'user[timezone]', label: 'Timezone', value: 'Asia/Shanghai'
|
85
|
+
form.fields_timeZone name: 'user[timezone_with_current_local]', label: 'Local Timezone'
|
86
|
+
|
87
|
+
form.spacer height: 8
|
88
|
+
|
82
89
|
form.fields_submit text: 'Submit'
|
83
90
|
end
|
84
91
|
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/lib/glib/dynamic_text.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/lib/glib/value.rb
CHANGED
File without changes
|
data/lib/glib/version.rb
CHANGED
File without changes
|
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: 4.
|
4
|
+
version: 4.23.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ''
|
@@ -409,7 +409,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
409
409
|
- !ruby/object:Gem::Version
|
410
410
|
version: '0'
|
411
411
|
requirements: []
|
412
|
-
|
412
|
+
rubyforge_project:
|
413
|
+
rubygems_version: 2.7.6
|
413
414
|
signing_key:
|
414
415
|
specification_version: 4
|
415
416
|
summary: ''
|