How To Add Permission To Edit Only One Record In Own Plugin
I have own plugin where I store pubs and I want to allow pub owners to manage their site. I have no idea how to do it. How to show for specific backend user only his record?
You have two options.
You can add a
owner_id) column to the
pubstable. That would mean every pub belongs to a user. You would also have to add a way to define admin users. Most simple solution would be to ad
userstable. The next simplest solution is to have a
usersand one of the roles would be "admin" (or a number that represents "admin"). Then you would use some nice application code to make all this work.
You can make a
user_pubtable that would act as a link table that allows a many-to-many relationship between
pubs. And you would have to make sure (in app code) that non-admin users don't have links to multiple pubs.
Option 2 is more flexible but if you don't need that much flexibility (now or in the future) option 1 is simpler.
- → "failed to open stream" error when executing "migrate:make"
- → October CMS Plugin Routes.php not registering
- → OctoberCMS Migrate Table
- → OctoberCMS Rain User plugin not working or redirecting
- → October CMS Custom Mail Layout
- → October CMS - How to correctly route
- → October CMS - Conditionally Load a Different Page
- → Make a Laravel collection into angular array (octobercms)
- → In OctoberCMS how do you find the hint path?
- → How to register middlewares in OctoberCMS plugin?
- → Validating fileupload(image Dimensions) in Backend Octobercms
- → OctoberCMS Fileupload completely destroys my backend
- → How do I call the value from another backed page form and use it on a component in OctoberCms