private void SetupSecurity() { if (NSurveyUser.Identity.IsAdmin || NSurveyUser.HasRight(NSurveyRights.AccessReports)) { return; } else { Response.End(); } }
/// <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); }