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

[EP-tech] User Roles

So, somewhere in the function that includes the errant line, before the errant line, you should have something like:
my $repository = ?;

or there might be reference to $session or $self->{session}.

There's a useful-to-know bit of EPrints history here - around 'repository' and 'session'.

$repository is a newer (and more correct) way of doing _most_ things - but there may still be code such as:

$self->{session}->get_conf( ? );
Which may do the same as:
$self->get_repository->get_conf( ? );

In the in-module documentation/code there's still some mixing of old and new, such as:
(in the Synopsis of the module):
EPrints::DataObj::EventQueue->create_unique( $repo, ?);

But further down the module:
(in the actual method):
EPrints::DataObj::EventQueue->create_unique( $self->{session}, ?);


From: eprints-tech-bounces at ecs.soton.ac.uk [mailto:eprints-tech-bounces at ecs.soton.ac.uk] On Behalf Of James Kerwin via Eprints-tech
Sent: 16 January 2020 12:33
To: Newman D.R. <drn at ecs.soton.ac.uk>
Cc: eprints-tech at ecs.soton.ac.uk
Subject: Re: [EP-tech] User Roles


I was getting errors in epadmin, but I'd fixed those (the one on github has not been updated to reflect this).

The indexer log: I had no idea this existed and it's provided a clue:

Event::TwitterEvent::send_tweet: Error during execution: Can't call method "get_conf" on an undefined value at /opt/eprints3/archives/uolrepo/cfg/plugins/EPrints/Plugin/Event/TwitterEvent.pm line 44, <DATA> line 960.

Which is.... my $hashtagsfield = $repository->get_conf( "twitter", "hashtagsfield");

I'm assuming this is because in this case I'm using the "keywords" of an EPrint as hashtags and the particular example record doesn't have keywords and so.... Failure.

Thank you so much for this David. Knowing about the indexer log changes this from stumbling around in the dark to something I might be able to investigate.


On Thu, Jan 16, 2020 at 12:15 PM Newman D.R. <drn at ecs.soton.ac.uk<mailto:drn at ecs.soton.ac.uk>> wrote:

Hi James,

I am fairly certain, as you say, that the roles for the Coin DOI button under actions as you really want to restrict who can uses this.

I assume you are seeing "Everything Seems OK" when you run epadmin test.  I know certain things won't be covered there and this is only a syntax check when you actually start passing around real values might be when the bug becomes apparent.  I ofter run:

to test the individual file syntactically.  However, as this is running the the indexer, any runtime error message is likely to appear in indexer.log under EPRINTS_PATH/var/.  Also it should be noted that need to restart the Indexer not just reload Apache* to put into effect any changes you have made to the event plugin.


David Newman
*Reloading Apache should not necessary but is a good sanity check and if you do have a bug saves this taking down to repository next time Apache is reloaded/restart for something else or a general reboot of the server.

On 16/01/2020 11:59, James Kerwin wrote:
Hi David,

Thanks for this. As it happens I was heavily borrowing from the DataCite plugin because it seems to have a bit of everything in it. The only obvious difference I can see between that and mine (beyond the overall quality and programming ability) is the roles, but I was (and still am) convinced that the roles were for the appearance of the minting button.

I would have thought that, if I'd made an error in my code, the server would refuse to show me any EPrints pages after a restart until I'd fixed it. Perhaps Events work differently.


On Thu, Jan 16, 2020 at 8:50 AM Newman D.R. <drn at ecs.soton.ac.uk<mailto:drn at ecs.soton.ac.uk>> wrote:

Hi James,

The DataCiteDOI Bazaar plugin contains an Event plugin that it used to calls DataCite to coin (mint) a DOI.  This sounds like it would be doing a similar thing to posting some (I think) JSON to generate a tweet:



David Newman
On 16/01/2020 08:39, Adam Field via Eprints-tech wrote:
Is it in github?  Can you link me to the code?

On 16 Jan 2020 08:31, James Kerwin via Eprints-tech <eprints-tech at ecs.soton.ac.uk><mailto:eprints-tech at ecs.soton.ac.uk> wrote:
Hi All,

I rewrote my twitter bot using a different Perl module as it wasn't working how I wanted it to (failed with "special characters").

It worked when I rewrote it as a .pl in cfg.d. I then decided to rewrite it as an Event plugin as this seems like the "proper" way to do things. Unfortunately, it doesn't work.

I can see that it gets added to the indexer and it subsequently fails.

One possible reason it fails is that I don't have any user roles set up for it. For an event plugin, do I need user roles to be set up?

I've tried to look at documentation for other plugins, but they also involve a "Screen" plugin which is what I assume the user roles are for. My plugin just uses the status change trigger to compile and send a tweet.

Any pointers greatly appreciated.


*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech

*** Archive: https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.eprints.org%2Ftech.php%2F&amp;data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7Cab6cd27b422f45bfa00b08d79a8240c1%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&amp;sdata=lWGv6yoe%2B9PJi8IowMc%2FRLX0Oe8iGb1gV80uhFXE%2FK0%3D&amp;reserved=0<https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.eprints.org%2Ftech.php%2F&amp;data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7Cab6cd27b422f45bfa00b08d79a8240c1%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&amp;sdata=lWGv6yoe%2B9PJi8IowMc%2FRLX0Oe8iGb1gV80uhFXE%2FK0%3D&amp;reserved=0>

*** EPrints community wiki: https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwiki.eprints.org%2F&amp;data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7Cab6cd27b422f45bfa00b08d79a8240c1%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&amp;sdata=emc8Z6qaTL%2BNDXRURwWcAl7x5CkvJCCJhkaZkzKw9XY%3D&amp;reserved=0<https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwiki.eprints.org%2F&amp;data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7Cab6cd27b422f45bfa00b08d79a8240c1%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&amp;sdata=emc8Z6qaTL%2BNDXRURwWcAl7x5CkvJCCJhkaZkzKw9XY%3D&amp;reserved=0>

*** EPrints developers Forum: https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fforum.eprints.org%2F&amp;data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7Cab6cd27b422f45bfa00b08d79a8240c1%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&amp;sdata=m8mISeheXjcnAPXrLX9ExS2hAeYj4kiwkPbVo7FwdOA%3D&amp;reserved=0<https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fforum.eprints.org%2F&amp;data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7Cab6cd27b422f45bfa00b08d79a8240c1%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&amp;sdata=m8mISeheXjcnAPXrLX9ExS2hAeYj4kiwkPbVo7FwdOA%3D&amp;reserved=0>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ecs.soton.ac.uk/pipermail/eprints-tech/attachments/20200116/4937054e/attachment-0001.html