Hopefully done messing with models for now

This commit is contained in:
Cyberboss
2018-04-07 13:22:53 -04:00
parent 970ace54a6
commit 4b760fadcb
5 changed files with 57 additions and 20 deletions
@@ -8,32 +8,14 @@ namespace Tgstation.Server.Api.Models
/// Metadata about an installation
/// </summary>
[Model(RightsType.Administration)]
public sealed class Administration
public sealed class Administration : Internal.ServerSettings
{
/// <summary>
/// Use the specified Windows/UNIX authentication to authorize users. Setting this to <see langword="null"/> enables full administrative anonymous access
/// </summary>
[Permissions(ReadRight = AdministrationRights.ChangeAuthenticationGroup, WriteRight = AdministrationRights.ChangeAuthenticationGroup)]
public string SystemAuthenticationGroup { get; set; }
/// <summary>
/// Automatically send unhandled exception data to a public collection service. This will be limited to system information, path data, and game code compilation information.
/// </summary>
[Permissions(ReadRight = AdministrationRights.ChangeTelemetry, WriteRight = AdministrationRights.ChangeTelemetry)]
public bool EnableTelemetry { get; set; }
/// <summary>
/// If the <see cref="DreamDaemon"/> instances will not be stopped when the server exits. Resets to <see langword="false"/> when the server restarts
/// </summary>
[Permissions(ReadRight = AdministrationRights.SoftStop, WriteRight = AdministrationRights.SoftStop)]
public bool SoftStop { get; set; }
/// <summary>
/// The git repository to recieve updates to Tgstation.Server.Host from, must include credentials if necessary. If set to <see langword="null"/> upstream pulls will be disabled entirely
/// </summary>
[Permissions(ReadRight = AdministrationRights.SetUpstreamRepository, WriteRight = AdministrationRights.SetUpstreamRepository)]
public string UpstreamRepository { get; set; }
/// <summary>
/// The latest available version of the Tgstation.Server.Host assembly from the upstream repository. If <see cref="Version.Minor"/> is higher than <see cref="CurrentVersion"/>'s the update cannot be applied due to API changes
/// </summary>
@@ -0,0 +1,25 @@
using Tgstation.Server.Api.Rights;
namespace Tgstation.Server.Api.Models.Internal
{
public class ServerSettings
{
/// <summary>
/// Use the specified Windows/UNIX authentication to authorize users. Setting this to <see langword="null"/> enables full administrative anonymous access
/// </summary>
[Permissions(ReadRight = AdministrationRights.ChangeAuthenticationGroup, WriteRight = AdministrationRights.ChangeAuthenticationGroup)]
public string SystemAuthenticationGroup { get; set; }
/// <summary>
/// Automatically send unhandled exception data to a public collection service. This will be limited to system information, path data, and game code compilation information.
/// </summary>
[Permissions(ReadRight = AdministrationRights.ChangeTelemetry, WriteRight = AdministrationRights.ChangeTelemetry)]
public bool EnableTelemetry { get; set; }
/// <summary>
/// The git repository to recieve updates to Tgstation.Server.Host from, must include credentials if necessary. If set to <see langword="null"/> upstream pulls will be disabled entirely
/// </summary>
[Permissions(ReadRight = AdministrationRights.SetUpstreamRepository, WriteRight = AdministrationRights.SetUpstreamRepository)]
public string UpstreamRepository { get; set; }
}
}
@@ -9,12 +9,33 @@ namespace Tgstation.Server.Host.Models
/// </summary>
interface IDatabaseContext
{
/// <summary>
/// The <see cref="ServerSettings"/> in the <see cref="IDatabaseContext"/>
/// </summary>
ServerSettings ServerSettings { get; }
/// <summary>
/// The <see cref="User"/>s in the <see cref="IDatabaseContext"/>
/// </summary>
DbSet<User> Users { get; }
/// <summary>
/// The <see cref="Instances"/>s in the <see cref="IDatabaseContext"/>
/// </summary>
DbSet<Instance> Instances { get; }
/// <summary>
/// Saves changes made to the <see cref="IDatabaseContext"/>
/// </summary>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> for the operation</param>
/// <returns>A <see cref="Task"/> representing the running operation</returns>
Task Save(CancellationToken cancellationToken);
/// <summary>
/// Creates and migrates the <see cref="IDatabaseContext"/>
/// </summary>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> for the operation</param>
/// <returns>A <see cref="Task"/> representing the running operation</returns>
Task Initialize(CancellationToken cancellationToken);
}
}
+2
View File
@@ -6,5 +6,7 @@ namespace Tgstation.Server.Host.Models
{
[Required]
new public User StartedBy { get; set; }
Instance Instance { get; set; }
}
}
@@ -0,0 +1,7 @@
namespace Tgstation.Server.Host.Models
{
sealed class ServerSettings : Api.Models.Internal.ServerSettings
{
long Id { get; set; }
}
}