EPrints Technical Mailing List Archive

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

Message: #09721


< 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 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" );

#OR

$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 }];

# AND

$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?

 

Cheers

-- 
Matty Kerwin (he/him)

Web Developer
EDR Development
Digital Business Solutions

QUT-Logo

Queensland University of Technology
Email: matthew.kerwin@qut.edu.au
KG-X232, Kelvin Grove Campus

 

 

From: eprints-tech-request@ecs.soton.ac.uk <eprints-tech-request@ecs.soton.ac.uk> On Behalf Of James Kerwin
Sent: Thursday, June 6, 2024 8:39 PM
To: eprints-tech@ecs.soton.ac.uk
Subject: [EP-tech] User Roles for Admin Screen Tab

 

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

ZjQcmQRYFpfptBannerStart

This Message Is From an Untrusted Sender

You have not previously corresponded with this sender.

ZjQcmQRYFpfptBannerEnd

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