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

Use fact as params input to another fact? #308

Open
robross0606 opened this issue Aug 4, 2022 · 3 comments
Open

Use fact as params input to another fact? #308

robross0606 opened this issue Aug 4, 2022 · 3 comments
Milestone

Comments

@robross0606
Copy link

robross0606 commented Aug 4, 2022

I've looked across the documentation, examples and existing issues and, if this has been previously discussed, I'm missing it. Is it possible to use one or more Fact as params input to another fact?

This is a little domain specific but, for example, if I have a fact that gets a "section" related to another object (via params) and then another fact that verifies "section" access control, can I do something like this as a fact?

        {
          // Has permission to section?
          fact: 'has-permission',
          params: {
            fact: 'related-section',
            params: {
              id: 'xyz123'
            }
          },
          operator: 'equal',
          value: true
        }
@robross0606
Copy link
Author

I could do this right now by creating another new bespoke 'has-related-section-permission` fact which depends on 'related-section' from the almanac and then checks permissions. But this is is not ideal because it doesn't promote fully decomposing and reusing Facts on Rules.

@chris-pardy chris-pardy added this to the version 7 milestone Aug 25, 2023
@chris-pardy
Copy link
Collaborator

@robross0606 one of the soon things on my wishlist is the ability to add a custom alamanc that would let you add functionality to as deeply as you would like do this.

@robross0606
Copy link
Author

I see that you have this flagged for version 7, but I also see that 6.5.0 introduced the "custom almanac".

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

No branches or pull requests

2 participants