tgstation-server 6.19.0
The /tg/station 13 server suite
Loading...
Searching...
No Matches
GatewayInformation.cs
Go to the documentation of this file.
1using System;
4
5using HotChocolate;
7
9
21
23{
27 public sealed class GatewayInformation
28 {
33
38
45 [Authorize]
47 [Service] IAuthorizationService authorizationService,
48 [Service] IOptionsSnapshot<GeneralConfiguration> generalConfigurationOptions)
49 {
50 ArgumentNullException.ThrowIfNull(authorizationService);
51 ArgumentNullException.ThrowIfNull(generalConfigurationOptions);
52
53 await authorizationService.CheckGraphQLAuthorized(
57 null);
58
59 return generalConfigurationOptions.Value.MinimumPasswordLength;
60 }
61
68 [Authorize]
70 [Service] IAuthorizationService authorizationService,
71 [Service] IOptionsSnapshot<GeneralConfiguration> generalConfigurationOptions)
72 {
73 ArgumentNullException.ThrowIfNull(authorizationService);
74 ArgumentNullException.ThrowIfNull(generalConfigurationOptions);
75
76 await authorizationService.CheckGraphQLAuthorized(
78 null);
79
80 return generalConfigurationOptions.Value.InstanceLimit;
81 }
82
90 [Authorize]
92 [Service] IAuthorizationService authorizationService,
93 [Service] IOptionsSnapshot<GeneralConfiguration> generalConfigurationOptions)
94 {
95 ArgumentNullException.ThrowIfNull(authorizationService);
96 ArgumentNullException.ThrowIfNull(generalConfigurationOptions);
97
98 await authorizationService.CheckGraphQLAuthorized(
100 null);
101
102 return generalConfigurationOptions.Value.UserLimit;
103 }
104
112 [Authorize]
114 [Service] IAuthorizationService authorizationService,
115 [Service] IOptionsSnapshot<GeneralConfiguration> generalConfigurationOptions)
116 {
117 ArgumentNullException.ThrowIfNull(authorizationService);
118 ArgumentNullException.ThrowIfNull(generalConfigurationOptions);
119
120 await authorizationService.CheckGraphQLAuthorized(
122 null);
123 return generalConfigurationOptions.Value.UserGroupLimit;
124 }
125
132 [Authorize]
134 [Service] IAuthorizationService authorizationService,
135 [Service] IOptionsSnapshot<GeneralConfiguration> generalConfigurationOptions)
136 {
137 ArgumentNullException.ThrowIfNull(authorizationService);
138 ArgumentNullException.ThrowIfNull(generalConfigurationOptions);
139
140 await authorizationService.CheckGraphQLAuthorized(
144 null);
145 return generalConfigurationOptions.Value.ValidInstancePaths;
146 }
147
153 [Authorize]
154 public bool WindowsHost(
155 [Service] IPlatformIdentifier platformIdentifier)
156 {
157 ArgumentNullException.ThrowIfNull(platformIdentifier);
158
159 return platformIdentifier.IsWindows;
160 }
161
166 [Authorize]
168 => global::System.Version.Parse(MasterVersionsAttribute.Instance.RawSwarmProtocolVersion);
169
175 [Authorize]
177 [Service] IAssemblyInformationProvider assemblyInformationProvider)
178 {
179 ArgumentNullException.ThrowIfNull(assemblyInformationProvider);
180 return assemblyInformationProvider.Version;
181 }
182
187 [Authorize]
190
195 [Authorize]
197
202 [Authorize]
205
212 [Service] IOAuthProviders oAuthProviders)
213 {
214 ArgumentNullException.ThrowIfNull(oAuthProviders);
215 return new OAuthProviderInfos(oAuthProviders);
216 }
217 }
218}
Represents the header that must be present for every server request.
Definition ApiHeaders.cs:25
static readonly Version Version
Get the version of the Api the caller is using.
Definition ApiHeaders.cs:69
Constants used for communication with the DMAPI.
static readonly Version InteropVersion
The DMAPI InteropVersion being used.
Represents information about a SwarmNode retrieved via a Interfaces.IGateway.
static Version GraphQLApiVersionNoAuth
Access the GraphQL API global::System.Version without auth.
Version Version([Service] IAssemblyInformationProvider assemblyInformationProvider)
Gets the global::System.Version of tgstation-server the SwarmNode is running.
Version GraphQLApiVersion()
Gets the GraphQL API global::System.Version of the SwarmNode.
Version DMApiVersion()
Gets the DMAPI interop global::System.Version the SwarmNode uses.
Version ApiVersion()
Gets the REST API global::System.Version of the SwarmNode.
async ValueTask< uint > InstanceLimit([Service] IAuthorizationService authorizationService, [Service] IOptionsSnapshot< GeneralConfiguration > generalConfigurationOptions)
Gets the maximum allowed attached instances for the SwarmNode.
async ValueTask< uint > UserGroupLimit([Service] IAuthorizationService authorizationService, [Service] IOptionsSnapshot< GeneralConfiguration > generalConfigurationOptions)
Gets the maximum allowed registered UserGroups for the ServerSwarm.
async ValueTask< uint > UserLimit([Service] IAuthorizationService authorizationService, [Service] IOptionsSnapshot< GeneralConfiguration > generalConfigurationOptions)
Gets the maximum allowed registered Users for the ServerSwarm.
int MajorGraphQLApiVersion
Gets the major GraphQL API global::System.Version number of the SwarmNode.
Version SwarmProtocolVersion()
Gets the swarm protocol Version.
bool WindowsHost([Service] IPlatformIdentifier platformIdentifier)
Gets a flag indicating whether or not the current SwarmNode runs on a Windows operating system.
async ValueTask< IReadOnlyCollection< string >?> ValidInstancePaths([Service] IAuthorizationService authorizationService, [Service] IOptionsSnapshot< GeneralConfiguration > generalConfigurationOptions)
Gets the locations Instances may be created or attached from if there are restrictions.
OAuthProviderInfos OAuthProviderInfos([Service] IOAuthProviders oAuthProviders)
Gets the information needed to perform open authentication with the SwarmNode.
async ValueTask< uint > MinimumPasswordLength([Service] IAuthorizationService authorizationService, [Service] IOptionsSnapshot< GeneralConfiguration > generalConfigurationOptions)
Gets the minimum valid password length for TGS users.
Attribute for bringing in the master versions list from MSBuild that aren't embedded into assemblies ...
string RawGraphQLVersion
The Version string of the TGS GraphQL API.
string RawSwarmProtocolVersion
The Version string of the TGS swarm protocol.
static MasterVersionsAttribute Instance
Return the Assembly's instance of the MasterVersionsAttribute.
Interface for evaluating IAuthorizationRequirements.
For identifying the current platform.
@ List
User may list files if the Models.Instance allows it.
InstanceManagerRights
Rights for managing Models.Instances.
AdministrationRights
Administration rights for the server.