Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

JoshWegener's avatar

Creating a security / roles / permissions package

Hello! I know this has been done before. But I had some new ideas on the subject and needed help with a few parts of this. I'm more then happy to do the coding or if you would like to help out, I will set it up on GitHub

Here is main issue I'm having, I understand having it setup with tables (user/roles/permissions - and pivot tables). but I'm having trouble figuring out a simple way to handle things like a forum.

So lets say you have many categories in your forum. Now each category has read / write / delete / comment.... Each category can have a sub-category, and each sub-category can have many posts... and each post can have a comment.

So lests say use A is trying to write a comment to a category he does not have access to (just via changing the forum inputs and URL - using restful) How can I check his rights? The roles / permissions I listed above is good for simple pages, like can this user edit other users or view all users... but It does not really work for permissions on different types of content. I want to be able to set say Role ABC can read category 1, 2, 5 can edit 2, 5 and then can only edit their own content on 5 BUT they can't post comments on category 5, nor can they edit comments in category 2......

My main goal here is create a nice elegant Laravel specific package that CAN handle all the above mentioned scenarios. Any help / comments would be great! This will also help me learn and maybe others as well!

Thanks!

@JeffreyWay, @SP1966, @pmall

0 likes
1 reply

Please or to participate in this conversation.