Skip to content

Commit

Permalink
Remove :see, page ability
Browse files Browse the repository at this point in the history
This ability has only be used for the breadcrumb.
Since the breadcrumb does not include any non-published pages anymore,
we do not need this ability anymore.
  • Loading branch information
tvdeyen committed Feb 5, 2021
1 parent 018e22e commit b6e0af9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
2 changes: 0 additions & 2 deletions lib/alchemy/permissions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ def initialize(user)
module GuestUser
def alchemy_guest_user_rules
can([:show, :download], Alchemy::Attachment) { |a| !a.restricted? }
can :see, Alchemy::Page, restricted: false

can :read, Alchemy::Content, Alchemy::Content.available.not_restricted do |c|
c.public? && !c.restricted?
Expand Down Expand Up @@ -64,7 +63,6 @@ def alchemy_member_rules

# Resources
can [:show, :download], Alchemy::Attachment
can :see, Alchemy::Page, restricted: true

can :read, Alchemy::Content, Alchemy::Content.available do |c|
c.public?
Expand Down
13 changes: 2 additions & 11 deletions spec/libraries/permissions_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@
is_expected.not_to be_able_to(:index, restricted_page)
end

it "can only see public not restricted pages" do
is_expected.to be_able_to(:see, public_page)
is_expected.not_to be_able_to(:see, restricted_page)
end

it "can only see public not restricted elements" do
is_expected.to be_able_to(:show, published_element)
is_expected.not_to be_able_to(:show, restricted_element)
Expand Down Expand Up @@ -79,10 +74,6 @@
is_expected.to be_able_to(:index, restricted_page)
end

it "can see restricted pages" do
is_expected.to be_able_to(:see, restricted_page)
end

it "can see public restricted elements" do
is_expected.to be_able_to(:show, published_element)
is_expected.to be_able_to(:show, restricted_element)
Expand Down Expand Up @@ -213,8 +204,8 @@
let(:user) { mock_model(Alchemy.user_class, alchemy_roles: []) }

it "can only see public not restricted pages (like the guest role)" do
is_expected.to be_able_to(:see, public_page)
is_expected.not_to be_able_to(:see, restricted_page)
is_expected.to be_able_to(:show, public_page)
is_expected.not_to be_able_to(:show, restricted_page)
end
end
end

0 comments on commit b6e0af9

Please sign in to comment.