Create a list name I name it RoleList (you can give any name) with the following fields:
1- UserAccount (type should be from person/group)
2- RoleType (Choice Menu) for example (Admin,Editor,Property,GSO, FMS…)
Now in your main list or form library for example mine is (StudentsList) where you want to apply permission or roles do the following
open your list or form library in InfoPath Designer for I opened my StudentsList in InfoPath
and created a field and named it UsersRoles.
Go to data connections and select form load.
in the form load create an Action rule name it SetRoles now come in bottom click set fields values, I used double eval function: eval(eval(RoleType[AccountId = Value], ‘concat(., “|”)’), “..”)
or using contains:
eval(eval(RoleType[translate(AccountId, “ABCDEFGHIJKLMNOPQRSTUVWYXZ”, “abcdefghijklmnopqrstuvwyxz”) = translate(Value[Name = “AccountName”], “ABCDEFGHIJKLMNOPQRSTUVWYXZ”, “abcdefghijklmnopqrstuvwyxz”)], ‘concat(., “|”)’), “..”)
XPath:
xdMath:Eval(xdMath:Eval(xdXDocument:GetDOM(“GSOMakeReadyModuleRole”)/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/d:RoleType[translate(../d:AccountName/pc:Person/pc:AccountId, “ABCDEFGHIJKLMNOPQRSTUVWYXZ”, “abcdefghijklmnopqrstuvwyxz”) = translate(xdXDocument:GetDOM(“GetUserProfileByName”)/dfs:myFields/dfs:dataFields/tns:GetUserProfileByNameResponse/tns:GetUserProfileByNameResult/tns:PropertyData/tns:Values/tns:ValueData/tns:Value[../../../tns:Name = “AccountName”], “ABCDEFGHIJKLMNOPQRSTUVWYXZ”, “abcdefghijklmnopqrstuvwyxz”)], ‘concat(., “|”)’), “..”)
see screen shot:
bellow is the Xpath of my double eval function:
xdMath:Eval(xdMath:Eval(xdXDocument:GetDOM(“GSOMakeReadyModuleRole”)/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/d:RoleType[../d:AccountName/pc:Person/pc:AccountId = xdXDocument:GetDOM(“GetUserProfileByName”)/dfs:myFields/dfs:dataFields/tns:GetUserProfileByNameResponse/tns:GetUserProfileByNameResult/tns:PropertyData/tns:Values/tns:ValueData/tns:Value], ‘concat(., “|”)’), “..”)
Now in the form load create another rule name it step-3 this view should be displayed only to users in rule GSO for example
and another role step-5 which users in RoleList with FMS rule can access it.
now different users can access different form views based on the roles they have in the RoleList list.