Пример #1
0
        public static bool HasAction(string action)
        {
            bool hasAction = false;

            SOCISA.Models.Nomenclator n = (SOCISA.Models.Nomenclator)HttpContext.Current.Session["CURENT_USER_TYPE"];
            if (n.DENUMIRE.ToLower() == "administrator")
            {
                hasAction = true;
            }
            else
            {
                SOCISA.Models.Action[] aas = (SOCISA.Models.Action[])HttpContext.Current.Session["CURENT_USER_ACTIONS"];
                foreach (SOCISA.Models.Action a in aas)
                {
                    if (a.NAME == action || a.NAME.ToLower() == "administrare")
                    {
                        hasAction = true;
                        break;
                    }
                }
            }
            return(hasAction);
        }
Пример #2
0
        public static bool HasRight(string right)
        {
            bool hasRight = false;

            SOCISA.Models.Nomenclator n = (SOCISA.Models.Nomenclator)HttpContext.Current.Session["CURENT_USER_TYPE"];
            if (n.DENUMIRE.ToLower() == "administrator")
            {
                hasRight = true;
            }
            else
            {
                SOCISA.Models.Drept[] ds = (SOCISA.Models.Drept[])HttpContext.Current.Session["CURENT_USER_RIGHTS"];
                foreach (SOCISA.Models.Drept d in ds)
                {
                    if (d.DENUMIRE == right || d.DENUMIRE.ToLower() == "administrare")
                    {
                        hasRight = true;
                        break;
                    }
                }
            }
            return(hasRight);
        }