public override void OnActionExecuting(HttpActionContext actionContext) { var currentModule = RequestUtil.GetValue(actionContext.Request, CurrentModuleKey); var currentUSer = SecurityFacade.CurrentUser(); if (currentModule != null && currentUSer != null) { FunctionalRole fr; Enum.TryParse(currentModule, true, out fr); if (!currentUSer.IsInRole(fr.ToString())) { throw new InvalidOperationException( "this user is not allowed for this role. Please contact your administrator"); } } var currentMetadataId = RequestUtil.GetValue(actionContext.Request, CurrentMetadataKey); var currentMetadataParameter = RequestUtil.GetValue(actionContext.Request, CurrentMetadataParameterKey); var printMode = "true".Equals(RequestUtil.GetValue(actionContext.Request, PrintMode)); ApplicationLookupContext appCtx = null; if (currentMetadataId != null) { appCtx = new ApplicationLookupContext { MetadataId = currentMetadataId }; } ContextLookuper.AddContext(new ContextHolder() { Module = currentModule, ApplicationLookupContext = appCtx, PrintMode = printMode, MetadataParameters = PropertyUtil.ConvertToDictionary(currentMetadataParameter) }, true); base.OnActionExecuting(actionContext); }
public WhereClauseRegisterCondition AppendSchema(string schema) { if (AppContext == null) { AppContext = new ApplicationLookupContext(); } AppContext.Schema = schema; return(this); }
public WhereClauseResult Lookup(string applicationName, ApplicationLookupContext lookupContext = null) { var context = _contextLookuper.LookupContext(); if (lookupContext != null) { context.ApplicationLookupContext = lookupContext; } var resultString = _configurationService.Lookup <string>(String.Format(WcConfig, ConfigTypes.WhereClauses.GetRootLevel(), applicationName), context); return(BuildWhereClauseResult(resultString)); }
public void OnActionExecuting(ActionExecutingContext actionContext) { if (!actionContext.HttpContext.User.Identity.IsAuthenticated) { return; } IEnumerable <String> modules; var currentModule = GetValue(actionContext, CurrentModuleKey); var currentMetadataId = GetValue(actionContext, CurrentMetadataKey); var currentMetadataParameter = GetValue(actionContext, CurrentMetadataParameterKey); ApplicationLookupContext appCtx = null; if (currentMetadataId != null) { appCtx = new ApplicationLookupContext { MetadataId = currentMetadataId }; } ContextLookuper.AddContext(new ContextHolder() { Module = currentModule, ApplicationLookupContext = appCtx, MetadataParameters = PropertyUtil.ConvertToDictionary(currentMetadataParameter) }, true); }