-
Notifications
You must be signed in to change notification settings - Fork 34
Custom declarative condition Fns #45
Comments
Looks Good to me, can you please send the pull request for the same? |
I'll look into it asap. |
#49 |
https://github.com/tensult/role-acl/blob/develop/test/acl.spec.ts#L886 |
@koladilip I was about to inform you that I'm done with my urgent work and can finally take a look at the feature implementation. You were quicker though :) I went through test cases and I had a very quick look on the implementation. The only difference I see is that your interface is more forgiving (not that strict) and you've implemented the registration as a fluent interface instead as batch which I think is perfectly OK :) What I don't see as test cases is what happens if a custom condition is missing registration but used in the grants - handled/unhandled error, deny or grant (I don't believe you've went with that one). Thanks for the implementation, it really brings the library to the next level. Let me know if I can be of any help (add this feature to the docs maybe?) P.S. I don't understand the request in #49 neither. I'm dynamically building the context, so I can think of 1000s ways of building and validating the desired context. It's a matter of implementation and not a library feature. |
I'm exploring the possibility to implement the
role-acl
lib in a project. I'm injecting it in my own ACL abstraction and everything looks good so far.However, what I'm missing is an option to declare and register a custom condition Fn as a string and map it to a function. This way I'd be able to wrap more complex business logic and still to serialize and store the grant object.
I see there is custom functions support, which is an option to pre-process the definition and replace a custom condition string with JS function so that library process it, but a native library support would be much better. Not to mention it would open contribution possibilities (I can imagine a
MONGODB_QUERY
condition...)Here is sample API of what I have on my mind:
Signature
condition.gte.ts
acl.ts
Usage (grant definition)
The text was updated successfully, but these errors were encountered: