public bool securityCheck(EAction action, ESecurity right) { if (_main.Startup != null) { Agent agent = Bl.BlSecurity.GetAuthenticatedUser(); if (agent.RoleList != null) { foreach (var role in agent.RoleList) { var actionFound = role.ActionList.Where(x => x.Name.Equals(action.ToString())).FirstOrDefault(); if (actionFound != null) { switch (right) { case ESecurity._Delete: if (actionFound.Right.IsDelete) { return(actionFound.Right.IsDelete); } break; case ESecurity._Read: if (actionFound.Right.IsRead) { return(actionFound.Right.IsRead); } break; case ESecurity._Update: if (actionFound.Right.IsUpdate) { return(actionFound.Right.IsUpdate); } break; case ESecurity._Write: if (actionFound.Right.IsWrite) { return(actionFound.Right.IsWrite); } break; case ESecurity.SendEmail: if (actionFound.Right.IsSendMail) { return(actionFound.Right.IsSendMail); } break; } } } } } return(false); }
public bool securityCheck(EAction action, ESecurity right) { return(SecurityLoginViewModel.securityCheck(action, right)); }