Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default role for new users #461

Open
Fanvaron opened this issue Feb 6, 2018 · 3 comments
Open

Default role for new users #461

Fanvaron opened this issue Feb 6, 2018 · 3 comments

Comments

@Fanvaron
Copy link

Fanvaron commented Feb 6, 2018

Hi,
I just installed YAWIK for the first time and am working through all the options.
I'm trying to make the default role for new Users, applicant/user instead of recruiter.
I have the following config in autoload/auth.options.global.php:

'role' => 'user',

When I go on the login page and switch to register, there is the hidden field

<input type="hidden" name="register[role]" id="register-role" class=" form-control " value="user">

But the new users are still recruiters.
Am I missing anything else?
I did not find anything at all about changing default role in the docs and looking through old issues here I would have expected the hidden field to change what I want.

Hope someone can help me with this.

Sincerely
Marvin

@cbleek
Copy link
Member

cbleek commented Feb 6, 2018

Hi,

by default yawik runs in production mode. If you make changes to the config files in autoload, please make sure to remove the

/var/www/YAWIK# ls -1 cache/module-c*
cache/module-classmap-cache.module_map.php
cache/module-config-cache.production.php

you can also register as an user by using a route

Example:
https://yawik.org/demo/de/auth/register/user

Regards,

Carsten

@Fanvaron
Copy link
Author

Fanvaron commented Feb 6, 2018

Thank you for the quick answer Carsten,
I already regularly delete the two cache files.

And while the specific user route works, I need to have it so that new account are always and only users.

I have now found that when I edit the module/Auth/src/Auth/Form/Register.php so that the constructors default value for role = user, it works.
And while I could live with that I don't think that that is a very nice solution since it's not update safe.

I also don't understand why the config does not work, is it the way I did the config or is there maybe a different problem in my setup?

I had a similar problem with my smpt config, it read all of the actual config but the
$transport = 'smtp'; line seems to have been ignored.
It always did the sendmail method until I edited the core/mail/MailServiceFactory.php so that it would not do the $mailServiceOptions->getTransportClass() == 'smtp' check but always assumes that it is smtp.

I attached the two files which are placed in config/autoload
(edited for privacy and renamed to .txt so I can upload here)
auth.options.global.php.txt
MailServiceOptions.config.local.php.txt

@TiSiE
Copy link
Member

TiSiE commented Feb 8, 2018

The 'role' option in auth.options.global.php is currently only used when user are created automatically through "external" login.

So we can consider this a non-convinient behaviour.

The option should indeed also set the default user role for registration through the web ui.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants