/// <summary> /// Check if the current user has the given right /// else if specified redirect to the access denied page /// </summary> /// <param name="right"></param> /// <param name="accessDeniedRedirect"></param> /// <returns>true or false</returns> public bool CheckRight(NSurveyRights right, bool accessDeniedRedirect) { if (NSurveyUser.Identity.IsAdmin || NSurveyUser.HasRight(right)) { return(true); } else if (accessDeniedRedirect) { UINavigator.NavigateToAccessDenied(getSurveyId(), MenuIndex); } return(false); }
public NSurveyFormPrincipal(INSurveyIdentity identity, string[] rights) { this._identity = identity; if ((rights != null) && (rights.Length > 0)) { foreach (string str in rights) { if (str.Length > 0) { NSurveyRights key = (NSurveyRights)Enum.Parse(typeof(NSurveyRights), str); this._rights.Add(key, key); } } } }
public bool HasRight(NSurveyRights right) { return this._rights.ContainsKey(right); }
/// <summary> /// Check if the current user has the given right /// else if specified redirect to the access denied page /// </summary> /// <param name="right"></param> /// <param name="accessDeniedRedirect"></param> /// <returns>true or false</returns> public bool CheckRight(NSurveyRights right, bool accessDeniedRedirect) { if (NSurveyUser.Identity.IsAdmin || NSurveyUser.HasRight(right)) { return true; } else if (accessDeniedRedirect) { UINavigator.NavigateToAccessDenied(getSurveyId(), MenuIndex); } return false; }
public bool HasRight(NSurveyRights right) { return(this._rights.ContainsKey(right)); }