yii2-podium
yii2-podium copied to clipboard
Forbidden (#403) for Administration
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.
Try to flush the cache.
Still Forbidden...
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).
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" anduser_id
= 1 -
podium_user
id
= 1 andinherited_id
= "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".
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.
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?
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.
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.
Yii::$app->user->id
showed "elkrari".
I removed cache files related to Podium but nothing changed.
See this issue #115 Maybe user access rights is getting wrong.