Jump to content
  • 0
Sign in to follow this  
ababcock

Redirect Based On Access Level

Question

I am trying to create a button that connects users to a details page depending on their access level. Here is what I have in the button right now (URL changed):

 

<input onclick="window.open('https://sample.org/edit.html?ID=[@field:Contact_Sheet_Number]')" type="button" value="Edit Content" />

 

I would like to adjust that so it directs

- user level users to one page: https://sample.org/edit.html

- management level users to one page: https://sample.org/edit1.html

- admin level users to one page: https://sample.org/edit2.html

 

I was directed to this page for help: http://howto.caspio.com/tech-tips-and-articles/common-customizations/create-user-specific-redirect-after-login/ which explains redirect after login based on access level, but I was wondering if I could just insert the HTML code into the HTML box my button is in (rather than a standalone login screen). Here is the code they recommend: 

 

<script>
if("[@authfield:Admin]" == "Yes"){
window.location = "http://www.mysite.com/admin.html";
}
else if ("[@authfield:Manager]" == "Yes"){
window.location = "http://www.mysite.com/manager.html";
}
else{
window.location = "http://www.mysite.com/employee.html";
}
</script>

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

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
Answer this question...

×   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...
Sign in to follow this  

×
×
  • Create New...