It is possible to create an authorization web service. This could be a BAAS, or created in some other manner. This web service would return the users roles based on the user ID, and other important information concerning the current application, such as the property value. This pattern is a suitable fit as user set results are appropriate and the authorization might be needed by other applications as well.
A Blueriq function can be created which handles the authorization question. This function is then distributed across Blueriq applications. This pattern is suitable as user-set results are a good fit, as well as likely simple parameters suffice. The high reusability of this pattern allows us to easily check whether a user has permission in different applications or contexts.
The derivation whether a user has a certain role within the given context can be implemented using an external rule. It would either derive a boolean attribute which indicates that the user is allowed a certain action or not, or derive a set of roles of a multivalues string attribute. The decision what a user is allowed to do, is taken in code. The code has to read the appropriate attribute values from the domain to come to its decision.
A separate user authorization module can be created which is distributed as library across projects. In it is a domain with authorization rules, and a flow which takes the decision. You might not even need the flow if everything is handled by the rule engine. The calling application has to make sure to fill the appropriate attributes with values when calling the flow, or when the authorization is needed. The support of dependencies and the decision requirements graph make this pattern interesting.
The preferred pattern for this problem is Decoupling Pattern 5: Function. It has the knowledge characteristics required for this problem, namely that values are user set and support for parameters, so that the same authorization function can easily be used in different applications/contexts with a different domain. The high reusability and testability make the implementation of this mechanism simple.
Decoupling Pattern 2: Webservice call is also a suitable pattern but it is more complex to implement due to the data mappings, and the reusability of these data mappings can be a problem in this example. Furthermore, in this example the authorization is likely only used internally, and the focus of a web service lies on external consumers.
The advantages which Decoupling Pattern 6: External Rule and Decoupling Pattern 1: Module with Flow have in terms of integration with the rule engine are not utilized in this example. An authorization is usually only done when loggin in or when opening a case. The inference mechanism is then simply not needed. As these patterns score low on maintainability characterstics, the other patterns are preferable.