예제 #1
0
        public static bool IsValidAccessToService(AccessManagementService.Access.RightRelatedService Service, string UserRoles)
        {
            string ServiceName = Enum.GetName(typeof(AccessManagementService.Access.RightRelatedService), Service);
            string ASCService  = string.Format("{0}_Right_{1}", "ASC", ServiceName);

            if (HttpContext.Current.Session[ASCService] != null)
            {
                return((bool)HttpContext.Current.Session[ASCService]);
            }
            else
            {
                using (AccessEntities mympo = new AccessEntities())
                {
                    string roles = UserRoles;
                    if (string.IsNullOrEmpty(roles))
                    {
                        return(false);
                    }
                    int result = mympo.Right_ValidByServiceName(roles, ServiceName).FirstOrDefault().Value.ToInt32();

                    HttpContext.Current.Session[ASCService] = result <= 0 ? false : true;

                    return((bool)HttpContext.Current.Session[ASCService]);
                }
            }
        }
예제 #2
0
 public static bool IsValidAccessToService(AccessManagementService.Access.RightRelatedService Service)
 {
     return(IsValidAccessToService(Service, LoggedInUser.UserRoles));
 }