decidim-action_delegator 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +97 -36
- data/app/commands/{decidim → concerns/decidim}/action_delegator/consultations/vote_question_override.rb +9 -1
- data/app/commands/decidim/action_delegator/admin/create_delegation.rb +5 -1
- data/app/commands/decidim/action_delegator/admin/create_participant.rb +41 -0
- data/app/commands/decidim/action_delegator/admin/create_ponderation.rb +38 -0
- data/app/commands/decidim/action_delegator/admin/create_setting.rb +49 -0
- data/app/commands/decidim/action_delegator/admin/fix_resource_permissions.rb +46 -0
- data/app/commands/decidim/action_delegator/admin/update_participant.rb +42 -0
- data/app/commands/decidim/action_delegator/admin/update_ponderation.rb +41 -0
- data/app/commands/decidim/action_delegator/admin/update_setting.rb +66 -0
- data/app/controllers/concerns/decidim/action_delegator/consultations/consultations_controller_override.rb +16 -0
- data/app/controllers/{decidim → concerns/decidim}/action_delegator/consultations/question_multiple_votes_controller_override.rb +2 -1
- data/app/controllers/{decidim → concerns/decidim}/action_delegator/consultations/question_votes_controller_override.rb +2 -0
- data/app/controllers/concerns/decidim/action_delegator/consultations/questions_controller_override.rb +16 -0
- data/app/controllers/concerns/decidim/action_delegator/needs_consultation_styles.rb +24 -0
- data/app/controllers/decidim/action_delegator/admin/consultations_controller.rb +22 -8
- data/app/controllers/decidim/action_delegator/admin/delegations_controller.rb +9 -9
- data/app/controllers/decidim/action_delegator/admin/invite_participants_controller.rb +84 -0
- data/app/controllers/decidim/action_delegator/admin/manage_delegations_controller.rb +48 -0
- data/app/controllers/decidim/action_delegator/admin/manage_participants_controller.rb +59 -0
- data/app/controllers/decidim/action_delegator/admin/participants_controller.rb +102 -0
- data/app/controllers/decidim/action_delegator/admin/permissions_controller.rb +40 -0
- data/app/controllers/decidim/action_delegator/admin/ponderations_controller.rb +101 -0
- data/app/controllers/decidim/action_delegator/admin/settings_controller.rb +51 -12
- data/app/controllers/decidim/action_delegator/verifications/delegations_verifier/authorizations_controller.rb +108 -0
- data/app/forms/decidim/action_delegator/admin/delegation_form.rb +23 -4
- data/app/forms/decidim/action_delegator/admin/invitation_participant_form.rb +10 -0
- data/app/forms/decidim/action_delegator/admin/participant_form.rb +44 -0
- data/app/forms/decidim/action_delegator/admin/ponderation_form.rb +28 -0
- data/app/forms/decidim/action_delegator/admin/setting_form.rb +28 -0
- data/app/forms/decidim/action_delegator/verifications/delegations_verifier_form.rb +131 -0
- data/app/helpers/decidim/action_delegator/admin/delegation_helper.rb +40 -3
- data/app/helpers/decidim/action_delegator/delegation_helper.rb +13 -0
- data/app/jobs/decidim/action_delegator/admin/import_csv_job.rb +27 -0
- data/app/jobs/decidim/action_delegator/admin/invite_participants_job.rb +39 -0
- data/app/jobs/decidim/action_delegator/sync_participants_job.rb +27 -0
- data/app/mailers/decidim/action_delegator/import_mailer.rb +31 -0
- data/app/models/decidim/action_delegator/delegation.rb +11 -0
- data/app/models/decidim/action_delegator/participant.rb +106 -0
- data/app/models/decidim/action_delegator/ponderation.rb +28 -0
- data/app/models/decidim/action_delegator/setting.rb +50 -1
- data/app/overrides/decidim/consultations/consultations/_question/add_delegation_link.html.erb.deface +3 -0
- data/app/overrides/decidim/consultations/consultations/_regular_questions/remove_highlighted_scopes.html.erb.deface +4 -0
- data/app/overrides/decidim/consultations/question_multiple_votes/_form/add_delegation_notice.html.erb.deface +8 -0
- data/app/overrides/decidim/consultations/questions/_vote_button/add_delegations_link.html.erb.deface +3 -0
- data/app/overrides/decidim/consultations/questions/_vote_button/add_modal.html.erb.deface +3 -0
- data/app/overrides/decidim/consultations/questions/_vote_button/replace_delegation_to_multivote_link.html.erb.deface +8 -0
- data/app/overrides/decidim/consultations/questions/_vote_modal/add_delegation_callout.html.erb.deface +3 -0
- data/app/overrides/decidim/consultations/questions/_vote_modal_confirm/add_delegation_callout.html.erb.deface +3 -0
- data/app/overrides/decidim/consultations/questions/_vote_modal_confirm/add_hidden_field.html.erb.deface +3 -0
- data/app/overrides/layouts/decidim/admin/remove_deprecation.rb +10 -0
- data/app/packs/entrypoints/decidim_action_delegator_questions.js +2 -0
- data/app/packs/src/decidim/action_delegator/questions.js +27 -0
- data/app/packs/stylesheets/decidim/action_delegator/questions.scss +4 -3
- data/app/permissions/concerns/decidim/action_delegator/consultations/permissions_override.rb +35 -0
- data/app/permissions/decidim/action_delegator/permissions.rb +6 -2
- data/app/queries/decidim/action_delegator/delegated_votes_versions.rb +5 -11
- data/app/queries/decidim/action_delegator/organization_settings.rb +6 -0
- data/app/queries/decidim/action_delegator/responses_by_membership.rb +3 -20
- data/app/queries/decidim/action_delegator/sum_of_membership_weight.rb +1 -5
- data/app/queries/decidim/action_delegator/sum_of_weights.rb +1 -1
- data/app/queries/decidim/action_delegator/type_and_weight.rb +1 -1
- data/app/queries/decidim/action_delegator/voted_with_ponderations.rb +30 -0
- data/app/services/decidim/action_delegator/csv_importer.rb +86 -0
- data/app/services/decidim/action_delegator/delegations_csv_importer.rb +54 -0
- data/app/services/decidim/action_delegator/participants_csv_importer.rb +131 -0
- data/app/views/decidim/action_delegator/admin/consultations/results.html.erb +3 -3
- data/app/views/decidim/action_delegator/admin/{results/sum_of_weights/index.html.erb → consultations/weighted_results.html.erb} +3 -3
- data/app/views/decidim/action_delegator/admin/delegations/index.html.erb +8 -3
- data/app/views/decidim/action_delegator/admin/delegations/new.html.erb +15 -12
- data/app/views/decidim/action_delegator/admin/manage_delegations/new.html.erb +25 -0
- data/app/views/decidim/action_delegator/admin/manage_participants/new.html.erb +33 -0
- data/app/views/decidim/action_delegator/admin/participants/_form.html.erb +9 -0
- data/app/views/decidim/action_delegator/admin/participants/_missing_registered_check.html.erb +17 -0
- data/app/views/decidim/action_delegator/admin/participants/edit.html.erb +21 -0
- data/app/views/decidim/action_delegator/admin/participants/index.html.erb +72 -0
- data/app/views/decidim/action_delegator/admin/participants/new.html.erb +21 -0
- data/app/views/decidim/action_delegator/admin/ponderations/_form.html.erb +8 -0
- data/app/views/decidim/action_delegator/admin/ponderations/edit.html.erb +21 -0
- data/app/views/decidim/action_delegator/admin/ponderations/index.html.erb +40 -0
- data/app/views/decidim/action_delegator/admin/ponderations/new.html.erb +21 -0
- data/app/views/decidim/action_delegator/admin/settings/_check_verifier.html.erb +5 -0
- data/app/views/decidim/action_delegator/admin/settings/_form.html.erb +16 -0
- data/app/views/decidim/action_delegator/admin/settings/_participants_email_check.html.erb +7 -0
- data/app/views/decidim/action_delegator/admin/settings/_participants_sync_check.html.erb +11 -0
- data/app/views/decidim/action_delegator/admin/settings/_setting_checks.html.erb +81 -0
- data/app/views/decidim/action_delegator/admin/settings/edit.html.erb +18 -0
- data/app/views/decidim/action_delegator/admin/settings/index.html.erb +25 -5
- data/app/views/decidim/action_delegator/admin/settings/new.html.erb +14 -26
- data/app/views/decidim/action_delegator/consultations/_link_to_question.html.erb +11 -0
- data/app/views/decidim/action_delegator/consultations/questions/_delegations_modal.html.erb +36 -0
- data/app/views/decidim/action_delegator/consultations/questions/_link_to_delegations.html.erb +11 -0
- data/app/views/decidim/action_delegator/consultations/questions/_vote_delegated_active.html.erb +32 -0
- data/app/views/decidim/action_delegator/consultations/questions/_vote_delegated_finished.html.erb +9 -0
- data/app/views/decidim/action_delegator/consultations/questions/_vote_delegated_upcoming.html.erb +8 -0
- data/app/views/decidim/action_delegator/import_mailer/import.html.erb +11 -0
- data/app/views/decidim/{verifications/sms/authorizations/new.html.erb → action_delegator/verifications/delegations_verifier/authorizations/edit.html.erb} +12 -7
- data/app/views/decidim/action_delegator/verifications/delegations_verifier/authorizations/new.html.erb +49 -0
- data/config/assets.rb +1 -3
- data/config/i18n-tasks.yml +8 -0
- data/config/locales/ca.yml +287 -23
- data/config/locales/cs.yml +286 -18
- data/config/locales/en.yml +331 -24
- data/config/locales/es.yml +288 -24
- data/db/migrate/20230323101247_create_decidim_action_delegator_ponderations.rb +12 -0
- data/db/migrate/20230323210000_create_decidim_action_delegator_participants.rb +13 -0
- data/db/migrate/20230323223752_add_decidim_action_delegator_verification_method.rb +7 -0
- data/db/migrate/20230412105710_add_decidim_action_delegator_participants_user_id.rb +7 -0
- data/lib/decidim/action_delegator/admin_engine.rb +68 -6
- data/lib/decidim/action_delegator/engine.rb +25 -15
- data/lib/decidim/action_delegator/test/factories.rb +22 -7
- data/lib/decidim/action_delegator/verifications/delegations_authorizer.rb +85 -0
- data/lib/decidim/action_delegator/verifications/delegations_verifier/engine.rb +25 -0
- data/lib/decidim/action_delegator/verifications/delegations_verifier.rb +12 -0
- data/lib/decidim/action_delegator/version.rb +3 -3
- data/lib/decidim/action_delegator.rb +41 -0
- data/lib/tasks/import_direct_verification.rake +30 -0
- data/package.json +57 -0
- metadata +115 -50
- data/app/controllers/decidim/action_delegator/admin/results/sum_of_weights_controller.rb +0 -37
- data/app/controllers/decidim/action_delegator/verifications/sms/authorizations_controller_override.rb +0 -38
- data/app/packs/entrypoints/decidim_action_delegator_admin_action_delegator_js.js +0 -1
- data/app/packs/entrypoints/decidim_action_delegator_questions_js.js +0 -1
- data/app/packs/src/decidim/action_delegator/admin/action_delegator.js.es6 +0 -3
- data/app/packs/src/decidim/action_delegator/questions.js.es6 +0 -26
- data/app/permissions/decidim/action_delegator/consultations_permissions_extension.rb +0 -27
- data/app/presenters/decidim/action_delegator/admin/consultation_presenter.rb +0 -15
- data/app/presenters/decidim/action_delegator/admin/setting_presenter.rb +0 -13
- data/app/queries/decidim/action_delegator/decrypted_authorizations.rb +0 -112
- data/app/queries/decidim/action_delegator/json_build_object_query.rb +0 -45
- data/app/queries/decidim/action_delegator/voted_with_direct_verification.rb +0 -53
- data/app/views/decidim/action_delegator/_delegations_modal.html.erb +0 -93
- data/app/views/decidim/action_delegator/_link_to_delegations.html.erb +0 -5
- data/app/views/decidim/action_delegator/_link_to_question.html.erb +0 -5
- data/app/views/decidim/consultations/consultations/_question.html.erb +0 -41
- data/app/views/decidim/consultations/consultations/show.html.erb +0 -14
- data/app/views/decidim/consultations/question_multiple_votes/_form.html.erb +0 -25
- data/app/views/decidim/consultations/questions/_vote_button.html.erb +0 -106
- data/app/views/decidim/consultations/questions/_vote_modal.html.erb +0 -30
- data/app/views/decidim/consultations/questions/_vote_modal_confirm.html.erb +0 -38
- data/app/views/layouts/decidim/action_delegator/admin/_users_sidebar.html.erb +0 -56
- data/app/views/layouts/decidim/action_delegator/admin/delegations.html.erb +0 -13
- data/app/views/layouts/decidim/admin/consultation.html.erb +0 -56
- data/app/views/layouts/decidim/admin/question.html.erb +0 -98
- data/app/views/layouts/decidim/admin/users.html.erb +0 -7
- data/config/initializers/doorkeeper.rb +0 -492
- data/lib/json_key.rb +0 -10
- /data/app/commands/{decidim → concerns/decidim}/action_delegator/consultations/multiple_vote_question_override.rb +0 -0
- /data/app/controllers/decidim/action_delegator/admin/exports/{sum_of_weights_controller.rb → _sum_of_weights_controller.rb} +0 -0
- /data/app/forms/{decidim → concerns/decidim}/action_delegator/consultations/vote_form_override.rb +0 -0
- /data/app/models/{decidim → concerns/decidim}/action_delegator/consultations/vote_override.rb +0 -0
- /data/app/views/decidim/action_delegator/{_callout.html.erb → consultations/questions/_callout.html.erb} +0 -0
@@ -1,492 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
Doorkeeper.configure do
|
4
|
-
# Change the ORM that doorkeeper will use (requires ORM extensions installed).
|
5
|
-
# Check the list of supported ORMs here: https://github.com/doorkeeper-gem/doorkeeper#orms
|
6
|
-
orm :active_record
|
7
|
-
|
8
|
-
# This block will be called to check whether the resource owner is authenticated or not.
|
9
|
-
resource_owner_authenticator do
|
10
|
-
raise "Please configure doorkeeper resource_owner_authenticator block located in #{__FILE__}"
|
11
|
-
# Put your resource owner authentication logic here.
|
12
|
-
# Example implementation:
|
13
|
-
# User.find_by(id: session[:user_id]) || redirect_to(new_user_session_url)
|
14
|
-
end
|
15
|
-
|
16
|
-
# If you didn't skip applications controller from Doorkeeper routes in your application routes.rb
|
17
|
-
# file then you need to declare this block in order to restrict access to the web interface for
|
18
|
-
# adding oauth authorized applications. In other case it will return 403 Forbidden response
|
19
|
-
# every time somebody will try to access the admin web interface.
|
20
|
-
#
|
21
|
-
# admin_authenticator do
|
22
|
-
# # Put your admin authentication logic here.
|
23
|
-
# # Example implementation:
|
24
|
-
#
|
25
|
-
# if current_user
|
26
|
-
# head :forbidden unless current_user.admin?
|
27
|
-
# else
|
28
|
-
# redirect_to sign_in_url
|
29
|
-
# end
|
30
|
-
# end
|
31
|
-
|
32
|
-
# You can use your own model classes if you need to extend (or even override) default
|
33
|
-
# Doorkeeper models such as `Application`, `AccessToken` and `AccessGrant.
|
34
|
-
#
|
35
|
-
# Be default Doorkeeper ActiveRecord ORM uses it's own classes:
|
36
|
-
#
|
37
|
-
# access_token_class "Doorkeeper::AccessToken"
|
38
|
-
# access_grant_class "Doorkeeper::AccessGrant"
|
39
|
-
# application_class "Doorkeeper::Application"
|
40
|
-
#
|
41
|
-
# Don't forget to include Doorkeeper ORM mixins into your custom models:
|
42
|
-
#
|
43
|
-
# * ::Doorkeeper::Orm::ActiveRecord::Mixins::AccessToken - for access token
|
44
|
-
# * ::Doorkeeper::Orm::ActiveRecord::Mixins::AccessGrant - for access grant
|
45
|
-
# * ::Doorkeeper::Orm::ActiveRecord::Mixins::Application - for application (OAuth2 clients)
|
46
|
-
#
|
47
|
-
# For example:
|
48
|
-
#
|
49
|
-
# access_token_class "MyAccessToken"
|
50
|
-
#
|
51
|
-
# class MyAccessToken < ApplicationRecord
|
52
|
-
# include ::Doorkeeper::Orm::ActiveRecord::Mixins::AccessToken
|
53
|
-
#
|
54
|
-
# self.table_name = "hey_i_wanna_my_name"
|
55
|
-
#
|
56
|
-
# def destroy_me!
|
57
|
-
# destroy
|
58
|
-
# end
|
59
|
-
# end
|
60
|
-
|
61
|
-
# Enables polymorphic Resource Owner association for Access Tokens and Access Grants.
|
62
|
-
# By default this option is disabled.
|
63
|
-
#
|
64
|
-
# Make sure you properly setup you database and have all the required columns (run
|
65
|
-
# `bundle exec rails generate doorkeeper:enable_polymorphic_resource_owner` and execute Rails
|
66
|
-
# migrations).
|
67
|
-
#
|
68
|
-
# If this option enabled, Doorkeeper will store not only Resource Owner primary key
|
69
|
-
# value, but also it's type (class name). See "Polymorphic Associations" section of
|
70
|
-
# Rails guides: https://guides.rubyonrails.org/association_basics.html#polymorphic-associations
|
71
|
-
#
|
72
|
-
# [NOTE] If you apply this option on already existing project don't forget to manually
|
73
|
-
# update `resource_owner_type` column in the database and fix migration template as it will
|
74
|
-
# set NOT NULL constraint for Access Grants table.
|
75
|
-
#
|
76
|
-
# use_polymorphic_resource_owner
|
77
|
-
|
78
|
-
# If you are planning to use Doorkeeper in Rails 5 API-only application, then you might
|
79
|
-
# want to use API mode that will skip all the views management and change the way how
|
80
|
-
# Doorkeeper responds to a requests.
|
81
|
-
#
|
82
|
-
# api_only
|
83
|
-
|
84
|
-
# Enforce token request content type to application/x-www-form-urlencoded.
|
85
|
-
# It is not enabled by default to not break prior versions of the gem.
|
86
|
-
#
|
87
|
-
# enforce_content_type
|
88
|
-
|
89
|
-
# Authorization Code expiration time (default: 10 minutes).
|
90
|
-
#
|
91
|
-
# authorization_code_expires_in 10.minutes
|
92
|
-
|
93
|
-
# Access token expiration time (default: 2 hours).
|
94
|
-
# If you want to disable expiration, set this to `nil`.
|
95
|
-
#
|
96
|
-
# access_token_expires_in 2.hours
|
97
|
-
|
98
|
-
# Assign custom TTL for access tokens. Will be used instead of access_token_expires_in
|
99
|
-
# option if defined. In case the block returns `nil` value Doorkeeper fallbacks to
|
100
|
-
# +access_token_expires_in+ configuration option value. If you really need to issue a
|
101
|
-
# non-expiring access token (which is not recommended) then you need to return
|
102
|
-
# Float::INFINITY from this block.
|
103
|
-
#
|
104
|
-
# `context` has the following properties available:
|
105
|
-
#
|
106
|
-
# * `client` - the OAuth client application (see Doorkeeper::OAuth::Client)
|
107
|
-
# * `grant_type` - the grant type of the request (see Doorkeeper::OAuth)
|
108
|
-
# * `scopes` - the requested scopes (see Doorkeeper::OAuth::Scopes)
|
109
|
-
# * `resource_owner` - authorized resource owner instance (if present)
|
110
|
-
#
|
111
|
-
# custom_access_token_expires_in do |context|
|
112
|
-
# context.client.additional_settings.implicit_oauth_expiration
|
113
|
-
# end
|
114
|
-
|
115
|
-
# Use a custom class for generating the access token.
|
116
|
-
# See https://doorkeeper.gitbook.io/guides/configuration/other-configurations#custom-access-token-generator
|
117
|
-
#
|
118
|
-
# access_token_generator '::Doorkeeper::JWT'
|
119
|
-
|
120
|
-
# The controller +Doorkeeper::ApplicationController+ inherits from.
|
121
|
-
# Defaults to +ActionController::Base+ unless +api_only+ is set, which changes the default to
|
122
|
-
# +ActionController::API+. The return value of this option must be a stringified class name.
|
123
|
-
# See https://doorkeeper.gitbook.io/guides/configuration/other-configurations#custom-controllers
|
124
|
-
#
|
125
|
-
# base_controller 'ApplicationController'
|
126
|
-
|
127
|
-
# Reuse access token for the same resource owner within an application (disabled by default).
|
128
|
-
#
|
129
|
-
# This option protects your application from creating new tokens before old **valid** one becomes
|
130
|
-
# expired so your database doesn't bloat. Keep in mind that when this option is enabled Doorkeeper
|
131
|
-
# doesn't update existing token expiration time, it will create a new token instead if no active matching
|
132
|
-
# token found for the application, resources owner and/or set of scopes.
|
133
|
-
# Rationale: https://github.com/doorkeeper-gem/doorkeeper/issues/383
|
134
|
-
#
|
135
|
-
# You can not enable this option together with +hash_token_secrets+.
|
136
|
-
#
|
137
|
-
# reuse_access_token
|
138
|
-
|
139
|
-
# In case you enabled `reuse_access_token` option Doorkeeper will try to find matching
|
140
|
-
# token using `matching_token_for` Access Token API that searches for valid records
|
141
|
-
# in batches in order not to pollute the memory with all the database records. By default
|
142
|
-
# Doorkeeper uses batch size of 10 000 records. You can increase or decrease this value
|
143
|
-
# depending on your needs and server capabilities.
|
144
|
-
#
|
145
|
-
# token_lookup_batch_size 10_000
|
146
|
-
|
147
|
-
# Set a limit for token_reuse if using reuse_access_token option
|
148
|
-
#
|
149
|
-
# This option limits token_reusability to some extent.
|
150
|
-
# If not set then access_token will be reused unless it expires.
|
151
|
-
# Rationale: https://github.com/doorkeeper-gem/doorkeeper/issues/1189
|
152
|
-
#
|
153
|
-
# This option should be a percentage(i.e. (0,100])
|
154
|
-
#
|
155
|
-
# token_reuse_limit 100
|
156
|
-
|
157
|
-
# Only allow one valid access token obtained via client credentials
|
158
|
-
# per client. If a new access token is obtained before the old one
|
159
|
-
# expired, the old one gets revoked (disabled by default)
|
160
|
-
#
|
161
|
-
# When enabling this option, make sure that you do not expect multiple processes
|
162
|
-
# using the same credentials at the same time (e.g. web servers spanning
|
163
|
-
# multiple machines and/or processes).
|
164
|
-
#
|
165
|
-
# revoke_previous_client_credentials_token
|
166
|
-
|
167
|
-
# Hash access and refresh tokens before persisting them.
|
168
|
-
# This will disable the possibility to use +reuse_access_token+
|
169
|
-
# since plain values can no longer be retrieved.
|
170
|
-
#
|
171
|
-
# Note: If you are already a user of doorkeeper and have existing tokens
|
172
|
-
# in your installation, they will be invalid without adding 'fallback: :plain'.
|
173
|
-
#
|
174
|
-
# hash_token_secrets
|
175
|
-
# By default, token secrets will be hashed using the
|
176
|
-
# +Doorkeeper::Hashing::SHA256+ strategy.
|
177
|
-
#
|
178
|
-
# If you wish to use another hashing implementation, you can override
|
179
|
-
# this strategy as follows:
|
180
|
-
#
|
181
|
-
# hash_token_secrets using: '::Doorkeeper::Hashing::MyCustomHashImpl'
|
182
|
-
#
|
183
|
-
# Keep in mind that changing the hashing function will invalidate all existing
|
184
|
-
# secrets, if there are any.
|
185
|
-
|
186
|
-
# Hash application secrets before persisting them.
|
187
|
-
#
|
188
|
-
# hash_application_secrets
|
189
|
-
#
|
190
|
-
# By default, applications will be hashed
|
191
|
-
# with the +Doorkeeper::SecretStoring::SHA256+ strategy.
|
192
|
-
#
|
193
|
-
# If you wish to use bcrypt for application secret hashing, uncomment
|
194
|
-
# this line instead:
|
195
|
-
#
|
196
|
-
# hash_application_secrets using: '::Doorkeeper::SecretStoring::BCrypt'
|
197
|
-
|
198
|
-
# When the above option is enabled, and a hashed token or secret is not found,
|
199
|
-
# you can allow to fall back to another strategy. For users upgrading
|
200
|
-
# doorkeeper and wishing to enable hashing, you will probably want to enable
|
201
|
-
# the fallback to plain tokens.
|
202
|
-
#
|
203
|
-
# This will ensure that old access tokens and secrets
|
204
|
-
# will remain valid even if the hashing above is enabled.
|
205
|
-
#
|
206
|
-
# This can be done by adding 'fallback: plain', e.g. :
|
207
|
-
#
|
208
|
-
# hash_application_secrets using: '::Doorkeeper::SecretStoring::BCrypt', fallback: :plain
|
209
|
-
|
210
|
-
# Issue access tokens with refresh token (disabled by default), you may also
|
211
|
-
# pass a block which accepts `context` to customize when to give a refresh
|
212
|
-
# token or not. Similar to +custom_access_token_expires_in+, `context` has
|
213
|
-
# the following properties:
|
214
|
-
#
|
215
|
-
# `client` - the OAuth client application (see Doorkeeper::OAuth::Client)
|
216
|
-
# `grant_type` - the grant type of the request (see Doorkeeper::OAuth)
|
217
|
-
# `scopes` - the requested scopes (see Doorkeeper::OAuth::Scopes)
|
218
|
-
#
|
219
|
-
# use_refresh_token
|
220
|
-
|
221
|
-
# Provide support for an owner to be assigned to each registered application (disabled by default)
|
222
|
-
# Optional parameter confirmation: true (default: false) if you want to enforce ownership of
|
223
|
-
# a registered application
|
224
|
-
# NOTE: you must also run the rails g doorkeeper:application_owner generator
|
225
|
-
# to provide the necessary support
|
226
|
-
#
|
227
|
-
# enable_application_owner confirmation: false
|
228
|
-
|
229
|
-
# Define access token scopes for your provider
|
230
|
-
# For more information go to
|
231
|
-
# https://doorkeeper.gitbook.io/guides/ruby-on-rails/scopes
|
232
|
-
#
|
233
|
-
# default_scopes :public
|
234
|
-
# optional_scopes :write, :update
|
235
|
-
|
236
|
-
# Allows to restrict only certain scopes for grant_type.
|
237
|
-
# By default, all the scopes will be available for all the grant types.
|
238
|
-
#
|
239
|
-
# Keys to this hash should be the name of grant_type and
|
240
|
-
# values should be the array of scopes for that grant type.
|
241
|
-
# Note: scopes should be from configured_scopes (i.e. default or optional)
|
242
|
-
#
|
243
|
-
# scopes_by_grant_type password: [:write], client_credentials: [:update]
|
244
|
-
|
245
|
-
# Forbids creating/updating applications with arbitrary scopes that are
|
246
|
-
# not in configuration, i.e. +default_scopes+ or +optional_scopes+.
|
247
|
-
# (disabled by default)
|
248
|
-
#
|
249
|
-
# enforce_configured_scopes
|
250
|
-
|
251
|
-
# Change the way client credentials are retrieved from the request object.
|
252
|
-
# By default it retrieves first from the `HTTP_AUTHORIZATION` header, then
|
253
|
-
# falls back to the `:client_id` and `:client_secret` params from the `params` object.
|
254
|
-
# Check out https://github.com/doorkeeper-gem/doorkeeper/wiki/Changing-how-clients-are-authenticated
|
255
|
-
# for more information on customization
|
256
|
-
#
|
257
|
-
# client_credentials :from_basic, :from_params
|
258
|
-
|
259
|
-
# Change the way access token is authenticated from the request object.
|
260
|
-
# By default it retrieves first from the `HTTP_AUTHORIZATION` header, then
|
261
|
-
# falls back to the `:access_token` or `:bearer_token` params from the `params` object.
|
262
|
-
# Check out https://github.com/doorkeeper-gem/doorkeeper/wiki/Changing-how-clients-are-authenticated
|
263
|
-
# for more information on customization
|
264
|
-
#
|
265
|
-
# access_token_methods :from_bearer_authorization, :from_access_token_param, :from_bearer_param
|
266
|
-
|
267
|
-
# Forces the usage of the HTTPS protocol in non-native redirect uris (enabled
|
268
|
-
# by default in non-development environments). OAuth2 delegates security in
|
269
|
-
# communication to the HTTPS protocol so it is wise to keep this enabled.
|
270
|
-
#
|
271
|
-
# Callable objects such as proc, lambda, block or any object that responds to
|
272
|
-
# #call can be used in order to allow conditional checks (to allow non-SSL
|
273
|
-
# redirects to localhost for example).
|
274
|
-
#
|
275
|
-
# force_ssl_in_redirect_uri !Rails.env.development?
|
276
|
-
#
|
277
|
-
# force_ssl_in_redirect_uri { |uri| uri.host != 'localhost' }
|
278
|
-
|
279
|
-
# Specify what redirect URI's you want to block during Application creation.
|
280
|
-
# Any redirect URI is allowed by default.
|
281
|
-
#
|
282
|
-
# You can use this option in order to forbid URI's with 'javascript' scheme
|
283
|
-
# for example.
|
284
|
-
#
|
285
|
-
# forbid_redirect_uri { |uri| uri.scheme.to_s.downcase == 'javascript' }
|
286
|
-
|
287
|
-
# Allows to set blank redirect URIs for Applications in case Doorkeeper configured
|
288
|
-
# to use URI-less OAuth grant flows like Client Credentials or Resource Owner
|
289
|
-
# Password Credentials. The option is on by default and checks configured grant
|
290
|
-
# types, but you **need** to manually drop `NOT NULL` constraint from `redirect_uri`
|
291
|
-
# column for `oauth_applications` database table.
|
292
|
-
#
|
293
|
-
# You can completely disable this feature with:
|
294
|
-
#
|
295
|
-
# allow_blank_redirect_uri false
|
296
|
-
#
|
297
|
-
# Or you can define your custom check:
|
298
|
-
#
|
299
|
-
# allow_blank_redirect_uri do |grant_flows, client|
|
300
|
-
# client.superapp?
|
301
|
-
# end
|
302
|
-
|
303
|
-
# Specify how authorization errors should be handled.
|
304
|
-
# By default, doorkeeper renders json errors when access token
|
305
|
-
# is invalid, expired, revoked or has invalid scopes.
|
306
|
-
#
|
307
|
-
# If you want to render error response yourself (i.e. rescue exceptions),
|
308
|
-
# set +handle_auth_errors+ to `:raise` and rescue Doorkeeper::Errors::InvalidToken
|
309
|
-
# or following specific errors:
|
310
|
-
#
|
311
|
-
# Doorkeeper::Errors::TokenForbidden, Doorkeeper::Errors::TokenExpired,
|
312
|
-
# Doorkeeper::Errors::TokenRevoked, Doorkeeper::Errors::TokenUnknown
|
313
|
-
#
|
314
|
-
# handle_auth_errors :raise
|
315
|
-
|
316
|
-
# Customize token introspection response.
|
317
|
-
# Allows to add your own fields to default one that are required by the OAuth spec
|
318
|
-
# for the introspection response. It could be `sub`, `aud` and so on.
|
319
|
-
# This configuration option can be a proc, lambda or any Ruby object responds
|
320
|
-
# to `.call` method and result of it's invocation must be a Hash.
|
321
|
-
#
|
322
|
-
# custom_introspection_response do |token, context|
|
323
|
-
# {
|
324
|
-
# "sub": "Z5O3upPC88QrAjx00dis",
|
325
|
-
# "aud": "https://protected.example.net/resource",
|
326
|
-
# "username": User.find(token.resource_owner_id).username
|
327
|
-
# }
|
328
|
-
# end
|
329
|
-
#
|
330
|
-
# or
|
331
|
-
#
|
332
|
-
# custom_introspection_response CustomIntrospectionResponder
|
333
|
-
|
334
|
-
# Specify what grant flows are enabled in array of Strings. The valid
|
335
|
-
# strings and the flows they enable are:
|
336
|
-
#
|
337
|
-
# "authorization_code" => Authorization Code Grant Flow
|
338
|
-
# "implicit" => Implicit Grant Flow
|
339
|
-
# "password" => Resource Owner Password Credentials Grant Flow
|
340
|
-
# "client_credentials" => Client Credentials Grant Flow
|
341
|
-
#
|
342
|
-
# If not specified, Doorkeeper enables authorization_code and
|
343
|
-
# client_credentials.
|
344
|
-
#
|
345
|
-
# implicit and password grant flows have risks that you should understand
|
346
|
-
# before enabling:
|
347
|
-
# https://datatracker.ietf.org/doc/html/rfc6819#section-4.4.2
|
348
|
-
# https://datatracker.ietf.org/doc/html/rfc6819#section-4.4.3
|
349
|
-
#
|
350
|
-
# grant_flows %w[authorization_code client_credentials]
|
351
|
-
|
352
|
-
# Allows to customize OAuth grant flows that +each+ application support.
|
353
|
-
# You can configure a custom block (or use a class respond to `#call`) that must
|
354
|
-
# return `true` in case Application instance supports requested OAuth grant flow
|
355
|
-
# during the authorization request to the server. This configuration +doesn't+
|
356
|
-
# set flows per application, it only allows to check if application supports
|
357
|
-
# specific grant flow.
|
358
|
-
#
|
359
|
-
# For example you can add an additional database column to `oauth_applications` table,
|
360
|
-
# say `t.array :grant_flows, default: []`, and store allowed grant flows that can
|
361
|
-
# be used with this application there. Then when authorization requested Doorkeeper
|
362
|
-
# will call this block to check if specific Application (passed with client_id and/or
|
363
|
-
# client_secret) is allowed to perform the request for the specific grant type
|
364
|
-
# (authorization, password, client_credentials, etc).
|
365
|
-
#
|
366
|
-
# Example of the block:
|
367
|
-
#
|
368
|
-
# ->(flow, client) { client.grant_flows.include?(flow) }
|
369
|
-
#
|
370
|
-
# In case this option invocation result is `false`, Doorkeeper server returns
|
371
|
-
# :unauthorized_client error and stops the request.
|
372
|
-
#
|
373
|
-
# @param allow_grant_flow_for_client [Proc] Block or any object respond to #call
|
374
|
-
# @return [Boolean] `true` if allow or `false` if forbid the request
|
375
|
-
#
|
376
|
-
# allow_grant_flow_for_client do |grant_flow, client|
|
377
|
-
# # `grant_flows` is an Array column with grant
|
378
|
-
# # flows that application supports
|
379
|
-
#
|
380
|
-
# client.grant_flows.include?(grant_flow)
|
381
|
-
# end
|
382
|
-
|
383
|
-
# If you need arbitrary Resource Owner-Client authorization you can enable this option
|
384
|
-
# and implement the check your need. Config option must respond to #call and return
|
385
|
-
# true in case resource owner authorized for the specific application or false in other
|
386
|
-
# cases.
|
387
|
-
#
|
388
|
-
# Be default all Resource Owners are authorized to any Client (application).
|
389
|
-
#
|
390
|
-
# authorize_resource_owner_for_client do |client, resource_owner|
|
391
|
-
# resource_owner.admin? || client.owners_allowlist.include?(resource_owner)
|
392
|
-
# end
|
393
|
-
|
394
|
-
# Hook into the strategies' request & response life-cycle in case your
|
395
|
-
# application needs advanced customization or logging:
|
396
|
-
#
|
397
|
-
# before_successful_strategy_response do |request|
|
398
|
-
# puts "BEFORE HOOK FIRED! #{request}"
|
399
|
-
# end
|
400
|
-
#
|
401
|
-
# after_successful_strategy_response do |request, response|
|
402
|
-
# puts "AFTER HOOK FIRED! #{request}, #{response}"
|
403
|
-
# end
|
404
|
-
|
405
|
-
# Hook into Authorization flow in order to implement Single Sign Out
|
406
|
-
# or add any other functionality. Inside the block you have an access
|
407
|
-
# to `controller` (authorizations controller instance) and `context`
|
408
|
-
# (Doorkeeper::OAuth::Hooks::Context instance) which provides pre auth
|
409
|
-
# or auth objects with issued token based on hook type (before or after).
|
410
|
-
#
|
411
|
-
# before_successful_authorization do |controller, context|
|
412
|
-
# Rails.logger.info(controller.request.params.inspect)
|
413
|
-
#
|
414
|
-
# Rails.logger.info(context.pre_auth.inspect)
|
415
|
-
# end
|
416
|
-
#
|
417
|
-
# after_successful_authorization do |controller, context|
|
418
|
-
# controller.session[:logout_urls] <<
|
419
|
-
# Doorkeeper::Application
|
420
|
-
# .find_by(controller.request.params.slice(:redirect_uri))
|
421
|
-
# .logout_uri
|
422
|
-
#
|
423
|
-
# Rails.logger.info(context.auth.inspect)
|
424
|
-
# Rails.logger.info(context.issued_token)
|
425
|
-
# end
|
426
|
-
|
427
|
-
# Under some circumstances you might want to have applications auto-approved,
|
428
|
-
# so that the user skips the authorization step.
|
429
|
-
# For example if dealing with a trusted application.
|
430
|
-
#
|
431
|
-
# skip_authorization do |resource_owner, client|
|
432
|
-
# client.superapp? or resource_owner.admin?
|
433
|
-
# end
|
434
|
-
|
435
|
-
# Configure custom constraints for the Token Introspection request.
|
436
|
-
# By default this configuration option allows to introspect a token by another
|
437
|
-
# token of the same application, OR to introspect the token that belongs to
|
438
|
-
# authorized client (from authenticated client) OR when token doesn't
|
439
|
-
# belong to any client (public token). Otherwise requester has no access to the
|
440
|
-
# introspection and it will return response as stated in the RFC.
|
441
|
-
#
|
442
|
-
# Block arguments:
|
443
|
-
#
|
444
|
-
# @param token [Doorkeeper::AccessToken]
|
445
|
-
# token to be introspected
|
446
|
-
#
|
447
|
-
# @param authorized_client [Doorkeeper::Application]
|
448
|
-
# authorized client (if request is authorized using Basic auth with
|
449
|
-
# Client Credentials for example)
|
450
|
-
#
|
451
|
-
# @param authorized_token [Doorkeeper::AccessToken]
|
452
|
-
# Bearer token used to authorize the request
|
453
|
-
#
|
454
|
-
# In case the block returns `nil` or `false` introspection responses with 401 status code
|
455
|
-
# when using authorized token to introspect, or you'll get 200 with { "active": false } body
|
456
|
-
# when using authorized client to introspect as stated in the
|
457
|
-
# RFC 7662 section 2.2. Introspection Response.
|
458
|
-
#
|
459
|
-
# Using with caution:
|
460
|
-
# Keep in mind that these three parameters pass to block can be nil as following case:
|
461
|
-
# `authorized_client` is nil if and only if `authorized_token` is present, and vice versa.
|
462
|
-
# `token` will be nil if and only if `authorized_token` is present.
|
463
|
-
# So remember to use `&` or check if it is present before calling method on
|
464
|
-
# them to make sure you doesn't get NoMethodError exception.
|
465
|
-
#
|
466
|
-
# You can define your custom check:
|
467
|
-
#
|
468
|
-
# allow_token_introspection do |token, authorized_client, authorized_token|
|
469
|
-
# if authorized_token
|
470
|
-
# # customize: require `introspection` scope
|
471
|
-
# authorized_token.application == token&.application ||
|
472
|
-
# authorized_token.scopes.include?("introspection")
|
473
|
-
# elsif token.application
|
474
|
-
# # `protected_resource` is a new database boolean column, for example
|
475
|
-
# authorized_client == token.application || authorized_client.protected_resource?
|
476
|
-
# else
|
477
|
-
# # public token (when token.application is nil, token doesn't belong to any application)
|
478
|
-
# true
|
479
|
-
# end
|
480
|
-
# end
|
481
|
-
#
|
482
|
-
# Or you can completely disable any token introspection:
|
483
|
-
#
|
484
|
-
# allow_token_introspection false
|
485
|
-
#
|
486
|
-
# If you need to block the request at all, then configure your routes.rb or web-server
|
487
|
-
# like nginx to forbid the request.
|
488
|
-
|
489
|
-
# WWW-Authenticate Realm (default: "Doorkeeper").
|
490
|
-
#
|
491
|
-
# realm "Doorkeeper"
|
492
|
-
end
|
data/lib/json_key.rb
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Returns the PostgreSQL statement to get a JSON object field as text. Note this work for both
|
4
|
-
# JSON and JSONB type columns. More details:
|
5
|
-
# https://www.postgresql.org/docs/current/functions-json.html
|
6
|
-
class JSONKey < Arel::Nodes::InfixOperation
|
7
|
-
def initialize(left, right)
|
8
|
-
super("->>", left, Arel::Nodes.build_quoted(right))
|
9
|
-
end
|
10
|
-
end
|
File without changes
|
File without changes
|
/data/app/forms/{decidim → concerns/decidim}/action_delegator/consultations/vote_form_override.rb
RENAMED
File without changes
|
/data/app/models/{decidim → concerns/decidim}/action_delegator/consultations/vote_override.rb
RENAMED
File without changes
|
File without changes
|