Skip to content
This repository has been archived by the owner on Sep 19, 2023. It is now read-only.

Permission deny for master after migration #35

Open
zainiafzan opened this issue Apr 16, 2018 · 13 comments
Open

Permission deny for master after migration #35

zainiafzan opened this issue Apr 16, 2018 · 13 comments
Labels

Comments

@zainiafzan
Copy link

After installation and migration RBAC using this command
php yii rbac/scan -p='@vendor/justcoded/yii2-rbac/' -b='admin/rbac/'
Master have error cannot access dashboard..

Temporary fix is manually change params in
justcoded\yii2\rbac\commands\RbacController

line 22 and line 33.

@aprokopenko
Copy link
Contributor

Hi zainiafzan,

Did you assign master role to some user?

The line you mentioned scan only rbac module to allow access to permissions management.

@zainiafzan
Copy link
Author

zainiafzan commented Apr 16, 2018

no...its first master after installation.

imho, yii command didnt read params that i pass to it..
thats why i change it directly to the code..

@aprokopenko
Copy link
Contributor

I will check this assumption of course, but this line only scan permission controllers, not the main admin controllers, which should be scanned by default.

Could you access the dashboard index page?

@aprokopenko
Copy link
Contributor

(you should login to access admin pages, if you're not logged in - admin will show you 404 page)

@aprokopenko
Copy link
Contributor

Would be great if you can ping me in Skype: ab.prokopenko, it will be easier to communicate

@zainiafzan
Copy link
Author

yes i logged in, using master [email protected]

after manually change and run rbac again.. master can access dashboard.. and successfully scan other route using scan route permission...

@aprokopenko
Copy link
Contributor

aprokopenko commented Apr 16, 2018

More info from Zain:

Happens on:

  • Windows 10
  • PHP 7.0.10

Re-tested by me and was fine on:

  • Mac OSX / Ubuntu 16.04 servers
  • PHP 7.1

Maybe there is a problem with Windows paths or Windows PHP build

@aprokopenko
Copy link
Contributor

The bug is confirmed, Windows OS doesn't pass console command options to the controller correctly.
A research has shown that this is a core problem (yii core files doesn't have $params variable inside runAction()), so we can't do anything here.

@aprokopenko aprokopenko added bug and removed wontfix labels Apr 17, 2018
@aprokopenko
Copy link
Contributor

After further investigation Zain found out, that Windows do not parse command options correctly and leave quotes. That's why scan was not successful.

Project readme is updated to run command without quotes (it's good that we don't have spaces there).

@alejosv
Copy link

alejosv commented Aug 13, 2018

I have the same issue

$php -v
PHP 7.2.8-1+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Jul 25 2018 10:52:19) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.8-1+ubuntu18.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies
    with Xdebug v2.6.0, Copyright (c) 2002-2018, by Derick Rethans
$ mysql --version
mysql  Ver 15.1 Distrib 10.2.16-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2
$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.1 LTS
Release:	18.04
Codename:	bionic

imagen

@aprokopenko
Copy link
Contributor

It's not clear what URL you're trying to access from your screenshot.

Would be great to have also screens from running rbac commands (on fresh install):

php yii rbac/init
php yii rbac/assign-master 1
php yii rbac/scan
php yii rbac/scan --path=@vendor/justcoded/yii2-rbac/ --routesBase=admin/rbac/

I didn't test this on PHP 7.2 yet.

@aprokopenko aprokopenko reopened this Aug 13, 2018
@alejosv
Copy link

alejosv commented Aug 13, 2018

Ok, this is the issue, I run exactly those commands in the console. The first time, when I try acces I get the error 403, but when a run to second time the same commands the error disappear. Now I can access the URL localhost/admin/rbac/permissions . Is some kind weird.

@aprokopenko
Copy link
Contributor

Could you try to run full installation from scratch and make screenshots of a console where you launch rbac commands. It should print info about what's happening. The issue Zain had - permissions weren't imported in any command run. In your case it works for a second time. Maybe you forgot to run the last command?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants