Sha256: 6619f8029dbd96684ad88f564cb240970a8a62911177f9be76800fbc6071dc35

Contents?: true

Size: 783 Bytes

Versions: 78

Compression:

Stored size: 783 Bytes

Contents

module Ddr::Auth
  RSpec.describe EffectivePermissions do

    let(:resource) { FactoryGirl.build(:item) }
    let(:policy) { Collection.new(pid: "coll:1") }
    let(:agents) { [ "Editors", "bob@example.com" ] }
    
    before do
      resource.admin_policy = policy
      resource.roles.grant FactoryGirl.build(:role, :downloader, :public)
      policy.roles.grant type: "Editor", agent: "Editors", scope: "policy"
    end

    it "should return the list of permissions granted to the agents on the resource in resource scope, plus the permissions granted to the agents on the resource's policy in policy scope" do
      expect(described_class.call(resource, agents))
        .to contain_exactly(:read, :download, :add_children, :update, :replace, :arrange)
    end
    
  end
end

Version data entries

78 entries across 78 versions & 1 rubygems

Version Path
ddr-models-2.6.2 spec/auth/effective_permissions_spec.rb
ddr-models-2.6.1 spec/auth/effective_permissions_spec.rb
ddr-models-2.6.0 spec/auth/effective_permissions_spec.rb
ddr-models-2.6.0.rc4 spec/auth/effective_permissions_spec.rb
ddr-models-2.6.0.rc3 spec/auth/effective_permissions_spec.rb
ddr-models-2.6.0.rc2 spec/auth/effective_permissions_spec.rb
ddr-models-2.6.0.rc1 spec/auth/effective_permissions_spec.rb
ddr-models-2.5.3 spec/auth/effective_permissions_spec.rb
ddr-models-2.5.2 spec/auth/effective_permissions_spec.rb
ddr-models-2.5.1 spec/auth/effective_permissions_spec.rb
ddr-models-2.5.0 spec/auth/effective_permissions_spec.rb
ddr-models-2.5.0.rc1 spec/auth/effective_permissions_spec.rb
ddr-models-2.4.16 spec/auth/effective_permissions_spec.rb
ddr-models-2.4.15 spec/auth/effective_permissions_spec.rb
ddr-models-2.4.14 spec/auth/effective_permissions_spec.rb
ddr-models-2.4.13 spec/auth/effective_permissions_spec.rb
ddr-models-2.4.12 spec/auth/effective_permissions_spec.rb
ddr-models-2.4.11 spec/auth/effective_permissions_spec.rb
ddr-models-2.4.10 spec/auth/effective_permissions_spec.rb
ddr-models-2.4.9 spec/auth/effective_permissions_spec.rb