Only admins can edit entropy

This commit is contained in:
Jorge Manrubia
2025-11-12 11:33:41 +01:00
parent e67cdd986f
commit b7729401b4
2 changed files with 9 additions and 0 deletions
@@ -1,4 +1,6 @@
class Account::EntropiesController < ApplicationController
before_action :ensure_admin
def update
Account.sole.entropy.update!(entropy_params)
redirect_to account_settings_path, notice: "Account updated"
@@ -12,4 +12,11 @@ class Account::EntropiesControllerTest < ActionDispatch::IntegrationTest
assert_redirected_to account_settings_path
end
test "update requires admin" do
logout_and_sign_in_as :david
put account_entropy_path, params: { entropy: { auto_postpone_period: 1.day } }
assert_response :forbidden
end
end