YAWIK
YAWIK copied to clipboard
Default role for new users
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
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
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
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.