You are viewing limited content. For full access, please sign in.

Question

Question

Forms Question - Check if Current User is in Group

asked on April 19, 2021

I have a form where I have a radio button Field which I want only members of a particular Laserfiche Forms Group to be able to access one particular option of that field.

I know how to hide or show the option using custom JavaScript, but not how to determine if the user is or is not a member of the forms group.

Is there any means which can do this either by field rules, adding an element which will indicate if the user is part of the relevant group, or determine if user is in a group by using JavaScript ?

 

0 0

Replies

replied on April 19, 2021

Hi Will-

I've done something like this with individual users but not a group. Luckily, for the users in question there wasn't a lot of turnover so it wasn't terrible. Hopefully there's a better answer, but here's an example of what I did.

  1. Default a field to the current user token
  2. Set that to uppercase and then compare to an array I maintained of "power users"
  3. If the user was not a power user, hide a table column. I did this hide vis JS but probably could have populated a field that then triggered a field rule

Note: if there are future steps in this process that also require that kind of logic, you'll need to use a different field for current user or reset it when the form loads (unless there's now a JS token for that info)

 

var currentUser = $('.CurrentUser input').val().toUpperCase();
var powerUsers = [];
powerUsers = ["LFADMIN", "DOMAIN\\USER1", "DOMAIN\\USER2"];
if($.inArray(currentUser, powerUsers) == -1)
{
	$('.ProductTable tbody .HideLine').hide();
}

 

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.