-
Notifications
You must be signed in to change notification settings - Fork 5
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
Add view helpers #22
Comments
makes sense, but why |
Honestly, just not to confuse with calling the policy directly. Especially since the API will be different. I'd prefer |
Another question: how would we handle custom policies? When We can add an optional parameter in the end that allows the policy to be specified. Basically all the options supported by the plug would be sent there. Another would be to do |
This is very weak api design, in my opinion. If you're reaching for synonyms just to avoid confusion, then you're just causing a different kind of confusion, because people know have to remember a different name, for no clear reason In this case in particular, since one is a view helper, and the other is a policy function, I don't really see a problem with them having the same name. The benefit of Elixir vs Ruby in these situations is that you don't have to worry about naming conflicts
This one is tricky. Forcing a parameters on every call seems to cumbersome, in my opinion. How about if instead we plug that metadata into each resource module?
This would be a big shift from the current API, but also seems to make sense along with the other graphql/liveview discussions |
Yeah, I agree, but it's mostly because the API would be different. Don't you think that could cause confusion? Same function, completely different parameters?
That one I strongly disagree, for two reasons:
At most we could use something like decorators but it doesn't work as well when you're not doing inheritance, does it?
I actually think that passing that metadata to the |
I think I have room somewhere for some metadata, so feel free to pass me some. Also, it's a little unclear to me: do I have the permission or not? |
I just hope you chose that username on purpose for these moments. because if so, you now have my full respect 😄 |
I don't think it would, no. I might be being naive, though. But it feels much more intuitive to me to use the same name, even with a different API, than having to use two synonyms, and having to remember which one goes where. Either way, these are my 0.02$. Do as you feel its better 🖖
Not exactly. The Also, besides that, I'm out of good ideas
I don't think you understood my point here. In a |
I'm down with I'm still against making the resource aware of policies, I think you're threading a dangerous line when it comes to responsibilities. Ah, you're saying when checking a |
yes. once you start checking permissions on views, you no longer have a 1-to-1 relationship between views and policies What you do have is a 1-1 relationship between resources and policies (or at least, mostly. you could argue that it would be useful to have multiple policies depending on the context) If we're not going with that, the only other sensible options I see are:
|
Sometimes we want to conditionally render elements based on the user having permissions or not. We should implement this somehow.
A basic idea:
Any thoughts on this?
The text was updated successfully, but these errors were encountered: