public static void ValidateUserAccess(SoftwareAppType appType,params string[] roles) { //-- TODO: Take this out! it's only for devlopment purposes stupid. #if DEBUG if(ConfigurationManager.AppSettings["RequireLicenses"] != null) { if(!Convert.ToBoolean(ConfigurationManager.AppSettings["RequireLicenses"])) return; } #endif //-- ensure the user has sufficent permissions bool hasRole = false; foreach(string role in roles) { if(!HttpContext.Current.User.IsInRole(role)) { hasRole = true; break; } } if(!hasRole) HttpContext.Current.Response.Redirect(URL.NoAccess + "?code=" + ValidationError.InsufficientRole); if((!SecurityManager.GetLicense(appType))) HttpContext.Current.Response.Redirect(URL.NoAccess + "?code=" + ValidationError.LicenseNotAvailable); }
Remember Me
a@href@title, b, blockquote@cite, em, i, strike, strong, sub, super, u