githubjeka / gui-rbac-yii2

GUI for RBAC Yii2 Auth manager
https://basic-rbac-githubjeka.c9.io/basic/web/index.php?r=rbac
84 stars 38 forks source link

Rbac test error #4

Closed dbd5 closed 9 years ago

dbd5 commented 9 years ago

Hello,

I am getting this "Call to a member function getRules() on a non-object" when I go to http://admin.app.dev/rbac

Please have a look at my screen and advice what I could be doing wrong, I believe I have followed the instructions you provided.

Regards,

Adam

screen shot 2015-05-07 at 10 02 24 pm

githubjeka commented 9 years ago

Hello, you not connected authManager.

I think it is logical, if you are using RBAC :hatched_chick:

dbd5 commented 9 years ago

Thanks - my fault, I've taken care of that, now the form is open but it doesn't save. This is the procedure I've followed;

  1. Type in Role
  2. Type in Description
  3. Click save button

Any suggestion what could be wrong?

The structure of the RBAC tables are standard but its possible other extensions have modified the User table. Currently it is;

CREATE TABLE user ( id INT(11) NOT NULL AUTO_INCREMENT, username VARCHAR(25) NOT NULL COLLATE 'utf8_unicode_ci', email VARCHAR(255) NOT NULL COLLATE 'utf8_unicode_ci', password_hash VARCHAR(60) NOT NULL COLLATE 'utf8_unicode_ci', auth_key VARCHAR(32) NOT NULL COLLATE 'utf8_unicode_ci', confirmed_at INT(11) NULL DEFAULT NULL, unconfirmed_email VARCHAR(255) NULL DEFAULT NULL COLLATE 'utf8_unicode_ci', blocked_at INT(11) NULL DEFAULT NULL, registration_ip VARCHAR(45) NULL DEFAULT NULL COLLATE 'utf8_unicode_ci', created_at INT(11) NOT NULL, updated_at INT(11) NOT NULL, status SMALLINT(6) NOT NULL DEFAULT '10', flags INT(11) NOT NULL DEFAULT '0', PRIMARY KEY (id), UNIQUE INDEX user_unique_username (username), UNIQUE INDEX user_unique_email (email) ) COLLATE='utf8_unicode_ci' ENGINE=InnoDB AUTO_INCREMENT=2 ;

Regards,

Adam

githubjeka commented 9 years ago

Table user doesn't participate.

Can you show authManager config ?

dbd5 commented 9 years ago

Sure, here's a section of my /common/config/main.php; authManager is at the very end

screen shot 2015-05-08 at 11 17 01 am

githubjeka commented 9 years ago

Show me logs from debug tools when you clicked save in browser

githubjeka commented 9 years ago

Name of Role is should be typed

dbd5 commented 9 years ago

Screen

screen shot 2015-05-08 at 12 57 20 pm

Logs;

screen shot 2015-05-08 at 12 56 01 pm

githubjeka commented 9 years ago

Has errors in console browser?

dbd5 commented 9 years ago

Not really, I don't see any errors at all. I'm totally surprised -- nothing happens when I click save.

But there's an error when I inspect element, The form is "A form to create-update-delete roles and permissions", see screenshot below;

screen shot 2015-05-08 at 1 45 17 pm

githubjeka commented 9 years ago

Need more information about this error. Line? File?

dbd5 commented 9 years ago

Oh, it's no special file.

When you asked if there were errors on the console or browser, I did the following:

Then I saw that error.

Its the standard extension files. I have made no changes at all

githubjeka commented 9 years ago

Here it does not appear. https://basic-rbac-githubjeka.c9.io/basic/web/index.php?r=rbac

Need the name of the file where the error occurs.

image

dbd5 commented 9 years ago

App.js - see screenshot below screen shot 2015-05-09 at 3 11 26 pm

githubjeka commented 9 years ago

Please, open your rbac-gui page and enter json in console. You should get. image

P.S Do you work in Safari browser?

githubjeka commented 9 years ago

JSON.parse throws a SyntaxError exception if the string to parse is not valid JSON. Please check what return from /index.php?r=rbac/default/items url. Perhaps you have an php error .

dbd5 commented 9 years ago

The output is {"nodes":[],"links":[]}

githubjeka commented 9 years ago

Ok.

Add 'enableCsrfValidation'=>false, to your global config:

//...
'components' => [
        'request' => [
            // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
            'cookieValidationKey' => '6oLSyFbXRvg8',
            'enableCsrfValidation'=>false,
        ],
//...

And run in console :

curl --data "ItemForm%5Btype%5D=1&ItemForm%5BoldName%5D=&ItemForm%5Bname%5D=Users&ItemForm%5Bdescription%5D=Registered+users&ItemForm%5BruleName%5D=&ItemForm%5Bdata%5D=" https://YOUR_HOST/index.php?r=rbac/default/save-item

# should get {"oldName":"","name":"Users","type":"1","description":"Registered users","ruleName":null,"data":null}

Reload rbac-gui page and you should see your Role Users

dbd5 commented 9 years ago

I've made the changes to the global config but I'm not sure how to run the curl command, it's a DLL. I'm using Windows/XAMPP environment.

Regarding, "Reload rbac-gui page and you should see your Role Users"

It appears you are not clear with my situation, let me recap;

The definition of the problem is that I cannot add Roles to the system even though everything seems normal, I ran into this issue at the point where I want to add Roles etc

Thanks for your support and patience in this matter

githubjeka commented 9 years ago

When you click Save that sent POST data to index.php?r=rbac/default/save-item and returned model as string(json format). If you have JSON.parse SyntaxError exception then the string to parse is not valid JSON. Respectively you have php error instead model.

In my last commnet, I want you post data to index.php?r=rbac/default/save-item and show me the error.

dbd5 commented 9 years ago

Hi Evgeniy,

I guess we can close this if it can't be independently verified

Adam