Skip to content

Commit

Permalink
Add tos to allowed controllers when force authorizations enabled (#368)
Browse files Browse the repository at this point in the history
* add tos to allowed controllers

* update tests
  • Loading branch information
microstudi authored Feb 22, 2025
1 parent b79d515 commit 9eea15b
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 5 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:

- run: tar -zcf /tmp/testapp-env.tar.gz ./spec/decidim_dummy_app

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: workspace
path: /tmp/testapp-env.tar.gz
Expand Down Expand Up @@ -139,7 +139,7 @@ jobs:
- run: |
sudo apt install wkhtmltopdf imagemagick 7zip
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: workspace
path: /tmp
Expand All @@ -165,7 +165,7 @@ jobs:
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: always()
with:
name: screenshots
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
CHANGELOG
=========

Unreleased
-------
Compatibility:
- Decidim 0.28.x

Features:
- Fix allowing to accept terms and conditions when forced verifications enabled

v0.11.3
-------
Compatibility:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def current_authorizations
end

def allowed_controllers
%w(required_authorizations authorizations upload_validations timeouts editor_images locales) + awesome_config[:force_authorization_allowed_controller_names].to_a
%w(required_authorizations authorizations upload_validations timeouts editor_images locales pages tos) + awesome_config[:force_authorization_allowed_controller_names].to_a
end
end
end
Expand Down
3 changes: 2 additions & 1 deletion lib/decidim/decidim_awesome/awesome.rb
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,9 @@ module DecidimAwesome
end

# This controllers will be skipped from the authorization check
# Included automatically: required_authorizations authorizations upload_validations timeouts editor_images locales pages tos
config_accessor :force_authorization_allowed_controller_names do
%w(account pages)
%w(account)
end

# How old must be the private data to be considered expired and therefore presented to the admins for deletion
Expand Down
12 changes: 12 additions & 0 deletions spec/system/public/forced_verifications_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,18 @@
end
end

context "when the user has not accepted the terms an conditions" do
let(:user) { create(:user, :confirmed, organization:, accepted_tos_version: nil) }

it "user can accept the terms and conditions" do
expect(page).to have_current_path("/pages/terms-of-service")
click_on "I agree with these terms"
expect(user.reload.accepted_tos_version).not_to be_nil
expect(page).to have_current_path(decidim_decidim_awesome.required_authorizations_path(redirect_url: restricted_path))
expect(page).to have_content("you need to authorize your account with a valid authorization")
end
end

context "when is an admin" do
let(:user) { create(:user, :confirmed, :admin, organization:) }

Expand Down

0 comments on commit 9eea15b

Please sign in to comment.