Skip to content
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

How to set permissions to several database entries? #86

Open
g-giani opened this issue Jun 29, 2016 · 4 comments
Open

How to set permissions to several database entries? #86

g-giani opened this issue Jun 29, 2016 · 4 comments

Comments

@g-giani
Copy link

g-giani commented Jun 29, 2016

Hi AbiusX,

I have a database with over 15.000 products. Some of these products are maintained by different agencies. If I got it right, I have do create a permission for every of my 15.000 products, to check if a user with id $user_id is allowed to edit a product with the id $product_id? Because when I do a check like

$rbac->check('edit_product_' . $product_id, $user_id);

and there is no permission 'edit_product_1234' (for example), the script breaks with an exeption:

throw new RbacPermissionNotFoundException ( "The permission '{$Permission}' not found." );

In this case, your class should return, that the user has no permission to edit this product. So it wouldn't be necessary to create a permission for every product.

@abiusx
Copy link
Contributor

abiusx commented Jun 29, 2016

Hello,
I believe in my local version that is done. For now, you can use a try-catch block.
Plus, if you have a hierarchy for products, you don’t need to add every single one to the system.

On Jun 29, 2016, at 9:45 AM, g-giani [email protected] wrote:

Hi AbiusX,

I have a database with over 15.000 products. Some of these products are maintained by different agencies. If I got it right, I have do create a permission for every of my 15.000 products, to check if a user with id $user_id is allowed to edit a product with the id $product_id? Because when I do a check like

$rbac->check('edit_product_' . $product_id, $user_id);

and there is no permission 'edit_product_1234' (for example), the script breaks with an exeption:

throw new RbacPermissionNotFoundException ( "The permission '{$Permission}' not found." );

In this case, your class should return, that the user has no permission to edit this product. So it wouldn't be necessary to create a permission for every product.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub #86, or mute the thread https://github.com/notifications/unsubscribe/ABVjW4vWRyrPMuwnS4elpPbLNs8Uq81kks5qQnbngaJpZM4JBJdj.

@g-giani
Copy link
Author

g-giani commented Jun 29, 2016

Ok, thx so far. In this case, I don't get it right. How do I implement this hierarchy? For example
products 23,45,657 should be able to be maintained by agency A, products 3,56,784 should be able to be maintained by agency B etc. All other products should be maintained only by users with an editor-role...

@abiusx
Copy link
Contributor

abiusx commented Jun 29, 2016

The hierarchy of products should have nothing to do with the users that can access them. Separation of concepts is of key importance.
For example, if you have products made of wood vs products made of wool, you can categorize each under one group.
For more help you need to tell us more about your system.

On Jun 29, 2016, at 10:12 AM, g-giani [email protected] wrote:

Ok, thx so far. In this case, I don't get it right. How do I implement this hierarchy? For example
products 23,45,657 should be able to be maintained by agency A, products 3,56,784 should be able to be maintained by agency B etc. All other products should be maintained only by users with an editor-role...


You are receiving this because you commented.
Reply to this email directly, view it on GitHub #86 (comment), or mute the thread https://github.com/notifications/unsubscribe/ABVjW_bVtd3y6mgaJo6T_Cul7SGbN2hKks5qQn1RgaJpZM4JBJdj.

@mjwlking
Copy link

I also encountered a similar problem. After checking, it was found that there was an error in setup.php.
If(jf::$Db->connect_errno==1049) should be if(jf::$Db->connect_errno!==1049).
Modify it on it.

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

No branches or pull requests

3 participants