Ejemplo n.º 1
0
        //DataBase Context

        protected override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            base.OnActionExecuting(filterContext);

            CurrentUser = GetCurrentUser();
            // получаем текущего пользователя

            var currentActionName     = RouteData.Values["action"].ToString().ToLower();
            var currentControllerName = this.GetType().Name.Replace("Controller", "").ToLower();

            var attributesMethod = Request.HttpMethod.ToString().ToLower();


            // проверяем на наличие данного пермишена в игнорируемых
            if (!CheckIgnorePermission((currentControllerName + "_" + currentActionName)))
            {
                // проверка наличия в БД прав для данного экшена
                CheckPermission(currentControllerName, currentActionName, attributesMethod);
            }
            else
            {
                return; // данный экшен контроллера состоит в игнорируемых, можно пользователя далее не мучать
            }


            // пермишен проверен, теперь он есть в БД.

            bool ExsistPermissionUser = CheckUserPermission(CurrentUser, currentControllerName, currentActionName, attributesMethod); // проверяем есть ли данный пермишен у пользователя

            if (!ExsistPermissionUser)
            {
                ErrorMessage("У вас нет доступа к данной странице, или к сзменению данных");
                RedirectToAction("Index", "Home");
            }
        }
Ejemplo n.º 2
0
        private bool TINCheck(ProducerUser pUser)
        {
            //TODO Actually do it w/ valid creds
            return(true);

            var tinResponse = TiltedGlobe.ThirdParty.TINCheck.TINChecker.CheckTIN(pUser);

            return(tinResponse.NameResponse.DMFCode == (int)NameResponse.DMFCodeEnum.NoDMFRecordFound &&
                   tinResponse.AddressResponse.AddressCode == (int)AddressResponse.AddressResponseEnum.USPSMatchFound &&
                   (
                       tinResponse.NameResponse.TINNameCode == (int)NameResponse.TINNameCodeEnum.CombinationMatchesIRSRecords ||
                       tinResponse.NameResponse.TINNameCode == (int)NameResponse.TINNameCodeEnum.CombinationMatchesEINRecords ||
                       tinResponse.NameResponse.TINNameCode == (int)NameResponse.TINNameCodeEnum.CombinationMatchesSSNandEINRecords ||
                       tinResponse.NameResponse.TINNameCode == (int)NameResponse.TINNameCodeEnum.CombinationMatchesSSNRecords
                   ));
        }
Ejemplo n.º 3
0
 public bool CheckUserPermission(ProducerUser CurrentUser_, string controllerName, string actionName, string Attributes)
 {
     if (TypeLoginUser == TypeUsers.ProducerUser)
     {
         return(CheckProducerUserPermission());
     }
     if (TypeLoginUser == TypeUsers.ControlPanelUser)
     {
         return(ChekControlPanelUserPermission());
     }
     if (TypeLoginUser == TypeUsers.ReportUser)
     {
         return(ChekReportsInterfaceUserPermission());
     }
     if (TypeLoginUser == TypeUsers.UserRazrab)
     {
         // ничего не делаем
         return(true);
     }
     return(false);
 }