Пример #1
0
        public bool HaveCurrentUserAccess(int id)
        {
            var res = false;
            var h   = new as_hotkeys();
            var key = "as_hotkey_id_" + id;

            if (CacheManager.EnableCaching && CacheManager.Cache[key] != null)
            {
                h = (as_hotkeys)CacheManager.Cache[key];
            }
            else
            {
                try
                {
                    h = db.GetHotKey(id);
                    CacheManager.CacheData(key, h);
                }
                catch (Exception ex)
                {
                    Debug.LogError(ex);
                }
            }

            var roles = Roles.GetRolesForUser().Count() != 0 ? Roles.GetRolesForUser(): new String[] { "guest" };

            var mRoles = (h.roles ?? "").Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

            res = mRoles.Any(x => roles.Contains(x));

            return(res);
        }
Пример #2
0
        private bool HaveCurrentUserAccess(as_hotkeys h, string[] roles)
        {
            var res = false;

            var mRoles = (h.roles ?? "").Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

            res = mRoles.Any(x => roles.Contains(x));
            return(res);
        }
Пример #3
0
        public string[] getRolesForHotKey(int id)
        {
            List <String> res     = new List <String>();
            as_hotkeys    hotkeys = db.GetHotKey(id);
            var           r       = hotkeys.roles;

            res.AddRange(r.Split(','));
            return(res.ToArray());
        }
Пример #4
0
        public void SaveHotKey(as_hotkeys item)
        {
            try
            {
                db.SaveHotKey(item);

                RDL.CacheManager.PurgeCacheItems("as_hotkeys");
                RDL.CacheManager.PurgeCacheItems("hotKeys");
            }
            catch (Exception ex)
            {
                RDL.Debug.LogError(ex);
            }
        }
Пример #5
0
        public as_hotkeys GetHotKey(int id)
        {
            var res = new as_hotkeys();
            var key = "as_hotkey_id_" + id;

            if (CacheManager.EnableCaching && CacheManager.Cache[key] != null)
            {
                res = (as_hotkeys)CacheManager.Cache[key];
            }
            else
            {
                try
                {
                    res = db.GetHotKey(id);
                    CacheManager.CacheData(key, res);
                }
                catch (Exception ex)
                {
                    Debug.LogError(ex);
                }
            }
            return(res);
        }