Jump to content

Datapage Depending on User Role


Recommended Posts

Hi,

I'm working on process that requires different fields to filter values depending on a 'role' field in my user auth table.  Some fields will also be display only depending on a field being higher than a certain value (ie field x > 100). 

I have 7 user roles. 

Since 1 rule can only be applied to the form inputs, I'm unable to use rules to tackle my problem. I'd have to set 7 rules for each input.

Have a couple ideas on how to tackle this problem, but they all involve making duplicate copies of the form for different user roles and applying that rules that way. 

This solution looks promising, but since I'm embedding my data pages in a PHP page (WAMP Stack) I'm not sure if it's possible to pull the role from the embedded form using JavaScript (my menu bar is in the php  file, not the datapage).  

My only other idea would be to put a blank HTML datapage which redirects to a user-specific input form based on the user's auth role. I'd have to make 7 copies (for each role) which would be a pain to update.

Anyone have any other ideas?

Carpentr

Link to comment
Share on other sites

var someVal = '[@field:someField]'
var someUser = '[authfield:someUserField]'
var someElement = document.getElementById('elementID');
var someElement1 = document.getElementById('elementID1');
var someElement2 = document.getElementById('elementID2');

if(someVal > 100) {
   someElement.style.display = 'none';
}

if(someUser == 'someParam'){
 someElement1.style.display = 'none';
 someElement2.style.display = 'none';
}

 

Link to comment
Share on other sites

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...