/
User.pm
1756 lines (1241 loc) · 41.5 KB
/
User.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
######################################################################
#
# EPrints::DataObj::User
#
######################################################################
#
#
######################################################################
=pod
=for Pod2Wiki
=head1 NAME
B<EPrints::DataObj::User> - Class representing a single user.
=head1 DESCRIPTION
This class represents a single eprint user record and the metadata
associated with it.
This class is a subclass of L<EPrints::DataObj> with the following
metadata fields, along with fields in C<cfg.d/user_fields.pl>.
=head1 CORE METADATA FIELDS
=over 4
=item userid (int)
The unique ID number of this user record. Unique within the current
repository.
=item rev_number (int)
The revision number of this record. Each time it is changed the
revision number is increased. This is not currently used for anything
but it may be used for logging later.
=item username (text)
The username of this user. Used for logging into the system. Unique
within this repository.
=item password (secret)
The crypted password for this user as generated by
L<EPrints::Utils/crypt>. This may be ignored if for example LDAP
authentication is being used.
=item usertype (namedset)
The type of this user. The options are configured in
C<metadata-phrases.xml>.
=item newemail (email)
Used to store a new but as yet unconfirmed email address.
=item newpassword (secret)
Used to store a new but as yet unconfirmed password.
=item pin (text)
A code required to confirm a new username or password. This code is
emailed to the user to confirm they are who they say they are.
=item pinsettime (int)
When the pin code was set, so we can make it time out.
=item loginattempts (int)
Number of login attempts since last successful login.
=item unlocktime (int)
Time at which user account will be unlocked after too many failed
login attempts.
=item joined (time)
The date and time that the user account was created. Before EPrints
2.4 this was a date field so users created before the upgrade will
appear to have been created at midnight.
=item email (email)
The email address of this user. Unique within the repository.
=item lang (arclanguage)
The ID of the preferred language of this user. Only really used in
multilingual repositories.
=item editperms (search, multiple)
This field is used to filter what eprints a staff member can
approve and modify. If it's unset then they can modify any (given
the correct privs. but if it is set then an eprint must match at
least one of the searches to be within their scope.
=item frequency (set)
Only relevant to staff accounts. Is the frequency they want to be
mailed about eprints matching their scope that are in editorial
review. never, daily, weekly or monthly.
=item mailempty (boolean)
Only relevant to staff accounts. If set to true then emails are
sent even if there are no items matching the scope.
=item latitude (float)
The latitude of the location where the user is based.
=item longitude (float)
The longitude of the location where the user is based.
=item preference (storable)
User preferences which need to be persistent. Stored as a
serialization of simple key-value pairs.
=item captcha (recaptcha)
A ReCAPTCHA field to use to protect user password resets and
similar forms from being spammed.
=back
=head1 REFERENCES AND RELATED OBJECTS
=over 4
=item saved_searches (subobject, multiple)
Saved searches created by this user.
=item item_fields (fields, multiple)
Stores bespoke metafields created by this user and stored in the database.
=head1 INSTANCE VARIABLES
See L<EPrints::DataObj|EPrints::DataObj#INSTANCE_VARIABLES>.
=back
=head1 METHODS
=cut
package EPrints::DataObj::User;
@ISA = ( 'EPrints::DataObj' );
use EPrints;
use EPrints::Search;
use strict;
# Privs and Role related methods
# this maps roles onto privs
my $PRIVMAP =
{
general =>
[
"user/view:owner",
"user/details:owner",
"user/history:owner",
],
"edit-own-record" =>
[
"user/edit:owner",
],
"set-password" =>
[
"set-password",
],
"change-email" =>
[
# not done
],
"change-user" =>
[
# not done
],
"staff-view" =>
[
# still needs search tools
"eprint/inbox/view",
"eprint/inbox/summary",
"eprint/inbox/export",
"eprint/inbox/details",
"eprint/inbox/history",
"eprint/buffer/view",
"eprint/buffer/summary",
"eprint/buffer/export",
"eprint/buffer/details",
"eprint/buffer/history",
"eprint/archive/view",
"eprint/archive/export",
"eprint/archive/details",
"eprint/archive/history",
"eprint/deletion/view",
"eprint/deletion/summary",
"eprint/deletion/export",
"eprint/deletion/details",
"eprint/deletion/history",
"eprint/search/staff",
],
"view-status" =>
[
"status"
],
"admin" =>
[
"indexer/stop",
"indexer/start",
"indexer/force_start",
"create_user",
"subject/edit",
"staff/user_search",
"staff/history_search",
"staff/issue_search",
"config/view",
"config/view/xml",
"config/view/workflow",
"config/view/citation",
"config/view/phrase",
"config/view/namedset",
"config/view/template",
"config/view/static",
"config/view/autocomplete",
"config/view/apache",
"config/view/perl",
"config/test_email",
"config/imports",
"config/add_field",
"config/remove_field",
"config/regen_abstracts",
"config/regen_citations",
"config/regen_views",
"config/edit/perl",
"storage/manager",
"repository/epm", #EPrints Package Manager
"event_queue/destroy",
"event_queue/details",
"event_queue/edit",
"event_queue/export",
"event_queue/view",
"eprint/destroy",
"eprint/details",
"eprint/edit",
"eprint/export",
"eprint/upsert",
"eprint/view",
"eprint/archive/remove",
"eprint/archive/edit", # BatchEdit
"file/destroy",
"file/export",
"file/view",
"import/view",
"import/edit",
"saved_search/destroy",
"saved_search/details",
"saved_search/edit",
"saved_search/export",
"saved_search/view",
"user/remove",
"user/edit",
"user/view",
"user/details",
"user/destroy",
"user/history",
"user/staff/edit",
"repository/epm-submit", #EPrints Package Manager - Bazaar Package Submission
],
"toolbox" =>
[
"toolbox",
],
"edit-config" =>
[
"config/edit",
"config/edit/xml",
"config/edit/workflow",
"config/edit/citation",
"config/edit/phrase",
"config/edit/namedset",
"config/edit/template",
"config/edit/static",
"config/edit/autocomplete",
# not editing perl files or apache files!
"config/reload",
],
"saved-searches" =>
[
"saved_search",
"create_saved_search",
"saved_search/view:owner",
"saved_search/edit:owner",
"saved_search/destroy:owner",
],
deposit =>
[
"items",
"create_eprint",
"user/history:owner",
"eprint/inbox/view:owner",
"eprint/inbox/export:owner",
"eprint/inbox/summary:owner",
"eprint/inbox/destroy:owner",
"eprint/inbox/deposit:owner",
"eprint/inbox/edit:owner",
"eprint/inbox/remove:owner",
"eprint/inbox/details:owner",
"eprint/inbox/history:owner",
"eprint/inbox/messages:owner",
"eprint/inbox/issues:owner",
"eprint/inbox/deposit:owner",
"eprint/inbox/use_as_template:owner",
"eprint/inbox/derive_version:owner",
"eprint/buffer/view:owner",
"eprint/buffer/export:owner",
"eprint/buffer/summary:owner",
"eprint/buffer/move_inbox:owner",
"eprint/buffer/details:owner",
"eprint/buffer/history:owner",
"eprint/buffer/messages:owner",
"eprint/buffer/request_removal:owner",
"eprint/buffer/use_as_template:owner",
"eprint/buffer/derive_version:owner",
"eprint/archive/view:owner",
"eprint/archive/export:owner",
"eprint/archive/summary:owner",
"eprint/archive/details:owner",
"eprint/archive/history:owner",
"eprint/archive/messages:owner",
"eprint/archive/request_removal:owner",
"eprint/archive/use_as_template:owner",
"eprint/archive/derive_version:owner",
"eprint/deletion/view:owner",
"eprint/deletion/export:owner",
"eprint/deletion/summary:owner",
"eprint/deletion/details:owner",
"eprint/deletion/history:owner",
"eprint/deletion/messages:owner",
"eprint/deletion/use_as_template:owner",
"eprint/deletion/derive_version:owner",
],
editor =>
[
"datasets",
"editorial_review",
"eprint/inbox/view:editor",
"eprint/inbox/export:editor",
"eprint/inbox/summary:editor",
"eprint/inbox/export:editor",
"eprint/inbox/details:editor",
"eprint/inbox/history:editor",
"eprint/inbox/messages:editor",
"eprint/inbox/remove_with_email:editor",
"eprint/inbox/move_archive:editor",
"eprint/inbox/move_buffer:editor",
"eprint/inbox/use_as_template:editor",
"eprint/inbox/derive_version:editor",
"eprint/inbox/edit:editor",
"eprint/inbox/takelock:editor",
"eprint/buffer/view:editor",
"eprint/buffer/export:editor",
"eprint/buffer/summary:editor",
"eprint/buffer/export:editor",
"eprint/buffer/details:editor",
"eprint/buffer/history:editor",
"eprint/buffer/messages:editor",
"eprint/buffer/issues:editor",
"eprint/buffer/remove_with_email:editor",
"eprint/buffer/reject_with_email:editor",
"eprint/buffer/move_inbox:editor",
"eprint/buffer/move_archive:editor",
"eprint/buffer/use_as_template:editor",
"eprint/buffer/derive_version:editor",
"eprint/buffer/edit:editor",
"eprint/buffer/takelock:editor",
"eprint/archive/view:editor",
"eprint/archive/export:editor",
"eprint/archive/details:editor",
"eprint/archive/history:editor",
"eprint/archive/messages:editor",
"eprint/archive/issues:editor",
"eprint/archive/move_buffer:editor",
"eprint/archive/move_deletion:editor",
"eprint/archive/use_as_template:editor",
"eprint/archive/derive_version:editor",
"eprint/archive/edit:editor",
"eprint/archive/takelock:editor",
"eprint/deletion/view:editor",
"eprint/deletion/export:editor",
"eprint/deletion/summary:editor",
"eprint/deletion/export:editor",
"eprint/deletion/details:editor",
"eprint/deletion/history:editor",
"eprint/deletion/messages:editor",
"eprint/deletion/move_archive:editor",
"eprint/deletion/use_as_template:editor",
"eprint/deletion/derive_version:editor",
"eprint/deletion/takelock:editor",
],
rest => [
"eprint/archive/rest/get:editor",
"eprint/archive/rest/put:editor",
"eprint/buffer/rest/get:editor",
"eprint/buffer/rest/put:editor",
"eprint/inbox/rest/get:editor",
"eprint/inbox/rest/put:editor",
"eprint/deletion/rest/get:editor",
"eprint/deletion/rest/put:editor",
"eprint/inbox/rest/get:owner",
"eprint/inbox/rest/put:owner",
"eprint/buffer/rest/get:owner",
"eprint/archive/rest/get:owner",
"eprint/deletion/rest/get:owner",
"user/rest/get:owner",
"subject/rest/get",
],
};
######################################################################
=pod
=head2 Constructor Methods
=cut
######################################################################
######################################################################
=pod
=over 4
=item $user = EPrints::DataObj::User->new( $session, $userid )
Load the user with the ID of $userid from the database and return
it as an EPrints::DataObj::User object.
=cut
######################################################################
sub new
{
my( $class, $session, $userid ) = @_;
return $session->get_database->get_single(
$session->dataset( "user" ),
$userid );
}
######################################################################
=pod
=item $user = EPrints::DataObj::User->new_from_data( $session, $data )
Construct a new EPrints::DataObj::User object based on the $data hash
reference of metadata.
Used to create an object from the data retrieved from the database.
=cut
######################################################################
sub new_from_data
{
my( $class, $session, $known ) = @_;
return $class->SUPER::new_from_data(
$session,
$known,
$session->dataset( "user" ) );
}
######################################################################
=pod
=item $user = EPrints::DataObj::User::create( $session, $user_type )
Create a new user in the database with the specified user type.
=cut
######################################################################
sub create
{
my( $session, $user_type ) = @_;
return EPrints::DataObj::User->create_from_data(
$session,
{ usertype=>$user_type },
$session->dataset( "user" ) );
}
######################################################################
=pod
=item $dataobj = EPrints::DataObj->create_from_data( $session, $data, $dataset )
Create a new object of this type in the database.
$dataset is the dataset it will belong to.
$data is the data structured as with new_from_data.
=cut
######################################################################
sub create_from_data
{
my( $class, $session, $data, $dataset ) = @_;
my $new_user = $class->SUPER::create_from_data( $session, $data, $dataset );
$new_user->update_triggers();
if( scalar( keys %{$new_user->{changed}} ) > 0 )
{
# Remove empty slots in multiple fields
$new_user->tidy;
# Write the data to the database
$session->get_database->update(
$new_user->{dataset},
$new_user->{data},
$new_user->{changed} );
}
$session->get_database->counter_minimum( "userid", $new_user->get_id );
return $new_user;
}
######################################################################
=pod
=back
=head2 Class Methods
=cut
######################################################################
######################################################################
=pod
=over 4
=item $fields = EPrints::DataObj::User->get_system_field_info
Returns an array describing the system metadata of the the user
dataset.
=cut
######################################################################
sub get_system_field_info
{
my( $class ) = @_;
return
(
{ name=>"userid", type=>"counter", required=>1, import=>0, can_clone=>1,
sql_counter=>"userid" },
{ name=>"rev_number", type=>"int", required=>1, can_clone=>0,
default_value=>1 },
{ name=>"saved_searches", type=>"subobject", datasetid=>'saved_search',
multiple=>1 },
{ name=>"username", type=>"idci", required=>1 },
{ name=>"password", type=>"secret", show_in_html=>0,
fromform=>\&EPrints::Utils::crypt_password },
{ name=>"usertype", type=>"namedset", required=>1,
set_name=>"user", input_style=>"medium", default_value=>"user" },
{ name=>"newemail", type=>"email", show_in_html=>0 },
{ name=>"newpassword", type=>"secret", show_in_html=>0,
fromform=>\&EPrints::Utils::crypt_password },
{ name=>"pin", type=>"text", show_in_html=>0 },
{ name=>"pinsettime", type=>"int", show_in_html=>0 },
{ name=>"loginattempts", type=>"int", "volatile" => 0, show_in_html=>0 },
{ name=>"unlocktime", type=>"int", "volatile" => 0, show_in_html=>0 },
{ name=>"joined", type=>"timestamp", required=>1 },
{ name=>"email", type=>"email", required=>1 },
{ name=>"lang", type=>"arclanguage", required=>0, input_rows=>1 },
{ name => "editperms",
multiple => 1,
input_ordered => 0,
input_add_boxes => 1,
input_boxes => 1,
type => "search",
datasetid => "eprint",
fieldnames_config => "editor_limit_fields",
},
{ name => "roles", multiple => 1, type => "id", text_index=>0 },
{ name=>"frequency", type=>"set", input_style=>"medium",
options=>["never","daily","weekly","monthly"],
default_value=>"never" },
{ name=>"mailempty", type=>"boolean", input_style=>"radio",
default_value=>"FALSE" },
{ name=>"items_fields", type=>"fields", datasetid=>"eprint",
multiple=>1, input_ordered=>1, required=>1, volatile=>1 },
{ name=>"latitude", type=>"float", required=>0 },
{ name=>"longitude", type=>"float", required=>0 },
{
name => "preference",
type => "storable",
sql_index => 0,
text_index => 0,
volatile => 1,
},
{
name => "captcha",
type => "recaptcha",
}
)
};
######################################################################
=pod
=item $dataset = EPrints::DataObj::User->get_dataset_id
Returns the ID of the L<EPrints::DataSet> object to which this record
belongs.
=cut
######################################################################
sub get_dataset_id
{
return "user";
}
######################################################################
=pod
=back
=head2 Object Methods
=cut
######################################################################
######################################################################
=pod
=over 4
=item $problems = $user->validate
Validate the user - find out if all the required fields are filled
out, and that what's been filled in is OK. Returns a reference to an
array of problem descriptions.
If there are no problems then the array is empty.
The problems are XHTML DOM objects describing the problem.
=cut
######################################################################
sub validate
{
my( $self, $for_archive, $workflow_id ) = @_;
$workflow_id = "default" if !defined $workflow_id;
my @problems;
my $user_ds = $self->{session}->get_repository->get_dataset( "user" );
my %opts = ( item=> $self, session=>$self->{session} );
my $workflow = EPrints::Workflow->new( $self->{session}, $workflow_id, %opts );
push @problems, $workflow->validate;
push @problems, @{ $self->SUPER::validate( $for_archive ) };
return( \@problems );
}
######################################################################
=pod
=item $success = $user->commit( [ $force ] )
Writes this user data object to the database.
If C<$force> is set and C<true> then dave to the database even if no
fields have changed. Otherwise, only save if at least one field has
changed.
Returns a boolean depending on whether the user data object was
successfully committed.
=cut
######################################################################
sub commit
{
my( $self, $force ) = @_;
$self->update_triggers();
if( !defined $self->{changed} || scalar( keys %{$self->{changed}} ) == 0 )
{
# don't do anything if there isn't anything to do
return( 1 ) unless $force;
}
if( $self->{non_volatile_change} )
{
$self->set_value( "rev_number", ($self->get_value( "rev_number" )||0) + 1 );
}
if (exists $self->{changed}->{password})
{
$self->close_non_current_login_tickets;
}
my $success = $self->SUPER::commit( $force );
return( $success );
}
######################################################################
=pod
=item $user->close_non_current_login_tickets
Close all login tickets for this user except the one they are
currently logged in on.
=cut
######################################################################
sub close_non_current_login_tickets
{
my ($self) = @_;
my $repo = $self->repository;
my $current_ticket = $repo->current_loginticket;
my $ticket_ds = $repo->dataset('loginticket');
my $user_tickets = $ticket_ds->search(
filters => [ {meta_fields => ['userid'], value => $self->id} ]
);
$user_tickets->map(
sub
{
my ($repo, $ds, $ticket, $current_ticket) = @_;
if ($ticket->value('code') ne $current_ticket->value('code'))
{
$ticket->remove;
}
},
$current_ticket
);
}
######################################################################
=pod
=item $success = $user->remove
Remove this user from the database. Also, remove their saved searches,
but do not remove their eprints.
=cut
######################################################################
sub remove
{
my( $self ) = @_;
my $success = 1;
foreach my $saved_search ( $self->get_saved_searches )
{
$saved_search->remove;
}
# remove user record
my $user_ds = $self->{session}->get_repository->get_dataset( "user" );
$success = $success && $self->{session}->get_database->remove(
$user_ds,
$self->get_value( "userid" ) );
return( $success );
}
######################################################################
=pod
=item $bool = $user->is_staff
Returns true if the user L</has_role> is C<editor> or C<admin>.
=cut
######################################################################
sub is_staff
{
my( $self ) = @_;
return $self->has_role( 'editor' ) || $self->has_role( 'admin' );
}
######################################################################
=pod
=item $lang = $user->language
Get the preferred language of this user.
=cut
######################################################################
sub language
{
my( $self ) = @_;
my $langid = $self->value( "lang" );
my $lang = $self->{session}->get_repository->get_language( $langid );
return $lang;
}
######################################################################
=pod
=item $list = $user->owned_eprints_list( %opts )
Returns a L<EPrints::List> of all the L<EPrints::DataObj::EPrint>s
owned by this user.
C<%opts> is passed to a L<EPrints::Search>, which is used to filter
the results.
=cut
######################################################################
sub owned_eprints_list
{
my( $self, %opts ) = @_;
$opts{dataset} = $self->{session}->dataset( "eprint" ) if !defined $opts{dataset};
my $searchexp = $opts{dataset}->prepare_search( %opts );
# BACKWARDS COMPATIBILITY
# This method is predicated on doing an in-memory intersect of everything
# that the user "owns" and every eprint in the matching datasets
# If the user chose to show his 'live' eprints that could get really,
# really big
my $fn = $self->{session}->config( "get_users_owned_eprints" );
if( !defined $fn )
{
$searchexp->add_field( $opts{dataset}->field( "userid" ), $self->id );
return $searchexp->perform_search;
}
my $list = &$fn( $self->{session}, $self, $opts{dataset} );
if (!$searchexp->is_blank()) { $list = $list->intersect( $searchexp->perform_search ); }
return $list;
}
######################################################################
=pod
=item $list = $user->editable_eprints_list( %opts )
Returns a L<EPrints::List> of L<EPrints::DataObj::EPrint>s that match
this user's editorial search expressions. If the user has no editorial
scope a list of all eprints that match the given C<%opts> is returned.
C<%opts> is passed to a L<EPrints::Search> which is used to filter the
results.
$list = $user->editable_eprints_list(
dataset => $repo->dataset( "buffer" ),
);
=cut
######################################################################
sub editable_eprints_list
{
my( $self, %opts ) = @_;
$opts{dataset} = $self->{session}->dataset( "eprint" ) if !defined $opts{dataset};
if( !$self->is_set( 'editperms' ) )
{
return $opts{dataset}->search(
custom_order => "-datestamp",
%opts );
}