How to Hide Create Record button on dataset for a particular User Profile/Role

How to Hide Create Record button on dataset for a particular User Profile/Role

book

Article ID: KB0072592

calendar_today

Updated On:

Products Versions
TIBCO EBX All versions from 5.8.0.

Description

In certain cases, we need to hide the create permission for a particular role on DataSets, But we do want to have the create permission for that profile(In case we need to add record specifically via Workflow only). In this scenario, the profile should have the create record permission but the create button should be hidden only for specific roles.

Issue/Introduction

Hide create permission via Programmatic permissions on dataset built-in services

Environment

All

Resolution

 So to achieve the above scenario, we need to follow the below procedure.
1. Implement SchemaExtensions.
https://docs.tibco.com/pub/ebx/5.9.10/doc/html/en/Java_API/com/orchestranetworks/schema/SchemaExtensions.html
2. Now in the method "defineExtensions" we need to utilize the API setServicePermissionRuleOnNode with help of the context variable which is there in the argument of the method defineExtensions.
https://docs.tibco.com/pub/ebx/6.0.3/doc/html/en/Java_API/com/orchestranetworks/schema/SchemaExtensionsContext.html#setServicePermissionRuleOnNode-com.orchestranetworks.schema.Path-com.orchestranetworks.service.ServiceKey-com.orchestranetworks.userservice.permission.ServicePermissionRule-
3. Nowhere the API mentioned in step 2 has three arguments, 
    a. Path aPathInSchema: Here we can specify the path of the table on which we need to achieve the mentioned scenario.
    b. ServiceKey aServiceKey: Here we can have, permission-based upon the scenario, the possible value are: ALWAYS_DISABLEDALWAYS_ENABLED and ENABLED_FOR_EXECUTION_ONLY
 https://docs.tibco.com/pub/ebx/5.9.10/doc/html/en/Java_API/com/orchestranetworks/userservice/permission/ServicePermissionRule.html
    c. ServicePermissionRule<? extends EntitySelection> aRule: For this, we need to define the rule, as we need to make this scenario based upon the role and not for all the profiles.
     For subPoint c, we again need to implement class ServicePermissionRule<TableViewEntitySelection>, and here inside the method getPermission we need to return the permission-based upon the profile either enable or disable.

Please find the attached sample code files with names: PermissionExtension.java and ServiceRuleImplementations.java

Additional Information

https://docs.tibco.com/pub/ebx/5.9.10/doc/html/en/Java_API/com/orchestranetworks/schema/SchemaExtensions.html
https://docs.tibco.com/pub/ebx/6.0.3/doc/html/en/Java_API/com/orchestranetworks/schema/SchemaExtensionsContext.html#setServicePermissionRuleOnNode-com.orchestranetworks.schema.Path-com.orchestranetworks.service.ServiceKey-com.orchestranetworks.userservice.permission.ServicePermissionRule-
https://docs.tibco.com/pub/ebx/5.9.10/doc/html/en/Java_API/com/orchestranetworks/userservice/permission/ServicePermissionRule.html

Attachments

How to Hide Create Record button on dataset for a particular User Profile/Role get_app
How to Hide Create Record button on dataset for a particular User Profile/Role get_app