Skip to content

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
wwwlicious committed May 2, 2020
2 parents 883471c + e154b17 commit 70a6bfe
Show file tree
Hide file tree
Showing 12 changed files with 58 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ cache:
#---------------------------------#

# Build worker image (VM template)
image: Visual Studio 2017
image: Visual Studio 2019
1 change: 0 additions & 1 deletion build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ Task("Build")
.WithProperty("Version", semVersion)
.WithProperty("PackageVersion", gitVersionResults.MajorMinorPatch)
.WithProperty("PackageOutputPath", MakeAbsolute(nugetPackageDir).FullPath)
.UseToolVersion(MSBuildToolVersion.VS2017)
.SetNodeReuse(false);
// setup binary logging for solution to artifacts dir
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netcoreapp2.1;net452</TargetFrameworks>
<TargetFrameworks>net452;netcoreapp3.1</TargetFrameworks>
<LangVersion>8</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="FluentAssertions" Version="5.8.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="ServiceStack" Version="5.6.0" />
<PackageReference Include="FluentAssertions" Version="5.10.3" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
<PackageReference Include="ServiceStack" Version="5.8.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
</ItemGroup>
Expand Down
19 changes: 17 additions & 2 deletions src/ServiceStack.Quartz/QuartzFeature.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ public NameValueCollection Config
/// True by default
/// </summary>
public bool ScanAppHostAssemblies { get; set; } = true;

/// <summary>
/// Limit access to /quartz service to these roles
/// </summary>
public string[] RequiredRoles { get; set; }

/// <summary>
/// Executed before any plugin is registered
Expand All @@ -76,9 +81,19 @@ public void Register(IAppHost appHost)
}

// TODO list
// Wire up common logging from Quartz -> SericeStack
// Wire up common logging from Quartz -> ServiceStack
// Register service for getting info from scheduler
appHost.RegisterService(typeof(QuartzService), _apiRestPath);
var serviceType = typeof(QuartzService);
if (!RequiredRoles.IsEmpty())
{
if (!appHost.HasPlugin<AuthFeature>())
throw new System.Configuration.ConfigurationErrorsException(
"RequiredRoles has been specified but AuthFeature plugin has been registered to handle authorization");

serviceType.AddAttributes(new RequiresAnyRoleAttribute(RequiredRoles));
}

appHost.RegisterService(serviceType, _apiRestPath);

// add endpoint link to metadata page
ConfigurePluginLinks(appHost);
Expand Down
5 changes: 3 additions & 2 deletions src/ServiceStack.Quartz/ServiceStack.Quartz.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<ReleaseNotes>https://github.com/wwwlicious/ServiceStack.Quartz/releases</ReleaseNotes>
<PackageTags>servicestack quartz quartznet job schedule plugin</PackageTags>
<RepositoryUrl>https://github.com/wwwlicious/ServiceStack.Quartz</RepositoryUrl>
<LangVersion>default</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net452|AnyCPU'">
<DefineConstants>TRACE;DEBUG;NET452;</DefineConstants>
Expand All @@ -35,8 +36,8 @@
<DocumentationFile>bin\Release\netstandard2.0\ServiceStack.Quartz.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="GitLink" Version="3.1.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" />
<PackageReference Include="Quartz" Version="3.0.7" />
<PackageReference Include="ServiceStack.Server" Version="5.6.0" />
<PackageReference Include="ServiceStack.Server" Version="5.8.0" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion src/ServiceStack.Quartz/services/QuartzService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace ServiceStack.Quartz
public class QuartzService : Service
{
public IScheduler Scheduler { get; set; }

public object Get(GetQuartzSummary request)
{
return new GetQuartzSummaryResponse
Expand Down
17 changes: 16 additions & 1 deletion src/demo/ServiceStackQuartz.NetCore/AppHost.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
using System.Collections.Generic;
using ServiceStack.Auth;

namespace ServiceStack.Quartz.NetCore
{
using System;
Expand Down Expand Up @@ -34,10 +37,22 @@ public override void Configure(Container container)
var quartzConfig = ConfigureQuartz();

// register plugin, will scan assemblies by default for jobs
var quartzFeature = new QuartzFeature();
var quartzFeature = new QuartzFeature()
{
RequiredRoles = new[]{"Admin"}
};
Plugins.Add(quartzFeature);
Plugins.Add(new PostmanFeature());

// var inMemoryAuthRepository = new InMemoryAuthRepository();
// inMemoryAuthRepository.CreateUserAuth(
// new UserAuth() {UserName = "test", Roles = new List<string> {"Admin"}}, "test");
// Register<IAuthRepository>(inMemoryAuthRepository);
//
// Plugins.Add(new AuthFeature(
// () => new AuthUserSession(),
// new IAuthProvider[] {new BasicAuthProvider(),}));

// or you can register the plugin with custom config source
Plugins.AddIfNotExists(new QuartzFeature { Config = quartzConfig });

Expand Down
13 changes: 6 additions & 7 deletions src/demo/ServiceStackQuartz.NetCore/Program.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
namespace ServiceStack.Quartz.NetCore
{
using System;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Serilog;
using Serilog.Events;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;

public class Program
{
Expand All @@ -14,7 +14,6 @@ public static int Main(string[] args)
.MinimumLevel.Debug()
.MinimumLevel.Override("Microsoft", LogEventLevel.Information)
.Enrich.FromLogContext()
.WriteTo.Seq("http://localhost:5341")
.WriteTo.LiterateConsole()
.CreateLogger();

Expand All @@ -34,11 +33,11 @@ public static int Main(string[] args)
Log.CloseAndFlush();
}
}

public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()

public static IHost BuildWebHost(string[] args) =>
Host.CreateDefaultBuilder(args)
.UseSerilog()
.ConfigureWebHostDefaults(builder => builder.UseStartup<Startup>())
.Build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:64462/",
"applicationUrl": "http://localhost:64462/metadata",
"sslPort": 0
}
},
Expand All @@ -22,7 +22,7 @@
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:64463/"
"applicationUrl": "https://localhost:5001;http://localhost:5000"
}
}
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.2</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
<Configurations>Debug;Release</Configurations>
<LangVersion>default</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.2.6" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="3.1.3" />
<PackageReference Include="Quartz" Version="3.0.7" />
<PackageReference Include="Serilog.AspNetCore" Version="2.1.1" />
<PackageReference Include="Serilog.AspNetCore" Version="3.2.0" />
<PackageReference Include="Serilog.Sinks.Literate" Version="3.0.0" />
<PackageReference Include="Serilog.Sinks.Seq" Version="4.0.0" />
<PackageReference Include="ServiceStack" Version="5.6.0" />
<PackageReference Include="ServiceStack" Version="5.8.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\ServiceStack.Quartz\ServiceStack.Quartz.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
<ProjectReference Include="..\ServiceStackQuartz.ServiceModel\ServiceStack.Quartz.ServiceModel.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="ServiceStack.Server" Version="5.6.0" />
<PackageReference Include="ServiceStack.Server" Version="5.8.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
<Configurations>Debug;Release</Configurations>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ServiceStack.Interfaces" Version="5.6.0" />
<PackageReference Include="ServiceStack.Interfaces" Version="5.8.0" />
</ItemGroup>
</Project>

0 comments on commit 70a6bfe

Please sign in to comment.