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

Idea: Use singular for entity permissions #12

Closed
franzliedke opened this issue Nov 27, 2014 · 4 comments
Closed

Idea: Use singular for entity permissions #12

franzliedke opened this issue Nov 27, 2014 · 4 comments

Comments

@franzliedke
Copy link

E.g. ->can('read', 'post', 8) instead of ->can('read', 'posts', 8).

Or is that just overkill?

@driesvints
Copy link
Contributor

You can actually just use whatever you want. You choose the resource type. Whether that's singular or plural, that's totally up to you. 

Imo it makes more sense to use plural. Edit many posts with an optional identifier for a specific post. That's why I use that example in the docs.

Perhaps I should clarify better in the docs that you can use any string you want as a resource identifier?


Dries Vints

Lead Developer at BeatSwitch / beatswitch.com

Laravel.IO Manager / laravel.io

On Thu, Nov 27, 2014 at 12:28 PM, Franz Liedke notifications@github.com
wrote:

E.g. ->can('read', 'post', 8) instead of ->can('read', 'posts', 8).

Or is that just overkill?

Reply to this email directly or view it on GitHub:
#12

@franzliedke
Copy link
Author

What I meant was this: Both can('read', 'post', 8) and can('read', 'posts') should come down to the same resource called "posts".

@driesvints
Copy link
Contributor

Hmm, I see what you mean. I'm not sure if I want to go there.

You see, a resource type is part of the contract you define when passing resources to the Acl instance. I'd rather just handle a specific one then "guess" which one I should pick based on the input. I think it's best that you just define the type one single type and stick to that. I honestly don't see the reasoning why you should ever want 2 types for 1 resource type.

@franzliedke
Copy link
Author

Yeah, it's not that important. Just thought this would make it even more readable. ;)

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

No branches or pull requests

2 participants