ddr-models 1.9.0 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -1
- data/config/initializers/devise.rb +1 -0
- data/config/locales/groups.en.yml +6 -0
- data/db/migrate/20150130134416_add_user_key_to_events.rb +7 -0
- data/lib/ddr/auth.rb +6 -0
- data/lib/ddr/auth/ability.rb +0 -1
- data/lib/ddr/auth/failure_app.rb +16 -0
- data/lib/ddr/events/event.rb +9 -3
- data/lib/ddr/models/version.rb +1 -1
- data/spec/controllers/application_controller_spec.rb +22 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/schema.rb +2 -1
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +3509 -6644
- data/spec/dummy/log/test.log +81324 -125780
- data/spec/models/ability_spec.rb +109 -53
- data/spec/routing/user_routing_spec.rb +26 -0
- data/spec/spec_helper.rb +2 -0
- data/spec/support/shared_examples_for_events.rb +3 -1
- metadata +9 -22
- data/app/controllers/users/sessions_controller.rb~ +0 -11
- data/lib/ddr/managers/#index_manager.rb# +0 -21
- data/lib/ddr/metadata/#permanent_id_record.rb# +0 -13
- data/lib/ddr/models/#has_ezid_identifier.rb# +0 -26
- data/lib/ddr/models/#has_permanent_identifier.rb# +0 -9
- data/lib/ddr/models/#index_fields.rb# +0 -13
- data/spec/dummy/log/production.log +0 -5
- data/spec/dummy/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
    
        data/spec/models/ability_spec.rb
    CHANGED
    
    | @@ -10,10 +10,12 @@ module Ddr | |
| 10 10 |  | 
| 11 11 | 
             
                  describe "collection permissions" do
         | 
| 12 12 | 
             
                    before { allow(Ddr::Auth).to receive(:collection_creators_group) { "Collection Creators" } }
         | 
| 13 | 
            +
             | 
| 13 14 | 
             
                    context "user is a collection creator" do
         | 
| 14 15 | 
             
                      before { allow(user).to receive(:groups) { ["Collection Creators"] } }
         | 
| 15 16 | 
             
                      it { is_expected.to be_able_to(:create, Collection) }
         | 
| 16 17 | 
             
                    end
         | 
| 18 | 
            +
             | 
| 17 19 | 
             
                    context "user is not a collection creator" do
         | 
| 18 20 | 
             
                      it { is_expected.not_to be_able_to(:create, Collection) }
         | 
| 19 21 | 
             
                    end
         | 
| @@ -21,10 +23,12 @@ module Ddr | |
| 21 23 |  | 
| 22 24 | 
             
                  describe "#upload_permissions", uploads: true do
         | 
| 23 25 | 
             
                    let(:resource) { FactoryGirl.build(:component) }
         | 
| 26 | 
            +
             | 
| 24 27 | 
             
                    context "user has edit permission" do
         | 
| 25 28 | 
             
                      before { subject.can(:edit, resource) }
         | 
| 26 29 | 
             
                      it { is_expected.to be_able_to(:upload, resource) }
         | 
| 27 30 | 
             
                    end
         | 
| 31 | 
            +
             | 
| 28 32 | 
             
                    context "user does not have edit permission" do
         | 
| 29 33 | 
             
                      before { subject.cannot(:edit, resource) }
         | 
| 30 34 | 
             
                      it { is_expected.not_to be_able_to(:upload, resource) }
         | 
| @@ -32,64 +36,84 @@ module Ddr | |
| 32 36 | 
             
                  end
         | 
| 33 37 |  | 
| 34 38 | 
             
                  describe "#download_permissions", downloads: true do
         | 
| 39 | 
            +
             | 
| 35 40 | 
             
                    context "on an object" do
         | 
| 41 | 
            +
             | 
| 36 42 | 
             
                      context "which is a Component", components: true do
         | 
| 37 | 
            -
                        let | 
| 43 | 
            +
                        let(:resource) { Component.new(pid: "test:1") }
         | 
| 44 | 
            +
             | 
| 38 45 | 
             
                        context "and user does NOT have the downloader role" do
         | 
| 46 | 
            +
                          before do
         | 
| 47 | 
            +
                            allow(subject.current_user).to receive(:has_role?).with(resource, :downloader) { false }
         | 
| 48 | 
            +
                          end
         | 
| 49 | 
            +
             | 
| 39 50 | 
             
                          context "and user has edit permission" do
         | 
| 40 | 
            -
                            before  | 
| 41 | 
            -
                              resource.edit_users = [user.user_key]
         | 
| 42 | 
            -
                              resource.save
         | 
| 43 | 
            -
                            end
         | 
| 51 | 
            +
                            before { subject.can :edit, resource }
         | 
| 44 52 | 
             
                            it { is_expected.to be_able_to(:download, resource) }
         | 
| 45 53 | 
             
                          end
         | 
| 54 | 
            +
             | 
| 46 55 | 
             
                          context "and user has read permission" do
         | 
| 47 56 | 
             
                            before do
         | 
| 48 | 
            -
                               | 
| 49 | 
            -
                              resource | 
| 57 | 
            +
                              subject.cannot :edit, resource
         | 
| 58 | 
            +
                              subject.can :read, resource
         | 
| 50 59 | 
             
                            end
         | 
| 51 60 | 
             
                            it { is_expected.not_to be_able_to(:download, resource) }
         | 
| 52 61 | 
             
                          end
         | 
| 62 | 
            +
             | 
| 53 63 | 
             
                          context "and user lacks read permission" do
         | 
| 64 | 
            +
                            before do
         | 
| 65 | 
            +
                              subject.cannot :edit, resource
         | 
| 66 | 
            +
                              subject.cannot :read, resource
         | 
| 67 | 
            +
                            end
         | 
| 54 68 | 
             
                            it { is_expected.not_to be_able_to(:download, resource) }
         | 
| 55 69 | 
             
                          end
         | 
| 56 70 | 
             
                        end
         | 
| 71 | 
            +
             | 
| 57 72 | 
             
                        # Component
         | 
| 58 73 | 
             
                        context "and user has the downloader role", roles: true do
         | 
| 59 74 | 
             
                          before do
         | 
| 60 | 
            -
                             | 
| 61 | 
            -
                            resource.save
         | 
| 75 | 
            +
                            allow(subject.current_user).to receive(:has_role?).with(resource, :downloader) { true }
         | 
| 62 76 | 
             
                          end
         | 
| 77 | 
            +
             | 
| 63 78 | 
             
                          context "and user has edit permission" do
         | 
| 64 | 
            -
                            before  | 
| 65 | 
            -
                              resource.edit_users = [user.user_key]
         | 
| 66 | 
            -
                              resource.save
         | 
| 67 | 
            -
                            end
         | 
| 79 | 
            +
                            before { subject.can :edit, resource }
         | 
| 68 80 | 
             
                            it { is_expected.to be_able_to(:download, resource) }
         | 
| 69 81 | 
             
                          end
         | 
| 82 | 
            +
             | 
| 70 83 | 
             
                          context "and user has read permission" do
         | 
| 71 84 | 
             
                            before do
         | 
| 72 | 
            -
                               | 
| 73 | 
            -
                              resource | 
| 85 | 
            +
                              subject.cannot :edit, resource
         | 
| 86 | 
            +
                              subject.can :read, resource
         | 
| 74 87 | 
             
                            end
         | 
| 75 88 | 
             
                            it { is_expected.to be_able_to(:download, resource) }
         | 
| 76 89 | 
             
                          end
         | 
| 90 | 
            +
             | 
| 77 91 | 
             
                          context "and user lacks read permission" do
         | 
| 92 | 
            +
                            before do
         | 
| 93 | 
            +
                              subject.cannot :edit, resource
         | 
| 94 | 
            +
                              subject.cannot :read, resource
         | 
| 95 | 
            +
                            end
         | 
| 78 96 | 
             
                            it { is_expected.not_to be_able_to(:download, resource) }
         | 
| 79 97 | 
             
                          end          
         | 
| 80 98 | 
             
                        end
         | 
| 81 99 | 
             
                      end
         | 
| 82 100 |  | 
| 83 101 | 
             
                      context "which is not a Component" do
         | 
| 84 | 
            -
                        let(:resource) { FactoryGirl. | 
| 102 | 
            +
                        let(:resource) { FactoryGirl.build(:test_content) }
         | 
| 103 | 
            +
             | 
| 85 104 | 
             
                        context "and user has read permission" do
         | 
| 86 105 | 
             
                          before do
         | 
| 87 | 
            -
                             | 
| 88 | 
            -
                            resource | 
| 106 | 
            +
                            subject.cannot :edit, resource
         | 
| 107 | 
            +
                            subject.can :read, resource
         | 
| 89 108 | 
             
                          end
         | 
| 90 109 | 
             
                          it { is_expected.to be_able_to(:download, resource) }
         | 
| 91 110 | 
             
                        end
         | 
| 111 | 
            +
             | 
| 92 112 | 
             
                        context "and user lacks read permission" do
         | 
| 113 | 
            +
                          before do
         | 
| 114 | 
            +
                            subject.cannot :edit, resource
         | 
| 115 | 
            +
                            subject.cannot :read, resource
         | 
| 116 | 
            +
                          end
         | 
| 93 117 | 
             
                          it { is_expected.not_to be_able_to(:download, resource) }
         | 
| 94 118 | 
             
                        end                  
         | 
| 95 119 | 
             
                      end
         | 
| @@ -97,45 +121,58 @@ module Ddr | |
| 97 121 |  | 
| 98 122 | 
             
                    context "on a Solr document" do
         | 
| 99 123 | 
             
                      let(:resource) { SolrDocument.new(doc) }
         | 
| 124 | 
            +
             | 
| 100 125 | 
             
                      context "for a Component" do
         | 
| 101 126 | 
             
                        let(:doc) { {'id'=>'test:1', 'active_fedora_model_ssi'=>'Component'} }
         | 
| 127 | 
            +
             | 
| 102 128 | 
             
                        context "on which the user has the downloader role" do
         | 
| 103 129 | 
             
                          before { doc.merge!('admin_metadata__downloader_ssim'=>[user.to_s]) }
         | 
| 130 | 
            +
             | 
| 104 131 | 
             
                          context "but does not have read permission" do
         | 
| 105 132 | 
             
                            it { is_expected.not_to be_able_to(:download, resource) }
         | 
| 106 133 | 
             
                          end
         | 
| 134 | 
            +
             | 
| 107 135 | 
             
                          context "and has read permission" do
         | 
| 108 136 | 
             
                            before { doc.merge!('read_access_person_ssim'=>[user.to_s]) }
         | 
| 109 137 | 
             
                            it { is_expected.to be_able_to(:download, resource) }
         | 
| 110 138 | 
             
                          end
         | 
| 139 | 
            +
             | 
| 111 140 | 
             
                          context "and has edit permission" do
         | 
| 112 141 | 
             
                            before { doc.merge!('edit_access_person_ssim'=>[user.to_s]) }
         | 
| 113 142 | 
             
                            it { is_expected.to be_able_to(:download, resource) }
         | 
| 114 143 | 
             
                          end
         | 
| 115 144 | 
             
                        end
         | 
| 145 | 
            +
             | 
| 116 146 | 
             
                        context "on which the user does NOT have the downloader role" do
         | 
| 147 | 
            +
             | 
| 117 148 | 
             
                          context "and does not have read permission" do
         | 
| 118 149 | 
             
                            it { is_expected.not_to be_able_to(:download, resource) }
         | 
| 119 150 | 
             
                          end
         | 
| 151 | 
            +
             | 
| 120 152 | 
             
                          context "but has read permission" do
         | 
| 121 153 | 
             
                            before { doc.merge!('read_access_person_ssim'=>[user.to_s]) }
         | 
| 122 154 | 
             
                            it { is_expected.not_to be_able_to(:download, resource) }
         | 
| 123 155 | 
             
                          end
         | 
| 156 | 
            +
             | 
| 124 157 | 
             
                          context "but has edit permission" do
         | 
| 125 158 | 
             
                            before { doc.merge!('edit_access_person_ssim'=>[user.to_s]) }
         | 
| 126 159 | 
             
                            it { is_expected.to be_able_to(:download, resource) }
         | 
| 127 160 | 
             
                          end              
         | 
| 128 161 | 
             
                        end
         | 
| 129 162 | 
             
                      end
         | 
| 163 | 
            +
             | 
| 130 164 | 
             
                      context "for a non-Component" do
         | 
| 131 165 | 
             
                        let(:doc) { {'id'=>'test:1', 'active_fedora_model_ssi'=>'Attachment'} }
         | 
| 166 | 
            +
             | 
| 132 167 | 
             
                        context "on which the user does NOT have read permission" do
         | 
| 133 168 | 
             
                          it { is_expected.not_to be_able_to(:download, resource) }
         | 
| 134 169 | 
             
                        end
         | 
| 170 | 
            +
             | 
| 135 171 | 
             
                        context "on which the user has read permission" do
         | 
| 136 172 | 
             
                          before { doc.merge!('read_access_person_ssim'=>[user.to_s]) }
         | 
| 137 173 | 
             
                          it { is_expected.to be_able_to(:download, resource) }
         | 
| 138 174 | 
             
                        end
         | 
| 175 | 
            +
             | 
| 139 176 | 
             
                        context "on which the user has edit permission" do
         | 
| 140 177 | 
             
                          before { doc.merge!('edit_access_person_ssim'=>[user.to_s]) }
         | 
| 141 178 | 
             
                          it { is_expected.to be_able_to(:download, resource) }
         | 
| @@ -144,51 +181,63 @@ module Ddr | |
| 144 181 | 
             
                    end
         | 
| 145 182 |  | 
| 146 183 | 
             
                    context "on a datastream", datastreams: true do
         | 
| 184 | 
            +
             | 
| 147 185 | 
             
                      context "named 'content'", content: true do
         | 
| 148 186 | 
             
                        let(:resource) { obj.content }
         | 
| 187 | 
            +
                        let(:solr_doc) { SolrDocument.new({id: obj.pid}) }
         | 
| 188 | 
            +
                        before do
         | 
| 189 | 
            +
                          allow(subject).to receive(:solr_doc).with(obj.pid) { solr_doc }
         | 
| 190 | 
            +
                          subject.cannot :edit, obj.pid 
         | 
| 191 | 
            +
                        end
         | 
| 192 | 
            +
             | 
| 149 193 | 
             
                        context "and object is a Component", components: true do
         | 
| 150 | 
            -
                          let(:obj) {  | 
| 151 | 
            -
             | 
| 194 | 
            +
                          let(:obj) { Component.new(pid: "test:1") }
         | 
| 195 | 
            +
             | 
| 196 | 
            +
                          context "and user does not have the downloader role" do            
         | 
| 197 | 
            +
                            before do
         | 
| 198 | 
            +
                              allow(subject.current_user).to receive(:has_role?).with(solr_doc, :downloader) { false } 
         | 
| 199 | 
            +
                            end
         | 
| 200 | 
            +
             | 
| 152 201 | 
             
                            context "and user has read permission on the object" do
         | 
| 153 | 
            -
                              before  | 
| 154 | 
            -
                                obj.read_users = [user.user_key]
         | 
| 155 | 
            -
                                obj.save
         | 
| 156 | 
            -
                              end
         | 
| 202 | 
            +
                              before { subject.can :read, obj.pid }
         | 
| 157 203 | 
             
                              it { is_expected.not_to be_able_to(:download, resource) }
         | 
| 158 204 | 
             
                            end
         | 
| 205 | 
            +
             | 
| 159 206 | 
             
                            context "and user lacks read permission on the object" do
         | 
| 207 | 
            +
                              before { subject.cannot :read, obj.pid }
         | 
| 160 208 | 
             
                              it { is_expected.not_to be_able_to(:download, resource) }
         | 
| 161 209 | 
             
                            end
         | 
| 162 210 | 
             
                          end
         | 
| 211 | 
            +
             | 
| 163 212 | 
             
                          # Component content datastream
         | 
| 164 213 | 
             
                          context "and user has the downloader role", roles: true do
         | 
| 165 214 | 
             
                            before do
         | 
| 166 | 
            -
                               | 
| 167 | 
            -
                              obj.save
         | 
| 215 | 
            +
                              allow(subject.current_user).to receive(:has_role?).with(solr_doc, :downloader) { true } 
         | 
| 168 216 | 
             
                            end
         | 
| 217 | 
            +
             | 
| 169 218 | 
             
                            context "and user has read permission on the object" do
         | 
| 170 | 
            -
                              before  | 
| 171 | 
            -
                                obj.read_users = [user.user_key]
         | 
| 172 | 
            -
                                obj.save
         | 
| 173 | 
            -
                              end
         | 
| 219 | 
            +
                              before { subject.can :read, obj.pid }
         | 
| 174 220 | 
             
                              it { is_expected.to be_able_to(:download, resource) }
         | 
| 175 221 | 
             
                            end
         | 
| 222 | 
            +
             | 
| 176 223 | 
             
                            context "and user lacks read permission on the object" do
         | 
| 224 | 
            +
                              before { subject.cannot :read, obj.pid }
         | 
| 177 225 | 
             
                              it { is_expected.not_to be_able_to(:download, resource) }
         | 
| 178 226 | 
             
                            end          
         | 
| 179 227 | 
             
                          end
         | 
| 180 228 | 
             
                        end
         | 
| 229 | 
            +
             | 
| 181 230 | 
             
                        # non-Component content datastream
         | 
| 182 231 | 
             
                        context "and object is not a Component" do
         | 
| 183 | 
            -
                          let(:obj) {  | 
| 232 | 
            +
                          let(:obj) { TestContent.new(pid: "test:1") }
         | 
| 233 | 
            +
             | 
| 184 234 | 
             
                          context "and user has read permission on the object" do
         | 
| 185 | 
            -
                            before  | 
| 186 | 
            -
                              obj.read_users = [user.user_key]
         | 
| 187 | 
            -
                              obj.save
         | 
| 188 | 
            -
                            end
         | 
| 235 | 
            +
                            before { subject.can :read, obj.pid }
         | 
| 189 236 | 
             
                            it { is_expected.to be_able_to(:download, resource) }
         | 
| 190 237 | 
             
                          end
         | 
| 238 | 
            +
             | 
| 191 239 | 
             
                          context "and user lacks read permission on the object" do
         | 
| 240 | 
            +
                            before { subject.cannot :read, obj.pid }
         | 
| 192 241 | 
             
                            it { is_expected.not_to be_able_to(:download, resource) }
         | 
| 193 242 | 
             
                          end                  
         | 
| 194 243 | 
             
                        end
         | 
| @@ -196,16 +245,22 @@ module Ddr | |
| 196 245 | 
             
                      end
         | 
| 197 246 | 
             
                      # datastream - not "content"
         | 
| 198 247 | 
             
                      context "not named 'content'" do
         | 
| 199 | 
            -
                        let(:obj) { FactoryGirl. | 
| 248 | 
            +
                        let(:obj) { FactoryGirl.build(:test_model) }
         | 
| 200 249 | 
             
                        let(:resource) { obj.descMetadata }
         | 
| 250 | 
            +
             | 
| 201 251 | 
             
                        context "and user has read permission on the object" do
         | 
| 202 252 | 
             
                          before do
         | 
| 203 | 
            -
                             | 
| 204 | 
            -
                            obj. | 
| 253 | 
            +
                            subject.cannot :edit, obj.pid 
         | 
| 254 | 
            +
                            subject.can :read, obj.pid 
         | 
| 205 255 | 
             
                          end
         | 
| 206 256 | 
             
                          it { is_expected.to be_able_to(:download, resource) }
         | 
| 207 257 | 
             
                        end
         | 
| 258 | 
            +
             | 
| 208 259 | 
             
                        context "and user lacks read permission on the object" do
         | 
| 260 | 
            +
                          before do
         | 
| 261 | 
            +
                            subject.cannot :edit, obj.pid 
         | 
| 262 | 
            +
                            subject.cannot :read, obj.pid 
         | 
| 263 | 
            +
                          end
         | 
| 209 264 | 
             
                          it { is_expected.not_to be_able_to(:download, resource) }
         | 
| 210 265 | 
             
                        end        
         | 
| 211 266 | 
             
                      end
         | 
| @@ -219,38 +274,35 @@ module Ddr | |
| 219 274 | 
             
                  end
         | 
| 220 275 |  | 
| 221 276 | 
             
                  describe "#events_permissions", events: true do
         | 
| 222 | 
            -
                    let(: | 
| 223 | 
            -
             | 
| 224 | 
            -
                    context " | 
| 225 | 
            -
                      before {  | 
| 277 | 
            +
                    let(:resource) { Ddr::Events::Event.new(pid: "test:1") }
         | 
| 278 | 
            +
             | 
| 279 | 
            +
                    context "when the user can read the object" do
         | 
| 280 | 
            +
                      before { subject.can :read, "test:1" }
         | 
| 226 281 | 
             
                      it { is_expected.to be_able_to(:read, resource) }
         | 
| 227 282 | 
             
                    end
         | 
| 228 | 
            -
             | 
| 229 | 
            -
             | 
| 230 | 
            -
             | 
| 231 | 
            -
             | 
| 232 | 
            -
                          object.save!
         | 
| 233 | 
            -
                        end
         | 
| 234 | 
            -
                        it { is_expected.to be_able_to(:read, resource) }
         | 
| 235 | 
            -
                      end
         | 
| 236 | 
            -
                      context "and cannot read object" do
         | 
| 237 | 
            -
                        it { is_expected.not_to be_able_to(:read, resource) }
         | 
| 238 | 
            -
                      end
         | 
| 283 | 
            +
             | 
| 284 | 
            +
                    context "when the user cannot read the object" do
         | 
| 285 | 
            +
                      before { subject.cannot :read, "test:1" }
         | 
| 286 | 
            +
                      it { is_expected.not_to be_able_to(:read, resource) }
         | 
| 239 287 | 
             
                    end
         | 
| 240 288 | 
             
                  end
         | 
| 241 289 |  | 
| 242 290 | 
             
                  describe "#attachment_permissions", attachments: true do
         | 
| 291 | 
            +
             | 
| 243 292 | 
             
                    context "object can have attachments" do
         | 
| 244 293 | 
             
                      let(:resource) { FactoryGirl.build(:test_model_omnibus) }
         | 
| 294 | 
            +
             | 
| 245 295 | 
             
                      context "and user lacks edit rights" do
         | 
| 246 296 | 
             
                        before { subject.cannot(:edit, resource) }
         | 
| 247 297 | 
             
                        it { is_expected.not_to be_able_to(:add_attachment, resource) }
         | 
| 248 298 | 
             
                      end
         | 
| 299 | 
            +
             | 
| 249 300 | 
             
                      context "and user has edit rights" do
         | 
| 250 301 | 
             
                        before { subject.can(:edit, resource) }
         | 
| 251 302 | 
             
                        it { is_expected.to be_able_to(:add_attachment, resource) }
         | 
| 252 303 | 
             
                      end
         | 
| 253 304 | 
             
                    end
         | 
| 305 | 
            +
             | 
| 254 306 | 
             
                    context "object cannot have attachments" do
         | 
| 255 307 | 
             
                      let(:resource) { FactoryGirl.build(:test_model) }
         | 
| 256 308 | 
             
                      before { subject.can(:edit, resource) }
         | 
| @@ -259,17 +311,21 @@ module Ddr | |
| 259 311 | 
             
                  end
         | 
| 260 312 |  | 
| 261 313 | 
             
                  describe "#children_permissions", children: true do
         | 
| 314 | 
            +
             | 
| 262 315 | 
             
                    context "user has edit rights on object" do
         | 
| 263 316 | 
             
                      before { subject.can(:edit, resource) }
         | 
| 317 | 
            +
             | 
| 264 318 | 
             
                      context "and object can have children" do
         | 
| 265 319 | 
             
                        let(:resource) { FactoryGirl.build(:collection) }
         | 
| 266 320 | 
             
                        it { is_expected.to be_able_to(:add_children, resource) }
         | 
| 267 321 | 
             
                      end
         | 
| 322 | 
            +
             | 
| 268 323 | 
             
                      context "but object cannot have children" do
         | 
| 269 324 | 
             
                        let(:resource) { FactoryGirl.build(:component) }
         | 
| 270 325 | 
             
                        it { is_expected.not_to be_able_to(:add_children, resource) }
         | 
| 271 326 | 
             
                      end
         | 
| 272 327 | 
             
                    end
         | 
| 328 | 
            +
             | 
| 273 329 | 
             
                    context "user lacks edit rights on attached_to object" do
         | 
| 274 330 | 
             
                      let(:resource) { FactoryGirl.build(:collection) }
         | 
| 275 331 | 
             
                      before { subject.cannot(:edit, resource) }
         | 
| @@ -0,0 +1,26 @@ | |
| 1 | 
            +
            RSpec.describe "users router", type: :routing do
         | 
| 2 | 
            +
              it "should have a new session route" do
         | 
| 3 | 
            +
                expect(get: '/users/sign_in').to route_to(controller: 'users/sessions', action: 'new')
         | 
| 4 | 
            +
              end
         | 
| 5 | 
            +
              it "should have a new session path helper" do
         | 
| 6 | 
            +
                expect(get: new_user_session_path).to route_to(controller: 'users/sessions', action: 'new')
         | 
| 7 | 
            +
              end
         | 
| 8 | 
            +
              it "should have a destroy session route" do
         | 
| 9 | 
            +
                expect(get: '/users/sign_out').to route_to(controller: 'users/sessions', action: 'destroy')
         | 
| 10 | 
            +
              end
         | 
| 11 | 
            +
              it "should have a destroy session path helper" do
         | 
| 12 | 
            +
                expect(get: destroy_user_session_path).to route_to(controller: 'users/sessions', action: 'destroy')
         | 
| 13 | 
            +
              end
         | 
| 14 | 
            +
              it "should have a shibboleth authentication path" do
         | 
| 15 | 
            +
                expect(get: '/users/auth/shibboleth').to route_to(controller: 'users/omniauth_callbacks', action: 'passthru', provider: 'shibboleth')
         | 
| 16 | 
            +
              end
         | 
| 17 | 
            +
              it "should have a shibboleth authentication path helper" do
         | 
| 18 | 
            +
                expect(get: user_omniauth_authorize_path(:shibboleth)).to route_to(controller: 'users/omniauth_callbacks', action: 'passthru', provider: 'shibboleth')
         | 
| 19 | 
            +
              end
         | 
| 20 | 
            +
              describe "redirects", type: :request do
         | 
| 21 | 
            +
                it "should have a signed out path" do
         | 
| 22 | 
            +
                  get '/users/signed_out'
         | 
| 23 | 
            +
                  expect(response).to redirect_to('/')
         | 
| 24 | 
            +
                end
         | 
| 25 | 
            +
              end
         | 
| 26 | 
            +
            end
         | 
    
        data/spec/spec_helper.rb
    CHANGED
    
    | @@ -100,6 +100,8 @@ RSpec.configure do |config| | |
| 100 100 | 
             
              # as the one that triggered the failure.
         | 
| 101 101 | 
             
              Kernel.srand config.seed
         | 
| 102 102 |  | 
| 103 | 
            +
              config.include Devise::TestHelpers, type: :controller
         | 
| 104 | 
            +
             | 
| 103 105 | 
             
              config.before(:suite) do
         | 
| 104 106 | 
             
                DatabaseCleaner.clean
         | 
| 105 107 | 
             
                ActiveFedora::Base.destroy_all
         | 
| @@ -165,7 +165,9 @@ RSpec.shared_examples "an event" do | |
| 165 165 |  | 
| 166 166 | 
             
              describe "rendering who/what performed the action" do
         | 
| 167 167 | 
             
                context "when performed by a user" do
         | 
| 168 | 
            -
                  before  | 
| 168 | 
            +
                  before do
         | 
| 169 | 
            +
                    subject.user_key = "bob"
         | 
| 170 | 
            +
                  end
         | 
| 169 171 | 
             
                  it "should render the user" do
         | 
| 170 172 | 
             
                    expect(subject.performed_by).to eq "bob"
         | 
| 171 173 | 
             
                  end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: ddr-models
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1. | 
| 4 | 
            +
              version: 1.10.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Jim Coble
         | 
| @@ -9,7 +9,7 @@ authors: | |
| 9 9 | 
             
            autorequire: 
         | 
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date: 2015- | 
| 12 | 
            +
            date: 2015-02-06 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: rails
         | 
| @@ -289,7 +289,6 @@ files: | |
| 289 289 | 
             
            - Rakefile
         | 
| 290 290 | 
             
            - app/controllers/users/omniauth_callbacks_controller.rb
         | 
| 291 291 | 
             
            - app/controllers/users/sessions_controller.rb
         | 
| 292 | 
            -
            - app/controllers/users/sessions_controller.rb~
         | 
| 293 292 | 
             
            - app/models/attachment.rb
         | 
| 294 293 | 
             
            - app/models/collection.rb
         | 
| 295 294 | 
             
            - app/models/component.rb
         | 
| @@ -299,6 +298,7 @@ files: | |
| 299 298 | 
             
            - config/initializers/active_fedora_datastream.rb
         | 
| 300 299 | 
             
            - config/initializers/devise.rb
         | 
| 301 300 | 
             
            - config/initializers/subscriptions.rb
         | 
| 301 | 
            +
            - config/locales/groups.en.yml
         | 
| 302 302 | 
             
            - config/routes.rb
         | 
| 303 303 | 
             
            - db/migrate/20141021233359_create_events.rb
         | 
| 304 304 | 
             
            - db/migrate/20141021234156_create_minted_ids.rb
         | 
| @@ -308,11 +308,13 @@ files: | |
| 308 308 | 
             
            - db/migrate/20141216040225_drop_minted_ids.rb
         | 
| 309 309 | 
             
            - db/migrate/20141218020612_add_exception_to_events.rb
         | 
| 310 310 | 
             
            - db/migrate/20150110023410_drop_workflow_states.rb
         | 
| 311 | 
            +
            - db/migrate/20150130134416_add_user_key_to_events.rb
         | 
| 311 312 | 
             
            - lib/ddr-models.rb
         | 
| 312 313 | 
             
            - lib/ddr/actions.rb
         | 
| 313 314 | 
             
            - lib/ddr/actions/fixity_check.rb
         | 
| 314 315 | 
             
            - lib/ddr/auth.rb
         | 
| 315 316 | 
             
            - lib/ddr/auth/ability.rb
         | 
| 317 | 
            +
            - lib/ddr/auth/failure_app.rb
         | 
| 316 318 | 
             
            - lib/ddr/auth/group_service.rb
         | 
| 317 319 | 
             
            - lib/ddr/auth/grouper_service.rb
         | 
| 318 320 | 
             
            - lib/ddr/auth/remote_group_service.rb
         | 
| @@ -339,22 +341,17 @@ files: | |
| 339 341 | 
             
            - lib/ddr/events/virus_check_event.rb
         | 
| 340 342 | 
             
            - lib/ddr/index_fields.rb
         | 
| 341 343 | 
             
            - lib/ddr/managers.rb
         | 
| 342 | 
            -
            - lib/ddr/managers/#index_manager.rb#
         | 
| 343 344 | 
             
            - lib/ddr/managers/manager.rb
         | 
| 344 345 | 
             
            - lib/ddr/managers/permanent_id_manager.rb
         | 
| 345 346 | 
             
            - lib/ddr/managers/role_manager.rb
         | 
| 346 347 | 
             
            - lib/ddr/managers/workflow_manager.rb
         | 
| 347 348 | 
             
            - lib/ddr/metadata.rb
         | 
| 348 | 
            -
            - lib/ddr/metadata/#permanent_id_record.rb#
         | 
| 349 349 | 
             
            - lib/ddr/metadata/duke_terms.rb
         | 
| 350 350 | 
             
            - lib/ddr/metadata/premis_event.rb
         | 
| 351 351 | 
             
            - lib/ddr/metadata/rdf_vocabulary_parser.rb
         | 
| 352 352 | 
             
            - lib/ddr/metadata/sources/duketerms.rdf.xml
         | 
| 353 353 | 
             
            - lib/ddr/metadata/vocabulary.rb
         | 
| 354 354 | 
             
            - lib/ddr/models.rb
         | 
| 355 | 
            -
            - lib/ddr/models/#has_ezid_identifier.rb#
         | 
| 356 | 
            -
            - lib/ddr/models/#has_permanent_identifier.rb#
         | 
| 357 | 
            -
            - lib/ddr/models/#index_fields.rb#
         | 
| 358 355 | 
             
            - lib/ddr/models/access_controllable.rb
         | 
| 359 356 | 
             
            - lib/ddr/models/base.rb
         | 
| 360 357 | 
             
            - lib/ddr/models/describable.rb
         | 
| @@ -380,6 +377,7 @@ files: | |
| 380 377 | 
             
            - lib/ddr/vocab.rb
         | 
| 381 378 | 
             
            - lib/ddr/vocab/asset.rb
         | 
| 382 379 | 
             
            - lib/ddr/vocab/roles.rb
         | 
| 380 | 
            +
            - spec/controllers/application_controller_spec.rb
         | 
| 383 381 | 
             
            - spec/dummy/README.rdoc
         | 
| 384 382 | 
             
            - spec/dummy/Rakefile
         | 
| 385 383 | 
             
            - spec/dummy/app/assets/javascripts/application.js
         | 
| @@ -415,18 +413,11 @@ files: | |
| 415 413 | 
             
            - spec/dummy/db/schema.rb
         | 
| 416 414 | 
             
            - spec/dummy/db/test.sqlite3
         | 
| 417 415 | 
             
            - spec/dummy/log/development.log
         | 
| 418 | 
            -
            - spec/dummy/log/production.log
         | 
| 419 416 | 
             
            - spec/dummy/log/test.log
         | 
| 420 417 | 
             
            - spec/dummy/public/404.html
         | 
| 421 418 | 
             
            - spec/dummy/public/422.html
         | 
| 422 419 | 
             
            - spec/dummy/public/500.html
         | 
| 423 420 | 
             
            - spec/dummy/public/favicon.ico
         | 
| 424 | 
            -
            - spec/dummy/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705
         | 
| 425 | 
            -
            - spec/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af
         | 
| 426 | 
            -
            - spec/dummy/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953
         | 
| 427 | 
            -
            - spec/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994
         | 
| 428 | 
            -
            - spec/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6
         | 
| 429 | 
            -
            - spec/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655
         | 
| 430 421 | 
             
            - spec/factories/attachment_factories.rb
         | 
| 431 422 | 
             
            - spec/factories/collection_factories.rb
         | 
| 432 423 | 
             
            - spec/factories/component_factories.rb
         | 
| @@ -457,6 +448,7 @@ files: | |
| 457 448 | 
             
            - spec/models/superuser_spec.rb
         | 
| 458 449 | 
             
            - spec/models/target_spec.rb
         | 
| 459 450 | 
             
            - spec/models/user_spec.rb
         | 
| 451 | 
            +
            - spec/routing/user_routing_spec.rb
         | 
| 460 452 | 
             
            - spec/services/group_service_spec.rb
         | 
| 461 453 | 
             
            - spec/spec_helper.rb
         | 
| 462 454 | 
             
            - spec/support/shared_examples_for_access_controllables.rb
         | 
| @@ -496,6 +488,7 @@ signing_key: | |
| 496 488 | 
             
            specification_version: 4
         | 
| 497 489 | 
             
            summary: Models used in the Duke Digital Repository
         | 
| 498 490 | 
             
            test_files:
         | 
| 491 | 
            +
            - spec/controllers/application_controller_spec.rb
         | 
| 499 492 | 
             
            - spec/dummy/app/assets/javascripts/application.js
         | 
| 500 493 | 
             
            - spec/dummy/app/assets/stylesheets/application.css
         | 
| 501 494 | 
             
            - spec/dummy/app/controllers/application_controller.rb
         | 
| @@ -529,7 +522,6 @@ test_files: | |
| 529 522 | 
             
            - spec/dummy/db/schema.rb
         | 
| 530 523 | 
             
            - spec/dummy/db/test.sqlite3
         | 
| 531 524 | 
             
            - spec/dummy/log/development.log
         | 
| 532 | 
            -
            - spec/dummy/log/production.log
         | 
| 533 525 | 
             
            - spec/dummy/log/test.log
         | 
| 534 526 | 
             
            - spec/dummy/public/404.html
         | 
| 535 527 | 
             
            - spec/dummy/public/422.html
         | 
| @@ -537,12 +529,6 @@ test_files: | |
| 537 529 | 
             
            - spec/dummy/public/favicon.ico
         | 
| 538 530 | 
             
            - spec/dummy/Rakefile
         | 
| 539 531 | 
             
            - spec/dummy/README.rdoc
         | 
| 540 | 
            -
            - spec/dummy/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705
         | 
| 541 | 
            -
            - spec/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af
         | 
| 542 | 
            -
            - spec/dummy/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953
         | 
| 543 | 
            -
            - spec/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994
         | 
| 544 | 
            -
            - spec/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6
         | 
| 545 | 
            -
            - spec/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655
         | 
| 546 532 | 
             
            - spec/factories/attachment_factories.rb
         | 
| 547 533 | 
             
            - spec/factories/collection_factories.rb
         | 
| 548 534 | 
             
            - spec/factories/component_factories.rb
         | 
| @@ -573,6 +559,7 @@ test_files: | |
| 573 559 | 
             
            - spec/models/superuser_spec.rb
         | 
| 574 560 | 
             
            - spec/models/target_spec.rb
         | 
| 575 561 | 
             
            - spec/models/user_spec.rb
         | 
| 562 | 
            +
            - spec/routing/user_routing_spec.rb
         | 
| 576 563 | 
             
            - spec/services/group_service_spec.rb
         | 
| 577 564 | 
             
            - spec/spec_helper.rb
         | 
| 578 565 | 
             
            - spec/support/shared_examples_for_access_controllables.rb
         |