yii2-podium icon indicating copy to clipboard operation
yii2-podium copied to clipboard

Forbidden (#403) for Administration

Open elkrari opened this issue 7 years ago • 11 comments

Hi! I don't have access to the forum settings (Administration) with my admin account. I a first time the "Administration" element in the navbar doesn't appear. I checked out a previous issue (N° 94) and corrected the user_id in podium_auth_assignment table. Now the "Administration" element appear but still don't have right access.

elkrari avatar Jun 11 '17 17:06 elkrari

Try to flush the cache.

bizley avatar Jun 11 '17 18:06 bizley

Still Forbidden...

elkrari avatar Jun 11 '17 19:06 elkrari

In your previous post configuration adminId is 1 - is it still the case? Can you tell me what are the values of following fields in your database:

  • podium_auth_assignment - itemName, user_id (assuming it's only one row),
  • podium_user - id, inherited_id (same here).

bizley avatar Jun 11 '17 19:06 bizley

It was just an example. Indeed, IDs in my user table are usernames (varchar(64)), so adminId is 'elkrari'. I already altered the table to change inherited_id type.

  • podium_auth_assignment itemName = "podiumAdmin" and user_id = 1
  • podium_user id = 1 and inherited_id = "elkrari"

elkrari avatar Jun 11 '17 19:06 elkrari

This is unusual. Now I'm not sure if Podium is prepared to handle non-numeric keys for users... BTW If your primary key for user table is varchar why have you set adminId as 1?

Anyway - try to set user_id in podium_auth_assignment to "elkrari".

bizley avatar Jun 11 '17 19:06 bizley

As I said earlier,

It was just an example. ... adminId is 'elkrari'.

Podium set in the beginning user_id in podium_auth_assignment to "elkrari" and I didn't work. even "Administration" element in the navbar doesn't appear until I changed it to 1. I did now another try and the element disappeared again (with the value "elkrari").

inherited_id in the User model has been changed to string and to VARCHAR in the database table.

elkrari avatar Jun 11 '17 19:06 elkrari

In your app when you call echo Yii::$app->user->id; (being logged as "elkrari") what do you get? Have you flushed the cache again after change?

bizley avatar Jun 11 '17 19:06 bizley

My primary key in the table is "login" not "id". I can't use the "flush cache" option because I don't have right access. I just cleaned my browser cache.

elkrari avatar Jun 11 '17 21:06 elkrari

echo Yii::$app->user->id; should work no matter what the primary key name is (if your User model is properly constructed). Browser cache is not enough. I can see in your config that you are using file cache so just remove cache files from runtime/cache folder.

bizley avatar Jun 12 '17 04:06 bizley

Yii::$app->user->id showed "elkrari". I removed cache files related to Podium but nothing changed.

elkrari avatar Jun 12 '17 18:06 elkrari

See this issue #115 Maybe user access rights is getting wrong.

eLFuvo avatar Jun 24 '17 15:06 eLFuvo