Why Read Only?
When we develop an application, the end users query for information, edit, update and do a lot of other things. But we often face the requirement to restrict a set of users to a limited functionalities. Let’s say the user can only view the UI for verification or for an audit.
Think of a quote which can be created or updated by a sales team. There is also a service team which can merely verify an existing quote, he is not allowed to update the quote.
Assuming we have developed an application using OAF JDeveloper, we will see how we can make it read only for a responsibility so that we can assign it to a set of users.
Our Approach
- First, we will create a profile and set it to ‘Y’ for a responsibility which has only read only access.
- We will create a java class with a method to recursively change the render and read only properties of WebBeans.
- Will invoke the java class method from the process request of different controllers in the application.
Example
- Create a profile with ‘Y/N’ values.
Set it to ‘Y’ for the read only responsibility.
- Create a java class in the OAF application navigator.
Lets name it: CLQotRenderUtil.
We can use the code in the attached file for reference.
- Lets open the Controller in JDeveloper and paste the following code in the ProcessRequest.
String readonly_profile_value = paramOAPageContext.getProfile(“ASO_NEW_QUOTE_SECURITY”);
if (readonly_profile_value.equalsIgnoreCase(“Y”.toString()))
{
CLQotRenderUtil.setViewOnlyRecursive(paramOAPageContext, paramOAWebBean);
}
Now, if we open the page in the application using the readonly responsibility, the buttons, dropdowns, etc would not be appearing or appear readonly as per the coding in the util file. The util file is easy to understand, so we can edit it to meet our requirements. Also, please note that the profile we created can be set ‘Yes’ for any responsibility which we are planning to make read only.
ليست هناك تعليقات:
إرسال تعليق