-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Promise-ify built-in Role model #3146
Conversation
LGTM, As for isInRole
is there a similar PR for methods from ACL ? (resolvePrincipal, isMappedToRole) |
@ebarault thank you for chiming in!
Good point! I am reluctant to change the return type in the callback variant, I am concerned there may be applications/code relying on this incorrect behaviour. Let's fix it for the Promise variant only, I'll rework the commit shortly.
I don't think so. Would you mind submitting one yourself? |
fix the promise variant only : 👍 |
521e310
to
0fd8f8a
Compare
Note: I am intentionally not back-porting this patch to |
please see #3163 for the similar PR for built-in ACL model |
Are your proposing to change the default value of I am concerned that this may confuse users. So far, our APIs behave identically when invoked with a callback or when expecting a Promise to be returned. (With the exception of I feel the option @superkhau @raymondfeng @ritch thoughts? A lesser concern is about performance - to return role names, we have to query |
I'm +1 for consistency and less confusion with the current APIs. We should not diverge based on the promise variant IMO. |
having I get the performance issue: but it's by far not the bottleneck of role-resolving in loopback as of now (see [this discussion](5 hours ago) superkhau participated in) Anyhow, as this seemed a good moment with this PR just worked-out, i just wanted to bring the subject to your attention. I can totally live with the |
I agree this is inconsistent and confusing :( Because the time has not yet come for a new semver-major release of loopback, where we would be able to make this breaking change, I am proposing the following improvements:
Thoughts? (cc @raymondfeng @superkhau) @ebarault would you be interested in contributing these enhancements? |
I'm good with any of those solutions, but if I had to choose one, it would be the first solution as it sounds the simplest to implement. |
@bajtos: yes i can contribute the changes. were you proposing to select one of these options or all of them combined? I'm good with proposal 1 and 3. Introducing a new function would also bring confusion imo. The definite change could be endorsed on next lb major release. |
@ebarault excellent! The three options are sort of independent, feel free to implement only those that make most sense to you. |
Description
Add Promise support to
Role
methods.Related issues
Checklist
guide
@superkhau please review
cc @pierreclr @ebarault