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

Example of controller based permissions #35

Closed
grafikkaos opened this issue Oct 14, 2014 · 1 comment
Closed

Example of controller based permissions #35

grafikkaos opened this issue Oct 14, 2014 · 1 comment

Comments

@grafikkaos
Copy link

I hope I can get some help here...

I currently have the following permissions set for an admin role:

"\\App\\Modules\\Blog\\Controllers\\Admin\\BlogController@viewPosts":"1",
"\\App\\Modules\\Blog\\Controllers\\Admin\\BlogController@addPost":"1",
"\\App\\Modules\\Blog\\Controllers\\Admin\\BlogController@editPost":"1",
"\\App\\Modules\\Blog\\Controllers\\Admin\\BlogController@deletePost":"1",
"\\App\\Modules\\Members\\Controllers\\Admin\\GroupController@create":"1",
"\\App\\Modules\\Members\\Controllers\\Admin\\GroupController@edit":"1",
"\\App\\Modules\\Members\\Controllers\\Admin\\GroupController@delete":"1"

While I understand that a user assigned to that role will inherit the role's permissions if he doesnt have any set for him, I am struggling to get this to work properly.

In my filters file, I have the following code:

Route::filter('role.admin.perms', function($route, $request)
{
    $action = $route->getActionName();

    if (Sentinel::hasAccess(addslashes($action)))
    {
        return;
    }

    Session::flash('error', 'Permission denied.');
    return Redirect::route('admin.dashboard');
});

This unfortunately is not working for me. Am I missing something?

Regards

Emmanuel

@suwardany
Copy link
Contributor

@grafikkaos permissions must use booleans, change the ones to true and see if that helps.

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

No branches or pull requests

3 participants