Exemple #1
0
        public IEnumerable <AcoesViewModel> GetMenu()
        {
            var listaAcoes = m_AcoesBusiness.GetAll().Where(x => x.Moduloid == 2).OrderBy(x => x.Ordem).ToList();

            foreach (var item in listaAcoes)
            {
                item.Menu = m_MenuBusiness.GetAll().Where(m => m.Acoesid == item.Id).OrderBy(x => x.Ordem);
            }

            return(listaAcoes);
        }
Exemple #2
0
 public HttpResponseMessage GetAll()
 {
     return(Request.CreateResponse(HttpStatusCode.OK, m_MenuBusiness.GetAll()));
 }
        public void CheckUserAuthentication(RequestContext context)
        {
            SC_USER user = _sessionProvider.Get <SC_USER>(Strings.Authorization.UserSessionKey);

            if (user == null)
            {
                var idUser = _cookieProvider.GetCookie(Strings.CookieKeys.IdUser);
                if (!string.IsNullOrEmpty(idUser) && idUser != "0")
                {
                    user = _definitionBusiness.Get <SC_USER>(Convert.ToInt32(idUser));

                    _sessionProvider.Set(Strings.Authorization.UserSessionKey, user);
                    _sessionProvider.Set(Strings.Authorization.IsLoginSessionKey, false);
                }
                else
                {
                    throw new AuthorizationException("Bu sayfada işlem yapmaya yetkiniz bulunmamaktadır.");
                }
            }

            IEnumerable <SC_MENU> lstMenu = _menuBusiness.GetAll(user.IdUser);

            string _controllerName = string.Empty;
            string _action         = string.Empty;
            string _param          = string.Empty;
            string _fullPath       = context.HttpContext.Request.FilePath;

            if (context.RouteData.Values.ContainsKey("controller"))
            {
                object value = context.RouteData.Values["controller"];
                _controllerName = value.ToString();
            }

            if (context.RouteData.Values.ContainsKey("action"))
            {
                object value = context.RouteData.Values["action"];
                _action = value.ToString();
            }

            if (context.RouteData.Values.ContainsKey("id"))
            {
                object value = context.RouteData.Values["id"];
                _param = value.ToString();
            }

            for (int i = 0; i < Strings.AuthenticationPages.PageNames().Length; i++)
            {
                string pageName = Strings.AuthenticationPages.PageNames()[i];
                if (_controllerName.ToLower() == pageName.ToLower())
                {
                    return;
                }
            }

            for (int i = 0; i < Strings.AuthenticationPages.ActionPaths().Length; i++)
            {
                string actionPath = Strings.AuthenticationPages.ActionPaths()[i];
                if (_fullPath.ToLower().Contains(actionPath.ToLower()))
                {
                    return;
                }
            }

            SC_MENU objPage = null;

            if (_controllerName.ToLower() == "definition" && (_action.ToLower() == "index" || _action.ToLower() == "ındex"))
            {
                objPage = lstMenu.FirstOrDefault(k => k.Controller.ToLower() == _controllerName.ToLower() && k.Action.ToLower() == _action.ToLower() && k.Parametre.ToLower() == _param.ToLower());
            }
            else
            {
                objPage = lstMenu.FirstOrDefault(k => k.Controller.ToLower() == _controllerName.ToLower());
            }

            if (objPage == null)
            {
                throw new AuthorizationException("Bu sayfada işlem yapmaya yetkiniz bulunmamaktadır.");
            }
        }
Exemple #4
0
 public async Task <IPaginatedList <MenuDto> > Get(int pageIndex = Constant.PAGE_INDEX_DEFAULT, int pageSize = Constant.PAGE_SIZE_DEFAULT)
 {
     return(await _menuBusiness.GetAll(_authenticationDto.RestaurantId, _authenticationDto.BranchId, pageIndex, pageSize));
 }