0

I've only started using in Sentry Laravel 4 and I'm not sure where I should be writing my Group permissions. I've gone through the Sentry docs but the explanation seems a bit vague. Are there any Sentry users who can point me in the right direction?

Gustavo Straube
  • 3,744
  • 6
  • 39
  • 62
ally
  • 51
  • 2
  • 11
  • Found this doc. Hope this helps. https://github.com/cartalyst/sentry/blob/master/docs/permissions/index.md – chintan Jun 01 '13 at 12:42
  • I've gone through the Sentry docs but I'm wondering if the "user.delete, etc." is a method? And where should I put those permissions, in the tables of users and groups or in the "config/config.php" of Sentry bundle? And what would be the display of permissions per Users and Groups in the Views? – ally Jun 02 '13 at 01:16

3 Answers3

0

I'm still figuring out Sentry permissions myself, but hopefully this reply helps get you on the right track. I'm also hoping that I'm on the right track! :)

The following is an (apparently) unstated fact that had me confused the longest. Once I realized this, the rest started to make sense:

Sentry does not maintain, or even require, a pre-defined list of permissions.

The permissions field in the groups and users tables will take whatever permissions keys you give it. Sentry doesn't check to ensure these keys are legitimate when they're saved. It's just a text field.

If you want/need a definitive list of manageable permissions, one option would be to create your own permissions table in the database.

Managing this permissions table would likely also require creating your own models and admin views as this would still be separate from Sentry. As for applying permissions to groups and users, you could then use this table to populate a selectable permissions list on your "create/edit user" and "create/edit groups" pages.

cmallard
  • 151
  • 6
0

As i have seen the Sentry config file i found some ideas as how to use permissions. You need to define the permissions in the sentry/config/sentry.php file. Here is simple demonstration.

'rules' => array(
    /**
     * config samples.
     *
     *  'application::admin@dashboard',
     *  'user::admin@create',
     *  'user::admin@read',
     *  'blog::admin@delete',
     *  'my_custom_rule',
     *  'is_admin',
     */
    'is_admin',
    'superuser',
    'can_edit',
    'can_delete'
)

I added can_edit and can_delete permission and it is now working.

Muhammad Raheel
  • 19,823
  • 7
  • 67
  • 103
0

There is a decent Laravel starter with Sentry2 , it helped me explain how it works by checking out how it was implemented. Check l4 with sentry here.

It seems plenty of people struggle with the permission part of sentry, including myself. Also, check out this SO thread, it looks like it is a duplicate of this question, there is more info on that one as well.

Community
  • 1
  • 1
Glenn Plas
  • 1,608
  • 15
  • 17