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

[EP-tech] Usertype at demoeprints



Hi Agung,
I *think* the code that's reverting the usertype to 'user' is in [EPRINTS_ROOT]/perl_lib/EPrints/Plugin/Screen/NewUser.pm
In the 'action_create' sub, the config 'default_user_type' is referenced, and the user is created with this.
This config is normally in [EPRINTS_ROOT]/archives/[ARCHIVEID]/cfg/cfg.d/registration.pl

I think there are two options:
i) override the NewUser plugin (see: https://wiki.eprints.org/w/Instructions_for_local_plugins) - you just need to override the 'action_create'.
ii) Make the 'default_user_type' find the data in the request, and return the value selected.

With either option, you should make sue the usertype chosen isn't going to cause you problems - e.g allowing someone to create an admin account could allow them to break things!
If you want to limit the usertype options in the workflow, you can add an 'options' parameter e.g.:
<component><field ref="usertype" options="user,editor"/></component>
but you should also validate that one of those options has been chosen when processing the registration.

Cheers,
John


From: eprints-tech-bounces at ecs.soton.ac.uk [mailto:eprints-tech-bounces at ecs.soton.ac.uk] On Behalf Of Ajunk Pracetio
Sent: 13 August 2017 11:41
To: eprints-tech at ecs.soton.ac.uk
Subject: [EP-tech] Usertype at demoeprints

Hi,
I want to create a demoprint like http://demoprints.eprints.org/. I've been able to bring up the usertype option at registration, but when I select "editor", and try to login, the usertype is still the user, not the "editor" as I choose. It looks like my selection is not saved.

Is there a wrong move? Please guidance.

thank you
regards,
Agung

--
Life isn't valuable if you don't have someone to care
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ecs.soton.ac.uk/pipermail/eprints-tech/attachments/20170814/5420a74b/attachment.html