public async Task Invoke(QueryContext <TService> ctx) { Security.IAuthorizer <TService> authorizer = ctx.ServiceContainer.GetAuthorizer(); RunTimeMetadata metadata = ctx.Service.GetMetadata(); MethodDescription method = metadata.GetQueryMethod(ctx.Request.dbSetName, ctx.Request.queryName); await authorizer.CheckUserRightsToExecute(method.GetMethodData()); await _next(ctx); }
public async Task Invoke(RefreshContext <TService> ctx) { DbSetInfo dbSetInfo = ctx.Request.GetDbSetInfo() ?? throw new InvalidOperationException($"Could not get the DbSet for {ctx.Request.dbSetName}"); Security.IAuthorizer <TService> authorizer = ctx.ServiceContainer.GetAuthorizer(); RunTimeMetadata metadata = ctx.Service.GetMetadata(); MethodInfoData methodData = metadata.GetOperationMethodInfo(ctx.Request.dbSetName, MethodType.Refresh); if (methodData == null) { throw new InvalidOperationException(string.Format(ErrorStrings.ERR_REC_REFRESH_INVALID, dbSetInfo.GetEntityType().Name, GetType().Name)); } await authorizer.CheckUserRightsToExecute(methodData); await _next(ctx); }