This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
I'm migrating from joomla, and want to keep using the previous database schema. I tried:
- Create some custom User & UserGroup model
-
Edit the Backend\Classes\AuthManager class to use that model like so:
//... class AuthManager extends RainAuthManager { protected static $instance; protected $sessionKey = 'admin_auth'; protected $userModel = 'Backend\Models\Joomla\User'; protected $groupModel = 'Backend\Models\Joomla\UserGroup'; protected $throttleModel = 'Backend\Models\UserThrottle'; protected $requireActivation = false;
It worked as expected. But, when I deploy this to a new machine, it always overridden to default after running composer install. I can just git reset that changes and move on but, is there any cleaner solution?
Yes, in your plugin's boot method, register your own Auth Manager class instead of overwriting the base class.
App::extend('backend.auth', function () {
return \Your\Parh\AuthManager::instance();
});
mjauvin said:
Yes, in your plugin's boot method, register your own Auth Manager class instead of overwriting the base class.
App::extend('backend.auth', function () { return \Your\Parh\AuthManager::instance(); });
Oh I see, so I need to create plugin instead of modifying the base class. Thanks!
mjauvin said:
let us know how that goes!
Added custom AuthManager to Plugin's boot method:
public function boot()
{
App::extend('backend.auth', function () {
return \Joomla\BackendUser\AuthManager::instance();
});
}
When using tinker, the backend.auth instance is correct, but when attempting to login from /backend/auth/signin
it's still using base instance.
It works if I create a custom ServiceProvider
, copied from System\ServiceProvider
, and change the backend.auth like so:
protected function registerSingletons()
{
App::singleton('backend.auth', function () {
return \Joomla\BackendUser\AuthManager::instance();
});
}
then add it to config/app.php
. But I think this is not a clean solution for a plugin
Last updated
firmantr354987 said:
mjauvin said:
let us know how that goes!
Added custom AuthManager to Plugin's boot method:
public function boot() { App::extend('backend.auth', function () { return \Joomla\BackendUser\AuthManager::instance(); }); }
When using tinker, the backend.auth instance is correct, but when attempting to login from
/backend/auth/signin
it's still using base instance.
Try replacing "extend" for "singleton" above to see. If that doesn't work, try that in register() method
mjauvin said:
firmantr354987 said:
mjauvin said:
let us know how that goes!
Added custom AuthManager to Plugin's boot method:
public function boot() { App::extend('backend.auth', function () { return \Joomla\BackendUser\AuthManager::instance(); }); }
When using tinker, the backend.auth instance is correct, but when attempting to login from
/backend/auth/signin
it's still using base instance.Try replacing "extend" for "singleton" above to see. If that doesn't work, try that in register() method
tried that before, not working..
it seems like boot / register method on the plugin is not being called
=========================
Edit:
Found the problem, the plugin register method is not being called because I haven't set the elevated
property to true. The solution:
/**
* BackendUser Plugin Information File
*/
class Plugin extends PluginBase
{
/**
* @var boolean Determine if this plugin should have elevated privileges.
*/
public $elevated = true;
SOLVED, thanks!
Last updated
1-12 of 12