From 8e2ac2cd512a9dd8ed1013003a4e8ff85a86db2d Mon Sep 17 00:00:00 2001 From: davidg73 <david.gunnarsson@univie.ac.at> Date: Thu, 17 Apr 2025 13:21:15 +0200 Subject: [PATCH] Temporarily make basics editable if this will be like that in the future will be discussed, but for the first testing phase --- app/policies/copyright_policy.rb | 6 +++--- app/policies/image_size_policy.rb | 6 +++--- app/policies/literature_policy.rb | 6 +++--- app/policies/text_policy.rb | 6 +++--- spec/policies/copyright_policy_spec.rb | 6 +++--- spec/policies/image_size_policy_spec.rb | 6 +++--- spec/policies/literature_policy_spec.rb | 6 +++--- spec/policies/text_policy_spec.rb | 6 +++--- 8 files changed, 24 insertions(+), 24 deletions(-) diff --git a/app/policies/copyright_policy.rb b/app/policies/copyright_policy.rb index cd7d64e..9edc387 100644 --- a/app/policies/copyright_policy.rb +++ b/app/policies/copyright_policy.rb @@ -10,15 +10,15 @@ class CopyrightPolicy < ApplicationPolicy end def create? - false + user? && user.admin? end def update? - false + user? && user.admin? end def destroy? - false + user? && user.admin? end class Scope < ApplicationPolicy::Scope diff --git a/app/policies/image_size_policy.rb b/app/policies/image_size_policy.rb index 0106e32..9399031 100644 --- a/app/policies/image_size_policy.rb +++ b/app/policies/image_size_policy.rb @@ -10,15 +10,15 @@ class ImageSizePolicy < ApplicationPolicy end def create? - false + user? && user.admin? end def update? - false + user? && user.admin? end def destroy? - false + user? && user.admin? end class Scope < ApplicationPolicy::Scope diff --git a/app/policies/literature_policy.rb b/app/policies/literature_policy.rb index dbc0f58..ced8f7d 100644 --- a/app/policies/literature_policy.rb +++ b/app/policies/literature_policy.rb @@ -10,15 +10,15 @@ class LiteraturePolicy < ApplicationPolicy end def create? - false + user? && user.admin? end def update? - false + user? && user.admin? end def destroy? - false + user? && user.admin? end class Scope < ApplicationPolicy::Scope diff --git a/app/policies/text_policy.rb b/app/policies/text_policy.rb index e037528..ddddc26 100644 --- a/app/policies/text_policy.rb +++ b/app/policies/text_policy.rb @@ -10,15 +10,15 @@ class TextPolicy < ApplicationPolicy end def create? - false + user? && user.admin? end def update? - false + user? && user.admin? end def destroy? - false + user? && user.admin? end class Scope < ApplicationPolicy::Scope diff --git a/spec/policies/copyright_policy_spec.rb b/spec/policies/copyright_policy_spec.rb index 11639a8..d6cd66f 100644 --- a/spec/policies/copyright_policy_spec.rb +++ b/spec/policies/copyright_policy_spec.rb @@ -39,9 +39,9 @@ RSpec.describe CopyrightPolicy do it { is_expected.to permit_action(:index) } it { is_expected.to permit_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } - it { is_expected.to forbid_action(:destroy) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } + it { is_expected.to permit_action(:destroy) } end describe "Scope" do diff --git a/spec/policies/image_size_policy_spec.rb b/spec/policies/image_size_policy_spec.rb index 58cd7ee..24c3b7c 100644 --- a/spec/policies/image_size_policy_spec.rb +++ b/spec/policies/image_size_policy_spec.rb @@ -39,9 +39,9 @@ RSpec.describe ImageSizePolicy do it { is_expected.to permit_action(:index) } it { is_expected.to permit_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } - it { is_expected.to forbid_action(:destroy) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } + it { is_expected.to permit_action(:destroy) } end describe "Scope" do diff --git a/spec/policies/literature_policy_spec.rb b/spec/policies/literature_policy_spec.rb index 4739c49..ea5b878 100644 --- a/spec/policies/literature_policy_spec.rb +++ b/spec/policies/literature_policy_spec.rb @@ -39,9 +39,9 @@ RSpec.describe LiteraturePolicy do it { is_expected.to permit_action(:index) } it { is_expected.to permit_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } - it { is_expected.to forbid_action(:destroy) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } + it { is_expected.to permit_action(:destroy) } end describe "Scope" do diff --git a/spec/policies/text_policy_spec.rb b/spec/policies/text_policy_spec.rb index 3907b75..a992ca6 100644 --- a/spec/policies/text_policy_spec.rb +++ b/spec/policies/text_policy_spec.rb @@ -39,9 +39,9 @@ RSpec.describe TextPolicy do it { is_expected.to permit_action(:index) } it { is_expected.to permit_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } - it { is_expected.to forbid_action(:destroy) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } + it { is_expected.to permit_action(:destroy) } end describe "Scope" do -- GitLab