[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[EP-tech] Setting editorial scope by roles



Hi Robin,
You can add additional fields to control the user review scope by adding them to the copy of this:
https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Feprints%2Feprints%2Fblob%2F3.3%2Flib%2Fdefaultcfg%2Fcfg.d%2Fuser_review_scope.pl&data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C87a80fc099e14dc2e96708d834d8b21c%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&sdata=vzCnKXyCx%2BgecIo5oV2IzrbuOfUk0BoxF8ZvFlkg9Wc%3D&reserved=0
in archives/ARCHIVEID/cfg/cfg.d/

I think you might need to add any field that you want to use in the editperms to that first.

Then, construct a search object with the fields/values you want, and use the $search->serialise method.

Remember that editperms is a multiple field - so it's an array that you can push the value on to.

*** ENTIRELY UNTESTED - hopefully enough to get you sorted though ***
my $ds = $session->dataset( "eprint" );
my $searchexp = $ds->prepare_search();
$searchexp->add_field(
    fields => [
      $ds->field( 'userid' ),
    ],
    value => 100,
    match => "EX",
);

push @{$user->value( "editperms" )}, $searchexp->serialise;

Cheers,
John




From: eprints-tech-bounces at ecs.soton.ac.uk [mailto:eprints-tech-bounces at ecs.soton.ac.uk] On Behalf Of Robin Sylvestre via Eprints-tech
Sent: 30 July 2020 05:44
To: eprints-tech at ecs.soton.ac.uk
Subject: [EP-tech] Setting editorial scope by roles

Hello friends of EPrints,

Does anybody know how to set editorial scope based on a user role? I don't think there's a native way to add them with roles, but based on a role given to a user I would like to assign editperms to the current user ($repo->current_user->{editperms} ) on login and I can't find the correct syntax. I've looked in the documentation for an example how to set this variable and I can't find much. It should be close to a search equation but it's stored in the database in the form of 0|1||eprint|-|type:type:ANY:EQ:article|-| . How do I translate that into an array?

Looking forward for your advice.

Robin Sylvestre
Technicien des syst?mes informatis?s
Biblioth?que Louise-Lalonde-Lamarre
Polytechnique Montr?al
514-340-4711 poste 5973
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ecs.soton.ac.uk/pipermail/eprints-tech/attachments/20200730/196c0df4/attachment.html