Jump to content

Based on User Authentication type want to show hide div in HTML Block


Recommended Posts

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

 

Link to comment
Share on other sites

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/

Link to comment
Share on other sites

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/

Link to comment
Share on other sites

  • 3 weeks later...

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...