-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I hope to help a look #95
Comments
How do you add it and how do you check?
… On May 24, 2017, at 8:48 AM, Mr. Zhang, ***@***.***> wrote:
Ask a question, why I created a permissions useradd, but this access is not assigned to the admin user, but still returns true when use the check method
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub <#95>, or mute the thread <https://github.com/notifications/unsubscribe-auth/ABVjW28hcmDqnKnusJSERpjJz1bPODHoks5r9FFqgaJpZM4NlTsS>.
|
$perm_descriptions = array( $rbac->Permissions->addPath('/delete_users/edit_users/view_users', $perm_descriptions); Hello, abiusx, I use the add method or addpath method to perform add, the check method is used to check, thank you very much for your help me. |
Hello,
User 1 is root, root is by default connected to root role and root permission, and thus has access to everything.
… On May 24, 2017, at 7:36 PM, Mr. Zhang, ***@***.***> wrote:
$perm_descriptions = array(
'Can delete users',
'Can edit user profiles',
'Can view users'
);
$rbac->Permissions->addPath('/delete_users/edit_users/view_users', $perm_descriptions);
//$rbac->Permissions->add('delete_users','this is test');
var_dump($rbac->check('delete_users',1));
Hello, abiusx, I use the add method or addpath method to perform add, the check method is used to check, thank you very much for your help me.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub <#95 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/ABVjWyuPT30LwK01ZDGM-DiEMWTh7C6Lks5r9OkhgaJpZM4NlTsS>.
|
Hello, thank you for your answer, but the problem is not here.After creating the root user, and I created a few users, but did not assign any role or permissions, why this a few users call check method still shows true |
Please post the code you use, or the structure of the database so that I can help.
-A
… On May 26, 2017, at 1:02 AM, Mr. Zhang, ***@***.***> wrote:
Hello, thank you for your answer, but the problem is not here.After creating the root user, and I created a few users, but did not assign any role or permissions, why this a few users call check method still shows true
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub <#95 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/ABVjW2BBABIQN1Yomy5nhmiT5_4BtRVUks5r9ocggaJpZM4NlTsS>.
|
thank you. use PhpRbac\Rbac; $rbac = new Rbac(); Add the add the save the update delete permissions$rbac->Permissions->add('add', 'add test'); // id = 2 Add two roles$rbac->Roles->add('root', 'is root'); // id = 2 Permissions binding role when the authorization ID for 2 add permissions binding the role ID is 2$rbac->Roles->assign(2, 2); Permissions binding role when the authorization ID for 3 add permissions binding the role ID is 3$rbac->Roles->assign(3, 3); The above operation, my understanding is that the root characters can only use the add, admin can only use the saveThe user root, 1 binding role account access only to the add user id is 1$rbac->Users->assign(2, 1); 2 binding role admin user, id for 2 only save user permissions$rbac->Users->assign(3, 2); #After performing var_dump($rbac->check('add', 1)); // true |
`/* Source Server : localhost Target Server Type : MySQL Date: 05/27/2017 11:20:54 AM SET NAMES utf8; -- Table structure for DROP TABLE IF EXISTS -- Records of BEGIN; -- Table structure for DROP TABLE IF EXISTS -- Records of BEGIN; -- Table structure for DROP TABLE IF EXISTS -- Records of BEGIN; -- Table structure for DROP TABLE IF EXISTS -- Records of BEGIN; SET FOREIGN_KEY_CHECKS = 1; |
I submitted the PHP code above and export SQL table, hope can help me solve this confusion.Once assigned the role, the user will hold all permissions.This is not what I need. |
I see.
You should not change the default valeus in the database, the system "requires" that a root role and a root permission exist, and be assigned to each other. These have to have ID 1.
If you delete them, then nothing will work properly.
Please restore the table structure to the original, and then test your code to see if it still fails or not.
Regards
-A
… On May 26, 2017, at 8:22 PM, Mr. Zhang, ***@***.***> wrote:
I submitted the PHP code above and export SQL table, hope can help me solve this confusion.Once assigned the role, the user will hold all permissions.This is not what I need.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub <#95 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/ABVjW4acJNbCTj6RKNZaHvkQEJ7nk5Q-ks5r95cDgaJpZM4NlTsS>.
|
Ask a question, why I created a permissions useradd, but this access is not assigned to the admin user, but still returns true when use the check method
The text was updated successfully, but these errors were encountered: