Permissions: read-write in a workflow context, read-only otherwise

Permissions: read-write in a workflow context, read-only otherwise

book

Article ID: KB0075866

calendar_today

Updated On:

Products Versions
TIBCO EBX All supported versions.

Description

In this article we will show you how to define dynamic permissions depending on whether we are in a workflow context or not.

In order to achieve this, we will have to implement a programmatic rule AccessRule that we will apply on the concerned node(s) in a data model extension SchemaExtensions.

Please see reference section.

Issue/Introduction

Permissions: read-write in a workflow context, read-only otherwise

Resolution

Example


I want my "Products" table to be updatable in a workflow context only.

SchemaExtensions implementation

mySchemaExtensions.java
public void defineExtensions(SchemaExtensionsContext context) {
         
        final AccessRule accessRuleOnProducts = new AccessRuleOnProducts();
        context.setAccessRuleOnNode(Path.parse("/root/products"), accessRuleOnProducts);
 
    }

https://docs.tibco.com/pub/ebx/5.9.8/doc/html/en/Java_API/com/orchestranetworks/schema/SchemaExtensionsContext.html#setAccessRuleOnNode-com.orchestranetworks.schema.Path-com.orchestranetworks.service.AccessRule-

AccessRule implementation

AccessRuleOnProducts.java
public AccessPermission getPermission(Adaptation record, Session session, SchemaNode node) {
         
        if (session.isInWorkflowInteraction(true)) 
            return AccessPermission.getReadWrite();
         
        else
            return AccessPermission.getReadOnly();
 
}

Additional Information

https://docs.tibco.com/pub/ebx/5.9.8/doc/html/en/Java_API/com/orchestranetworks/schema/SchemaExtensions.html
https://docs.tibco.com/pub/ebx/5.9.8/doc/html/en/Java_API/com/orchestranetworks/service/AccessRule.html
https://docs.tibco.com/pub/ebx/5.9.8/doc/html/en/Java_API/com/orchestranetworks/service/Session.html#isInWorkflowInteraction-boolean-