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

Using permissions table to store permissions of roles. #1

Open
dudzio12 opened this issue Aug 14, 2014 · 5 comments
Open

Using permissions table to store permissions of roles. #1

dudzio12 opened this issue Aug 14, 2014 · 5 comments

Comments

@dudzio12
Copy link

Hi!
Few people have problem with using permissions table to manage permissions on roles.
By default permissions table is using by User model, so in my opinion is a little bit overpowered, I mean - more often we need to set permissions for roles, not for users itself, so here it is what I've done to accomplished that:
http://laravel.io/bin/5WMxJ

With this we can easily manage users, roles and permissions from office backend.
Hope will be helpful for someone :)

@tortuetorche
Copy link

Hi @dudzio12,

Thank you for this contribution.

Do you really need to store the authorization rules in a database ?
Because you can directly write them in the config file.

Can you explain me a bit more your need of storing permissions in a database, please?

Cheers,
Tortue Torche

@dudzio12
Copy link
Author

I'm building ERP-kind system.
I've got Administrator user with role of "administrator".

For adminstrator role I've got in my "permissions" table:
"role_id" = 1(which is administrator);
"type" = "allow";
"action" = "menage";
"resource" = "all"

So I've build this with bin above.

Now for the final part:

I've got in backoffice of my app:
index, edit and delete actions of users and roles.
I can easily add roles(with permissions configurations) and users.

So basicly I can choose what groups of users are allow or deny to do some actions.
And everything in my backoffice and with user "menage, all" permission.

I think I explain it clearly. I suppose I can inserting into config file, but it would be more messy I think.

Thanks for your work! :)

@tortuetorche
Copy link

Thank you, now I understand your need.

Are you sure this line is useful ?
Because by default a user can do nothing.

Maybe I'll add your feature in the next minor version of Authority-Controller.
And I'll need to rewrite the migration files to follow your changes.

But I don't plan to do it yet.
I'm a bit busy with another Open source project: https://github.com/efficiently/larasset

Cheers,
Tortue Torche

@dudzio12
Copy link
Author

Looking good :)

Yes, in specific way - as I said I'm building ERP system.
So I need to block any action by default. So anyone can show clients or employees lists.
One of the first steps in system setup is to create roles, so by default it should be deny for all actions.
For any other apps, like forums or whatever, It should not be denied, so it's free to configure it for any need.

As I mentioned before, I found somewhere in Laravel forum thread about the same problem as I resolved, unfurtunatelly it is off now, so I just paste it here, if you think there is better place to paste it - feel free to use it.

Thanks for conversation :)

@tortuetorche
Copy link

Of course, You can post it here or create a new Wiki page here.

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

2 participants