mercredi 23 septembre 2015

Should I use Entrust roles-permissions package?

I have integrated the Entrust package into my laravel app without a glitch, however I have some questions on how to make it work with my other tables.

So in the community app I'm creating, a user can create many categories or forums and add his own moderators. So far Entrust is adding the user_id, role_id and permission_id into the database without a glitch but it does not take into consideration the forums or posts the user has created.

So for a example a user creates a new forum, Entrust then will attachRole to the user and attachPermission to the role which works great but that has no rule over the forums or the posts table. Meaning I cannot use Entrust to tell it that if this forum or post belong to the user, allow him to edit. Because no 'forum_id' or 'post_id' exists in the 'role_user' or 'permission_user' table.

So how does that work? Do I modify Entrust's migration file to add my desired db fields or is it considered a bad practice to edit a package like that?

Do I even need this roles and permissions package when all I have are 3 forms on the entire app? Should I just do the permissions manually like if ($user->id == $post->user->id)?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire