Roles and conditional formatting

D

devers

I need to disable some controls based on roles. If the current user is not a
member of the group that populates the defined role then the control is set
to read only. The roles are defined with Active Directory groups and a user
may be in mutiple groups and consequently be a member of multiple roles.

When I compare the current user to a role I have been using equals as the
operator but it doesn't seem to be working. My first fear was that the role
was a snapshot of the group members when I defined the role in my InfoPath
form, but that seems unlikely, after all this is a Microsoft product so you'd
think it was dynamic. So now I am wondering if maybe the opertor should be
something else to handle the case of membership in multiple AD groups and
InfoPath roles. What does the get-roles function return and what is the
recommended operator to handle this?
 
R

renee rieser

No offense, but why are you trying to do this in code?

The logical and proper place to do this is in the GUI. Check out the
Display properties box for whatever controls or section or whatever
that you're trying to make read-only.
 
Y

Yueli Du

I have a similar case:

1. Two roles are created: Admins (user1) and Users (user2)
2. A field control is set to be hidden if the current user is not in Admins
role.
3. I published the form to SharePoint Form Library. When I login as user1 or
user2, the InfoPath form behaves correctly.
4. However, when I login as user3, who doesn't belong to Admins nor Users,
the field control now is visible.

Conclude: it seems to me that it is a bug in InfoPath - InfoPath rule engine
didn't know what to do when xdXDocument.getRole() returns nothing (in this
case, can't find the role for specified user).

Please comment.
 
D

devers

I was using the GUI, Renee, I'm just kind of new to InfoPath and I didn't
notice that there are only two operators for the role comparison, equal or
not equal. So no offense taken, my post was less than clear and I'm
appreciative of any information.

What I think I've discovered is that InfoPath seems to evaluate the user's
role for the session. If the users is a member of multiple roles then
whichever it first finds is the role that gets used in evaluating conditional
formatting. I noticed there is an icon in the lower righthand corner of the
InfoPath form that tells you what role the current user is a member of. I
had incorrectly assumed that the conditional formatting would evaluate the
user's role at the control level and consequently it would support users
membership in multiple roles.

This issue is a bit different from Yueli's discovery, but both seem to point
to evaluating Role membership as an area where InfoPath could be improved.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top