hydra-access-controls 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/.gitmodules +3 -0
- data/.rspec +2 -0
- data/Gemfile +6 -0
- data/README.textile +100 -0
- data/Rakefile +6 -3
- data/config/fedora.yml +8 -0
- data/config/jetty.yml +5 -0
- data/config/solr.yml +6 -0
- data/hydra-access-controls.gemspec +3 -2
- data/lib/ability.rb +1 -0
- data/lib/hydra-access-controls.rb +10 -0
- data/lib/hydra-access-controls/version.rb +1 -1
- data/lib/hydra/ability.rb +14 -13
- data/lib/hydra/access_controls_enforcement.rb +27 -16
- data/lib/hydra/admin_policy.rb +81 -0
- data/lib/hydra/datastream.rb +1 -0
- data/lib/hydra/datastream/inheritable_rights_metadata.rb +22 -0
- data/lib/hydra/policy_aware_ability.rb +128 -0
- data/lib/hydra/policy_aware_access_controls_enforcement.rb +70 -0
- data/lib/hydra/role_mapper_behavior.rb +16 -2
- data/lib/hydra/user.rb +42 -0
- data/lib/tasks/hydra-access-controls.rake +18 -0
- data/lib/tasks/hydra_jetty.rake +55 -0
- data/solr_conf/conf/schema.xml +124 -0
- data/solr_conf/conf/solrconfig.xml +329 -0
- data/solr_conf/solr.xml +35 -0
- data/spec/factories.rb +101 -0
- data/spec/spec_helper.rb +28 -0
- data/spec/support/blacklight.rb +7 -0
- data/spec/support/config/solr.yml +4 -0
- data/spec/support/mods_asset.rb +4 -1
- data/spec/support/rails.rb +10 -0
- data/spec/support/solr_document.rb +13 -0
- data/spec/support/user.rb +32 -0
- data/spec/unit/ability_spec.rb +338 -56
- data/spec/unit/access_controls_enforcement_spec.rb +180 -0
- data/spec/unit/admin_policy_spec.rb +89 -0
- data/spec/unit/inheritable_rights_metadata_spec.rb +66 -0
- data/spec/unit/policy_aware_ability_spec.rb +92 -0
- data/spec/unit/policy_aware_access_controls_enforcement_spec.rb +109 -0
- metadata +59 -4
- data/README.md +0 -29
@@ -0,0 +1,329 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" ?>
|
2
|
+
<config>
|
3
|
+
<!-- For complete comments from the Solr project example solrconfig.xml:
|
4
|
+
http://svn.apache.org/repos/asf/lucene/dev/trunk/solr/example/solr/conf/solrconfig.xml
|
5
|
+
See also:
|
6
|
+
http://wiki.apache.org/solr/SolrConfigXml
|
7
|
+
-->
|
8
|
+
<abortOnConfigurationError>${solr.abortOnConfigurationError:true}</abortOnConfigurationError>
|
9
|
+
|
10
|
+
<indexDefaults>
|
11
|
+
<useCompoundFile>false</useCompoundFile>
|
12
|
+
<mergeFactor>10</mergeFactor>
|
13
|
+
<ramBufferSizeMB>32</ramBufferSizeMB>
|
14
|
+
<maxMergeDocs>2147483647</maxMergeDocs>
|
15
|
+
<maxFieldLength>10000</maxFieldLength>
|
16
|
+
<writeLockTimeout>1000</writeLockTimeout>
|
17
|
+
<commitLockTimeout>10000</commitLockTimeout>
|
18
|
+
<lockType>single</lockType>
|
19
|
+
</indexDefaults>
|
20
|
+
|
21
|
+
<mainIndex>
|
22
|
+
<useCompoundFile>false</useCompoundFile>
|
23
|
+
<ramBufferSizeMB>32</ramBufferSizeMB>
|
24
|
+
<mergeFactor>10</mergeFactor>
|
25
|
+
<maxMergeDocs>2147483647</maxMergeDocs>
|
26
|
+
<maxFieldLength>10000</maxFieldLength>
|
27
|
+
<unlockOnStartup>false</unlockOnStartup>
|
28
|
+
</mainIndex>
|
29
|
+
|
30
|
+
<jmx />
|
31
|
+
|
32
|
+
<!-- the default high-performance update handler -->
|
33
|
+
<updateHandler class="solr.DirectUpdateHandler2">
|
34
|
+
</updateHandler>
|
35
|
+
|
36
|
+
|
37
|
+
<query>
|
38
|
+
<maxBooleanClauses>1024</maxBooleanClauses>
|
39
|
+
<filterCache class="solr.LRUCache"
|
40
|
+
size="512"
|
41
|
+
initialSize="512"
|
42
|
+
autowarmCount="128"/>
|
43
|
+
<queryResultCache class="solr.LRUCache"
|
44
|
+
size="512"
|
45
|
+
initialSize="512"
|
46
|
+
autowarmCount="32"/>
|
47
|
+
<documentCache class="solr.LRUCache"
|
48
|
+
size="512"
|
49
|
+
initialSize="512"
|
50
|
+
autowarmCount="0"/>
|
51
|
+
<enableLazyFieldLoading>true</enableLazyFieldLoading>
|
52
|
+
<queryResultWindowSize>50</queryResultWindowSize>
|
53
|
+
<queryResultMaxDocsCached>200</queryResultMaxDocsCached>
|
54
|
+
<HashDocSet maxSize="3000" loadFactor="0.75"/>
|
55
|
+
|
56
|
+
<listener event="newSearcher" class="solr.QuerySenderListener">
|
57
|
+
<arr name="queries">
|
58
|
+
<lst> <str name="q">hydrus</str></lst>
|
59
|
+
</arr>
|
60
|
+
</listener>
|
61
|
+
|
62
|
+
<listener event="firstSearcher" class="solr.QuerySenderListener">
|
63
|
+
<arr name="queries">
|
64
|
+
<lst> <str name="q">hydrus</str></lst>
|
65
|
+
</arr>
|
66
|
+
</listener>
|
67
|
+
|
68
|
+
<useColdSearcher>false</useColdSearcher>
|
69
|
+
<maxWarmingSearchers>2</maxWarmingSearchers>
|
70
|
+
</query>
|
71
|
+
|
72
|
+
<requestDispatcher handleSelect="true" >
|
73
|
+
<requestParsers enableRemoteStreaming="false" multipartUploadLimitInKB="2048" />
|
74
|
+
<httpCaching lastModifiedFrom="openTime"
|
75
|
+
etagSeed="Solr">
|
76
|
+
</httpCaching>
|
77
|
+
</requestDispatcher>
|
78
|
+
|
79
|
+
<requestHandler name="standard" class="solr.SearchHandler">
|
80
|
+
<lst name="defaults">
|
81
|
+
<str name="echoParams">explicit</str>
|
82
|
+
</lst>
|
83
|
+
</requestHandler>
|
84
|
+
|
85
|
+
<!-- For complete comments from the Solr project example solrconfig.xml:
|
86
|
+
http://svn.apache.org/repos/asf/lucene/dev/trunk/solr/example/solr/conf/solrconfig.xml
|
87
|
+
See also:
|
88
|
+
http://wiki.apache.org/solr/SolrConfigXml
|
89
|
+
-->
|
90
|
+
|
91
|
+
<requestHandler name="search" class="solr.SearchHandler" default="true">
|
92
|
+
<lst name="defaults">
|
93
|
+
<str name="defType">dismax</str>
|
94
|
+
<!-- dismax params -->
|
95
|
+
<str name="mm"> 2<-1 5<-2 6<90% </str>
|
96
|
+
<str name="q.alt">*:*</str>
|
97
|
+
<!-- general -->
|
98
|
+
<str name="facet">true</str>
|
99
|
+
<str name="facet.mincount">1</str>
|
100
|
+
<str name="echoParams">explicit</str>
|
101
|
+
<str name="fl">
|
102
|
+
id,title_t,title_display,date_t,year_facet,month_facet,has_model_s,has_collection_member_s,is_part_of_s,system_create_dt,
|
103
|
+
person_0_role_t,person_1_role_t,person_2_role_t,person_3_role_t,person_4_role_t,person_5_role_t,person_6_role_t,
|
104
|
+
person_7_role_t,person_8_role_t,person_9_role_t,
|
105
|
+
person_0_first_name_t,person_1_first_name_t,person_2_first_name_t,person_3_first_name_t,person_4_first_name_t,
|
106
|
+
person_5_first_name_t,person_6_first_name_t,person_7_first_name_t,person_8_first_name_t,person_9_first_name_t,
|
107
|
+
person_0_last_name_t,person_1_last_name_t,person_2_last_name_t,person_3_last_name_t,person_4_last_name_t,
|
108
|
+
person_5_last_name_t,person_6_last_name_t,person_7_last_name_t,person_8_last_name_t,person_9_last_name_t,
|
109
|
+
status_t,subject_t,depositor_t,
|
110
|
+
journal_title_info_t,journal_issue_publication_date_t,
|
111
|
+
journal_issue_pages_end_t,journal_issue_volume_t,journal_title_info_main_title_t,journal_issue_pages_start_t,
|
112
|
+
journal_issue_start_page_t, journal_issue_end_page_t, abstract_t,
|
113
|
+
person_0_institution_t,person_1_institution_t,person_2_institution_t,person_3_institution_t,person_4_institution_t,person_5_institution_t,person_institution_role_t,
|
114
|
+
person_7_institution_t,person_8_institution_t,person_9_institution_t,
|
115
|
+
mods_gps_t, mods_region_t, mods_site_t, mods_ecosystem_t,
|
116
|
+
mods_timespan_start_t, mods_timespan_end_t, description_t, mods_title_info_main_title_t, mods_0_title_info_0_main_title_t, embargo_release_date_dt, note_t,
|
117
|
+
object_type_facet, department_facet, peer_reviewed_facet
|
118
|
+
</str>
|
119
|
+
</lst>
|
120
|
+
</requestHandler>
|
121
|
+
|
122
|
+
<requestHandler name="public_search" class="solr.SearchHandler" >
|
123
|
+
<lst name="defaults">
|
124
|
+
<!-- Making defType lucene to exclude file assets -->
|
125
|
+
<str name="defType">lucene</str>
|
126
|
+
<!-- lucene params -->
|
127
|
+
<str name="df">has_model_s</str>
|
128
|
+
<str name="q.op">AND</str>
|
129
|
+
<!-- dismax params -->
|
130
|
+
<str name="mm"> 2<-1 5<-2 6<90% </str>
|
131
|
+
<str name="q.alt">*:*</str>
|
132
|
+
<str name="qf_dismax">id^0.8 id_t^0.8 format text^0.3</str>
|
133
|
+
<str name="pf_dismax">id^0.9 id_t^0.9 text^0.5</str>
|
134
|
+
<int name="ps">100</int>
|
135
|
+
<float name="tie">0.01</float>
|
136
|
+
<!-- general -->
|
137
|
+
<str name="facet">on</str>
|
138
|
+
<str name="facet.mincount">1</str>
|
139
|
+
<str name="echoParams">explicit</str>
|
140
|
+
<str name="fl">
|
141
|
+
id,text,title_t,date_t,year_facet,month_facet,medium_t,series_facet,box_facet,folder_facet,has_model_s,has_collection_member_s,system_create_dt,
|
142
|
+
person_0_role_t,person_1_role_t,person_2_role_t,person_3_role_t,person_4_role_t,person_5_role_t,person_6_role_t,person_7_role_t,person_8_role_t,person_9_role_t,
|
143
|
+
person_0_first_name_t,person_1_first_name_t,person_2_first_name_t,person_3_first_name_t,person_4_first_name_t,person_5_first_name_t,person_6_first_name_t,person_7_first_name_t,person_8_first_name_t,person_9_first_name_t,
|
144
|
+
person_0_last_name_t,person_1_last_name_t,person_2_last_name_t,person_3_last_name_t,person_4_last_name_t,person_5_last_name_t,person_6_last_name_t,person_7_last_name_t,person_8_last_name_t,person_9_last_name_t,depositor_t,
|
145
|
+
|
146
|
+
journal_title_info_t, journal_title_info_main_title_t, journal_issue_publication_date_t, journal_issue_pages_start_t, journal_issue_pages_end_t, journal_issue_volume_t, journal_issue_start_page_t, journal_issue_end_page_t, abstract_t,
|
147
|
+
person_0_institution_t,person_1_institution_t,person_2_institution_t,person_3_institution_t,person_4_institution_t,person_5_institution_t,person_institution_role_t,
|
148
|
+
person_7_institution_t,person_8_institution_t,person_9_institution_t,
|
149
|
+
mods_gps_t, mods_region_t, mods_site_t, mods_ecosystem_t,
|
150
|
+
mods_timespan_start_t, mods_timespan_end_t, description_t, mods_title_info_t,mods_0_title_info_0_main_title_t, embargo_release_date_dt, note_t,
|
151
|
+
object_type_facet, department_facet, peer_reviewed_facet
|
152
|
+
</str>
|
153
|
+
</lst>
|
154
|
+
</requestHandler>
|
155
|
+
|
156
|
+
<requestHandler name="fulltext" class="solr.SearchHandler" >
|
157
|
+
<lst name="defaults">
|
158
|
+
<str name="defType">dismax</str>
|
159
|
+
<str name="facet">on</str>
|
160
|
+
<str name="facet.mincount">1</str>
|
161
|
+
<str name="echoParams">explicit</str>
|
162
|
+
<float name="tie">0.01</float>
|
163
|
+
<str name="qf">id^0.8 id_t^0.8 format text^0.3</str>
|
164
|
+
<str name="pf">id^0.9 id_t^0.9 text^0.5</str>
|
165
|
+
<str name="fl">
|
166
|
+
id,text,title_t,date_t,year_facet,month_facet,medium_t,series_facet,box_facet,folder_facet
|
167
|
+
</str>
|
168
|
+
<str name="mm"> 2<-1 5<-2 6<90% </str>
|
169
|
+
<int name="ps">100</int>
|
170
|
+
<str name="q.alt">*:*</str>
|
171
|
+
</lst>
|
172
|
+
</requestHandler>
|
173
|
+
|
174
|
+
<!--
|
175
|
+
Hydra Permissions request Handler
|
176
|
+
For requests to get just the permissions related info about a document
|
177
|
+
-->
|
178
|
+
<requestHandler name="permissions" class="solr.SearchHandler" >
|
179
|
+
<lst name="defaults">
|
180
|
+
<str name="facet">off</str>
|
181
|
+
<str name="echoParams">all</str>
|
182
|
+
<str name="rows">1</str>
|
183
|
+
<str name="q">{!raw f=id v=$id}</str> <!-- use id=666 instead of q=id:666 -->
|
184
|
+
<str name="fl">
|
185
|
+
id,access_t,
|
186
|
+
discover_access_group_t,discover_access_person_t,
|
187
|
+
read_access_group_t,read_access_person_t,
|
188
|
+
edit_access_group_t,edit_access_person_t,
|
189
|
+
depositor_t,
|
190
|
+
embargo_release_date_dt
|
191
|
+
inheritable_access_t,
|
192
|
+
inheritable_discover_access_group_t,inheritable_discover_access_person_t,
|
193
|
+
inheritable_read_access_group_t,inheritable_read_access_person_t,
|
194
|
+
inheritable_edit_access_group_t,inheritable_edit_access_person_t,
|
195
|
+
inheritable_embargo_release_date_dt
|
196
|
+
</str>
|
197
|
+
</lst>
|
198
|
+
</requestHandler>
|
199
|
+
|
200
|
+
<!-- for requests to get a single document; use id=666 instead of q=id:666 -->
|
201
|
+
<requestHandler name="document" class="solr.SearchHandler" >
|
202
|
+
<lst name="defaults">
|
203
|
+
<str name="echoParams">all</str>
|
204
|
+
<str name="fl">*</str>
|
205
|
+
<str name="rows">1</str>
|
206
|
+
<str name="q">{!raw f=id v=$id}</str> <!-- use id=666 instead of q=id:666 -->
|
207
|
+
|
208
|
+
<!-- facets on for a single document response??? -->
|
209
|
+
<str name="facet">on</str>
|
210
|
+
<str name="facet.mincount">1</str>
|
211
|
+
|
212
|
+
<str name="facet.field">collection_facet</str>
|
213
|
+
<str name="facet.field">technology_facet</str>
|
214
|
+
<str name="facet.field">person_facet</str>
|
215
|
+
<!-- <str name="facet.field">title_t</str> -->
|
216
|
+
<str name="facet.field">city_facet</str>
|
217
|
+
<str name="facet.field">organization_facet</str>
|
218
|
+
<str name="facet.field">company_facet</str>
|
219
|
+
<str name="facet.field">year_facet</str>
|
220
|
+
<str name="facet.field">state_facet</str>
|
221
|
+
<str name="facet.field">series_facet</str>
|
222
|
+
<str name="facet.field">box_facet</str>
|
223
|
+
<str name="facet.field">folder_facet</str>
|
224
|
+
<str name="facet.field">donor_tags_facet</str>
|
225
|
+
<str name="facet.field">archivist_tags_facet</str>
|
226
|
+
|
227
|
+
</lst>
|
228
|
+
</requestHandler>
|
229
|
+
|
230
|
+
<!-- The spell check component can return a list of alternative spelling
|
231
|
+
suggestions. -->
|
232
|
+
<searchComponent name="spellcheck" class="solr.SpellCheckComponent">
|
233
|
+
|
234
|
+
<str name="queryAnalyzerFieldType">textSpell</str>
|
235
|
+
|
236
|
+
<lst name="spellchecker">
|
237
|
+
<str name="name">default</str>
|
238
|
+
<str name="field">spell</str>
|
239
|
+
<str name="spellcheckIndexDir">./spellchecker1</str>
|
240
|
+
|
241
|
+
</lst>
|
242
|
+
<lst name="spellchecker">
|
243
|
+
<str name="name">jarowinkler</str>
|
244
|
+
<str name="field">spell</str>
|
245
|
+
<!-- Use a different Distance Measure -->
|
246
|
+
<str name="distanceMeasure">org.apache.lucene.search.spell.JaroWinklerDistance</str>
|
247
|
+
<str name="spellcheckIndexDir">./spellchecker2</str>
|
248
|
+
|
249
|
+
</lst>
|
250
|
+
|
251
|
+
<lst name="spellchecker">
|
252
|
+
<str name="classname">solr.FileBasedSpellChecker</str>
|
253
|
+
<str name="name">file</str>
|
254
|
+
<str name="sourceLocation">spellings.txt</str>
|
255
|
+
<str name="characterEncoding">UTF-8</str>
|
256
|
+
<str name="spellcheckIndexDir">./spellcheckerFile</str>
|
257
|
+
</lst>
|
258
|
+
</searchComponent>
|
259
|
+
|
260
|
+
<!-- a request handler utilizing the spellcheck component -->
|
261
|
+
<requestHandler name="/spellCheckCompRH" class="solr.SearchHandler">
|
262
|
+
<lst name="defaults">
|
263
|
+
<!-- omp = Only More Popular -->
|
264
|
+
<str name="spellcheck.onlyMorePopular">false</str>
|
265
|
+
<!-- exr = Extended Results -->
|
266
|
+
<str name="spellcheck.extendedResults">false</str>
|
267
|
+
<!-- The number of suggestions to return -->
|
268
|
+
<str name="spellcheck.count">1</str>
|
269
|
+
</lst>
|
270
|
+
<arr name="last-components">
|
271
|
+
<str>spellcheck</str>
|
272
|
+
</arr>
|
273
|
+
</requestHandler>
|
274
|
+
|
275
|
+
<!-- a search component that enables you to configure the top results for
|
276
|
+
a given query regardless of the normal lucene scoring.-->
|
277
|
+
<searchComponent name="elevator" class="solr.QueryElevationComponent" >
|
278
|
+
<!-- pick a fieldType to analyze queries -->
|
279
|
+
<str name="queryFieldType">string</str>
|
280
|
+
<str name="config-file">elevate.xml</str>
|
281
|
+
</searchComponent>
|
282
|
+
|
283
|
+
<!-- a request handler utilizing the elevator component -->
|
284
|
+
<requestHandler name="/elevate" class="solr.SearchHandler" startup="lazy">
|
285
|
+
<lst name="defaults">
|
286
|
+
<str name="echoParams">explicit</str>
|
287
|
+
</lst>
|
288
|
+
<arr name="last-components">
|
289
|
+
<str>elevator</str>
|
290
|
+
</arr>
|
291
|
+
</requestHandler>
|
292
|
+
|
293
|
+
<requestHandler name="/update" class="solr.XmlUpdateRequestHandler" />
|
294
|
+
<requestHandler name="/analysis" class="solr.AnalysisRequestHandler" />
|
295
|
+
<requestHandler name="/update/csv" class="solr.CSVRequestHandler" startup="lazy" />
|
296
|
+
<requestHandler name="/admin/" class="org.apache.solr.handler.admin.AdminHandlers" />
|
297
|
+
<requestHandler name="/admin/ping" class="PingRequestHandler">
|
298
|
+
<lst name="defaults">
|
299
|
+
<str name="qt">standard</str>
|
300
|
+
<str name="q">solrpingquery</str>
|
301
|
+
<str name="echoParams">all</str>
|
302
|
+
</lst>
|
303
|
+
</requestHandler>
|
304
|
+
<requestHandler name="/debug/dump" class="solr.DumpRequestHandler" >
|
305
|
+
<lst name="defaults">
|
306
|
+
<str name="echoParams">explicit</str> <!-- for all params (including the default etc) use: 'all' -->
|
307
|
+
<str name="echoHandler">true</str>
|
308
|
+
</lst>
|
309
|
+
</requestHandler>
|
310
|
+
|
311
|
+
<!--
|
312
|
+
<queryResponseWriter name="xml" class="org.apache.solr.request.XMLResponseWriter" default="true"/>
|
313
|
+
<queryResponseWriter name="json" class="org.apache.solr.request.JSONResponseWriter"/>
|
314
|
+
<queryResponseWriter name="ruby" class="org.apache.solr.request.RubyResponseWriter"/>
|
315
|
+
-->
|
316
|
+
|
317
|
+
<!-- XSLT response writer transforms the XML output by any xslt file found
|
318
|
+
in Solr's conf/xslt directory. Changes to xslt files are checked for
|
319
|
+
every xsltCacheLifetimeSeconds.
|
320
|
+
-->
|
321
|
+
<queryResponseWriter name="xslt" class="org.apache.solr.request.XSLTResponseWriter">
|
322
|
+
<int name="xsltCacheLifetimeSeconds">5</int>
|
323
|
+
</queryResponseWriter>
|
324
|
+
|
325
|
+
<admin>
|
326
|
+
<defaultQuery>hydra</defaultQuery>
|
327
|
+
</admin>
|
328
|
+
|
329
|
+
</config>
|
data/solr_conf/solr.xml
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" ?>
|
2
|
+
<!--
|
3
|
+
Licensed to the Apache Software Foundation (ASF) under one or more
|
4
|
+
contributor license agreements. See the NOTICE file distributed with
|
5
|
+
this work for additional information regarding copyright ownership.
|
6
|
+
The ASF licenses this file to You under the Apache License, Version 2.0
|
7
|
+
(the "License"); you may not use this file except in compliance with
|
8
|
+
the License. You may obtain a copy of the License at
|
9
|
+
|
10
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
|
12
|
+
Unless required by applicable law or agreed to in writing, software
|
13
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
See the License for the specific language governing permissions and
|
16
|
+
limitations under the License.
|
17
|
+
-->
|
18
|
+
|
19
|
+
<!--
|
20
|
+
All (relative) paths are relative to the installation path
|
21
|
+
|
22
|
+
persistent: Save changes made via the API to this file
|
23
|
+
sharedLib: path to a lib directory that will be shared across all cores
|
24
|
+
-->
|
25
|
+
<solr persistent="false">
|
26
|
+
|
27
|
+
<!--
|
28
|
+
adminPath: RequestHandler path to manage cores.
|
29
|
+
If 'null' (or absent), cores will not be manageable via REST
|
30
|
+
-->
|
31
|
+
<cores adminPath="/admin/cores">
|
32
|
+
<core name="core0" instanceDir="core0" />
|
33
|
+
<core name="core1" instanceDir="core1" />
|
34
|
+
</cores>
|
35
|
+
</solr>
|
data/spec/factories.rb
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
|
3
|
+
# Users
|
4
|
+
|
5
|
+
# Prototype user factory
|
6
|
+
factory :user, :aliases => [:owner] do |u|
|
7
|
+
sequence :uid do |n|
|
8
|
+
"person#{n}"
|
9
|
+
end
|
10
|
+
email { "#{uid}@example.com" }
|
11
|
+
password { uid }
|
12
|
+
new_record false
|
13
|
+
end
|
14
|
+
|
15
|
+
factory :archivist, :parent=>:user do |u|
|
16
|
+
uid 'archivist1'
|
17
|
+
password 'archivist1'
|
18
|
+
end
|
19
|
+
factory :registered_user, :parent=>:user do |u|
|
20
|
+
uid 'registered_user'
|
21
|
+
password 'registered_user'
|
22
|
+
end
|
23
|
+
factory :staff, :parent=>:user do |u|
|
24
|
+
uid 'staff1'
|
25
|
+
password 'staff1'
|
26
|
+
roles { ["staff"] }
|
27
|
+
end
|
28
|
+
factory :student, :parent=>:user do |u|
|
29
|
+
uid 'student1'
|
30
|
+
password 'student1'
|
31
|
+
roles { ["student"] }
|
32
|
+
end
|
33
|
+
factory :joe_creator, :parent=>:user do |u|
|
34
|
+
uid 'joe_creator'
|
35
|
+
password 'joe_creator'
|
36
|
+
roles { ["faculty"] }
|
37
|
+
end
|
38
|
+
factory :martia_morocco, :parent=>:user do |u|
|
39
|
+
uid 'martia_morocco'
|
40
|
+
password 'martia_morocco'
|
41
|
+
roles { ["faculty", "africana-faculty"] }
|
42
|
+
end
|
43
|
+
factory :ira_instructor, :parent=>:user do |u|
|
44
|
+
uid 'ira_instructor'
|
45
|
+
password 'ira_instructor'
|
46
|
+
roles { ["faculty", "africana-faculty"] }
|
47
|
+
end
|
48
|
+
factory :calvin_collaborator, :parent=>:user do |u|
|
49
|
+
uid 'calvin_collaborator'
|
50
|
+
password 'calvin_collaborator'
|
51
|
+
roles { ["student"] }
|
52
|
+
end
|
53
|
+
factory :sara_student, :parent=>:user do |u|
|
54
|
+
uid 'sara_student'
|
55
|
+
password 'sara_student'
|
56
|
+
roles { ["student", "africana-104-students"] }
|
57
|
+
end
|
58
|
+
factory :louis_librarian, :parent=>:user do |u|
|
59
|
+
uid 'louis_librarian'
|
60
|
+
password 'louis_librarian'
|
61
|
+
roles { ["library-staff", "repository-admin"] }
|
62
|
+
end
|
63
|
+
factory :carol_curator, :parent=>:user do |u|
|
64
|
+
uid 'carol_curator'
|
65
|
+
password 'carol_curator'
|
66
|
+
roles { ["library-staff", "repository-admin"] }
|
67
|
+
end
|
68
|
+
factory :alice_admin, :parent=>:user do |u|
|
69
|
+
uid 'alice_admin'
|
70
|
+
password 'alice_admin'
|
71
|
+
roles { ["repository-admin"] }
|
72
|
+
end
|
73
|
+
|
74
|
+
#
|
75
|
+
# Repository Objects
|
76
|
+
#
|
77
|
+
|
78
|
+
factory :asset, :class => ModsAsset do |o|
|
79
|
+
end
|
80
|
+
|
81
|
+
factory :admin_policy, :class => Hydra::AdminPolicy do |o|
|
82
|
+
end
|
83
|
+
|
84
|
+
factory :default_access_asset, :parent=>:asset do |a|
|
85
|
+
permissions [{:name=>"joe_creator", :access=>"edit", :type=>"user"}]
|
86
|
+
end
|
87
|
+
|
88
|
+
factory :dept_access_asset, :parent=>:asset do |a|
|
89
|
+
permissions [{:name=>"africana-faculty", :access=>"read", :type=>"group"}, {:name=>"joe_creator", :access=>"edit", :type=>"user"}]
|
90
|
+
end
|
91
|
+
|
92
|
+
factory :org_read_access_asset, :parent=>:asset do |a|
|
93
|
+
permissions [{:name=>"registered", :access=>"read", :type=>"group"}, {:name=>"joe_creator", :access=>"edit", :type=>"user"}, {:name=>"calvin_collaborator", :access=>"edit", :type=>"user"}]
|
94
|
+
end
|
95
|
+
|
96
|
+
factory :open_access_asset, :parent=>:asset do |a|
|
97
|
+
permissions [{:name=>"public", :access=>"read", :type=>"group"}, {:name=>"joe_creator", :access=>"edit", :type=>"user"}, {:name=>"calvin_collaborator", :access=>"edit", :type=>"user"}]
|
98
|
+
end
|
99
|
+
|
100
|
+
end
|
101
|
+
|