With the security model you are able to set criteria statements for granting access to certain information and I am doubting that we handling it correct.
I want to be able to hide information if none of the following are true.
- The record was created by the user
- The record is for a employee that you manage.
- or you are a member of a certain role.
The expression looks as follows
[Employee.CurrentUser.Employee.EmployeeCode] = [Employee…EmployeeCode]
Or [Employee.CurrentUser.Employee.EmployeeCode] = [Employee.ApprovalManager1.EmployeeCode]
Or IsCurrentUserInRole('Administrator')
Or IsCurrentUserInRole('CorporateAdministrator'))
In order for me to do this I need to have the following Current user property on the employee object or any other objects that hey need it.
//Jira422: removed Static declaration as security expressions do not work in web client
//private static SecurityUser _CurrentUser;
private SecurityUser _CurrentUser;
[ToolTip("This property is used in security and model editor criteria expressions")]
private SecurityUser CurrentUser
{
get
{
if (_CurrentUser == null || ((IXPInvalidateableObject)_CurrentUser).IsInvalidated || !_CurrentUser.Session.Equals(this.Session))
{
_CurrentUser = this.Session.GetObjectByKey<SecurityUser>(((SecurityUser)SecuritySystem.CurrentUser).Oid);
}
return _CurrentUser;
}
}
I have a feeling that there is a better may. Is there a way to call the current user record directly from the expression?