Vipul Posted June 22, 2018 Report Share Posted June 22, 2018 Hello, Can someone help me that how to show hide div based on if Authentication user is =Customer then Display DIV Customer and Hide Div Employee and admin Else if Authentication user is=employee then Display Div Employee and hide Div Customer and admin Else Authentication user is=admin then display div Admin and hide Div Customer and Employee Quote Link to comment Share on other sites More sharing options...
GoCubbies Posted June 22, 2018 Report Share Posted June 22, 2018 Vipul, Just a recommendation from a security standpoint, but if there is content that only should be viewed by certain roles, I would strongly recommend building separate DataPages for each user. Hiding content using CSS is 'Security through Obscurity' and is not a recommended practice. A user could easily use the developer tool in the browser and expose the hidden content. Now, if you are just trying to guide users, and the content is not a security concern, you may want to look a using rules on a DataPage to hide sections. You could receive the role value into a virtual field, and use this field to control what action is taken. For example, build 3 sections on the DataPage, each section containing the appropriate information (Section 1 = Customer, Section 2 = Employee, Section 3=Admin). The virtual field would receive the authentication value on load. You could have 3 rules. Rule 1: When virtual1 is NOT EQUAL to Customer, hide Section 1 Rule 2: When virtual1 is NOT EQUAL to Employee, hide Section 2 Rule 3: When virtual1 is NOT EQUAL to Admin, hide Section 3 Here is an article that has more information on rules as well: https://howto.caspio.com/datapages/forms/conditional-forms/ Quote Link to comment Share on other sites More sharing options...
Vipul Posted June 27, 2018 Author Report Share Posted June 27, 2018 Hi @GoCubbies This will work fine with Forms but in Tabular Report we dont have either Virtual Field or way to define rules to show hide section... Quote Link to comment Share on other sites More sharing options...
MayMusic Posted June 27, 2018 Report Share Posted June 27, 2018 Are you trying to hide columns in a report based on user roles? If that is the case, I do not recommend you to do that. Create one Report page for each and redirect them based on user role to the corresponding DataPage. https://howto.caspio.com/tech-tips-and-articles/common-customizations/create-user-specific-redirect-after-login/ Quote Link to comment Share on other sites More sharing options...
GoCubbies Posted July 16, 2018 Report Share Posted July 16, 2018 Vipul, I agree with MayMusic on this. You don't want to use CSS to hide content that should be restricted by role as you can easily use the developer tool in most browsers to then see this content. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.