Add support for global context for placeholder replacements and Rules in general.

Comments

fago created an issue. See original summary.

fago’s picture

Status: Active » Needs review

Getting started with support in general first: https://github.com/fago/rules/pull/348
(Untested)

fago’s picture

This works with pre-existing global context in core, but it results in really ugly variable names:
@user.current_user_context:current_user

However, that's what core provides us with so improving that should probably be a core issue. :/

klausi’s picture

Status: Needs review » Needs work

Yes, that's ugly but I agree that this has to be good enough for now.

Now that #2648352: Implement an integrity check on configuration time has landed we also nee to add the global context in ExecutionMetadataState so that those variables are also available on config time.

fago’s picture

Status: Needs work » Needs review

true, updated.

fago’s picture

Status: Needs review » Fixed

merged

  • fago committed 37e85a7 on 8.x-3.x
    Issue #2650448 by fago: Add support for global context in the execution...
  • fago committed 5dd3327 on 8.x-3.x
    Issue #2650448 by fago: Add support for global context.
    
  • fago committed dbcc72c on 8.x-3.x
    Issue #2650448 by fago: Fix RulesIntegrationTestBase to work with global...
klausi’s picture

Status: Fixed » Needs work

I just found that ExecutionState::hasVariable() has not been updated for lazy loading the global context into variables.

fago’s picture

Status: Needs work » Needs review

good catch, fixed it here: https://github.com/fago/rules/pull/353

klausi’s picture

Status: Needs review » Reviewed & tested by the community

looks good!

fago’s picture

Status: Reviewed & tested by the community » Fixed

  • fago committed 39fa505 on 8.x-3.x
    Issue #2650448 by fago: Fix ExecutionState::hasVariable() to support...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.