EPrints Technical Mailing List Archive

See the EPrints wiki for instructions on how to join this mailing list and related information.

Message: #09724

< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First

Re: [EP-tech] User Roles for Admin Screen Tab

CAUTION: This e-mail originated outside the University of Southampton.

Hi all, I sent this yesterday from my uni address but it hasn't made
it through to the list yet, so I'm trying again from home:

Hi James,

Forgive my rambling, I’m working through deep memories as I write:

If I recall correctly, user_roles.pl by default defines two config items:

1. $c->{user_roles}, which associates a list of tokens with each role.
Those tokens (things like “edit-own-record” or “staff-view”) are each
an alias for a list of specific actions defined in $PRIVMAP in
EPrints/DataObj/User.pm (“staff-view” has things like
“eprint/inbox/view”, “eprint/search/staff”, etc.)
And each one of those specific actions is asserted in the code using a
check like:

$user->allow( "eprint/search/staff" );
$user->allow("eprint/inbox/view", $eprint);

2. $c->{roles} to define new repo-specific tokens/actions; for example
in our repo we have:

$c->{roles}->{indexer} = [qw{ indexer/stop indexer/start indexer/force_start }];
$c->{user_roles}->{repo_manager} = [qw{ … indexer … }];

So working at it from the bottom up:

* in your screen plugin you’d have a test for: $user->allow("config/aam_update")
* in your $c->{roles} you’d define a new hat like:
$c->{roles}->{aam-update} = [qw{ config/aam_update }];
* in your $c->{user_roles} you’d do something like:
push(@{$c->{user_roles}->{admin}}, "aam-update");
(depending on your version of Perl, you might want to leave out that @{} )

Does that help?


On Thu, 6 Jun 2024 at 20:41, James Kerwin <jkerwin2101@gmail.com> wrote:
> CAUTION: This e-mail originated outside the University of Southampton.
> CAUTION: This e-mail originated outside the University of Southampton.
> Hi All,
> I've been removed from my ongoing work to do the repository/server upgrade.
> On the old repo I made a custom plugin for myself (admin) and team (editors) to run an AAM updates script by pushing a button.
> At the time I couldn't work out how to add this to user_roles.pl so I was improper and edited:
> /opt/eprits3/perl_lib/EPrints/DataObj/User.pm
> under the admin and editor sections with:
> "config/aam_update",
> Can anyone advise on the syntax to use to add this to user_reoles.pl? I would like this fresh start to have everything done properly, but this is starting to hold up my upgrade and I'm edging towards editing User.pm again.
> For more info, the new tab is on the screen where you go to the Admin section repo_urlcgi/users/home?screen=Admin where we have "Editorial Tools, System Tools and Config Tools". The button exists under a tab named "Misc. Tools".
> Thanks,
> James
> *** Options: https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwiki.eprints.org%2Fw%2FEprints-tech_Mailing_List&data=05%7C02%7Ceprints-tech%40ecs.soton.ac.uk%7Caf3e7351ea0a4e3a1cdb08dc87507b4c%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C638534027503471246%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C60000%7C%7C%7C&sdata=NzzUglH8nnR9ODdnwCZjTNWex07SccmgpvwH0m1hsXE%3D&reserved=0
> *** Archive: https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.eprints.org%2Ftech.php%2F&data=05%7C02%7Ceprints-tech%40ecs.soton.ac.uk%7Caf3e7351ea0a4e3a1cdb08dc87507b4c%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C638534027503471246%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C60000%7C%7C%7C&sdata=wcRTCURqhnFln%2BHqsrBCK%2By3qRmiuT5NSXO9MPxbzE8%3D&reserved=0
> *** EPrints community wiki: https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwiki.eprints.org%2F&data=05%7C02%7Ceprints-tech%40ecs.soton.ac.uk%7Caf3e7351ea0a4e3a1cdb08dc87507b4c%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C638534027503471246%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C60000%7C%7C%7C&sdata=uRFDMlwxK2iYH%2FSE%2Fy8vCbTWOxm2LHneb9PROyupTV0%3D&reserved=0

  Matthew Kerwin [he/him]