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); }
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); }
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()); }
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); } }
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); }