bizley / yii2-podium

Yii 2 forum module project
Apache License 2.0
168 stars 59 forks source link

Inherited User Identity #71

Closed pavlm closed 7 years ago

pavlm commented 7 years ago

Hello, nice extension. I have some troubles configuring forum. As i see, there are two config scenarios: standalone forum users, and forum connected to app users. I need to use third scenario - when app and forum is loosely coupled, when app and forum have their own user tables and rbac tables, but app logged user also logged in to a forum. Is it possible out of box?

bizley commented 7 years ago

In case of inherited user identity Podium only relies on fact that user is logged in and in one case it checks user's password so it basically does nothing with user original table and the whole Podium data is stored in Podium tables anyway. What exactly is the case you are looking for?

pavlm commented 7 years ago

I've tried two variants of advanced config: 1st config: 'userComponent' => 'user' In this case forum uses app user and app rbac settings. But i wanted separate rbac's for app and forum. In my case application rbac doesn't contain 'podiumAdmin' role, so there is no admin access (http 403 error).

2nd config:

            'userComponent' => [
                'class' => 'bizley\podium\web\User',
                'identityClass' => 'app\models\User',
            ],

In this case separate rbac used - its ok. But Podium automatically creates linked user, what is not needed in my case. I wanted to control forum user creation from the application, we have many users and not all of them will be on the forum. So i need to turn off auto registration in Podium.

Sorry for confused description.

bizley commented 7 years ago

In case of configuration like 'userComponent' => 'user' RBAC component is not automatically inherited as well - you need to add 'rbacComponent' => 'authManager' (or similar) to inherit it. At least it should work like that, please let me know if it's not the case.
Anyway, in that case RBAC should be separated from main app.

Every userComponent setting other than default true ends with inherited identity linked to Podium tables - otherwise Podium can not gain control over forum member data (at least without some special tables mapping).

Please check again your 1st config and let me know if there are problems with it because this config looks like case you are after.

pavlm commented 7 years ago

More info about 1st config (without additional 'rbacComponent' configuration):

So it depends on type of access check.

bizley commented 7 years ago

Oh my... You are right. This is bug and will be fixed in 0.6. Thanks for pointing that.

pavlm commented 7 years ago

Ok, thanx. What about optional user auto registration?

bizley commented 7 years ago

Should it be something like:

How does it look?

pavlm commented 7 years ago

I think it can be a config settings:

Application will be responsible to register forum users by request. App will use internal Podium objects like RBAC and user model. Also enableAutoRegistration flag can hide links to 'account/login'

bizley commented 7 years ago

I could go for the following scenario:

Podium account is created automatically only in case this parameter returns true.
I prefer to keep Podium-only fields to be editable from within Podium. Making them read-only is weird (why?) and allowing them to be edited from outside is difficult.

With options like that application says who can get account at Podium and from this point the rest is the same - Podium creates linked account, register and log in links are hidden.

pavlm commented 7 years ago

It will be nice. Read-only profile needed for unified user profile. When user changes his application profile, then changes will be propagated to his forum profile (by application). But this task is not very important and can be achieved with application means.

bizley commented 7 years ago

Two new parameters in 0.6:

accessChecker should return one of integers:

In case on no access custom denyCallback can be set otherwise Podium redirects to the target URL of goHome() method.

pavlm commented 7 years ago

Thank you.

bizley commented 7 years ago

I keep this open untill 0.6.

bizley commented 7 years ago

Released with 0.6