Jump to content

Different Menu Links based on user role


Recommended Posts

Let's say you have a Role field in Authentication table with these Roles:

Admin

Manage

User

 

Create a HTML DataPage and click on source and use the code below:

<div id="menu"></div>
<script>
if("[@authfield:Role]" == "Admin"){
document.getElementById('menu').innerHTML = '<a href="">Home</a><br /><a href="">Admin Report</a><br /><a href="https://b3.caspio.com/folderlogout">Logout</a>';
}
else if ("[@authfield:Role]" == "Manager"){
document.getElementById('menu').innerHTML =  '<a href="">Home</a><br /><a href="">Manager Report</a><br /><a href="https://b3.caspio.com/folderlogout">Logout</a>';
}
else if ("[@authfield:Role]" == "User"){
document.getElementById('menu').innerHTML =  '<a href="">Home</a><br /><a href="">User Report</a><br /><a href="https://b3.caspio.com/folderlogout">Logout</a>';
}
</script>

 

Link to comment
Share on other sites

  • 5 years later...
  • 9 months later...
  • 1 year 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...
×
×
  • Create New...