diff --git a/src/Tgstation.Server.Host/Authority/IUserGroupAuthority.cs b/src/Tgstation.Server.Host/Authority/IUserGroupAuthority.cs index 635da01353..ab167b87dc 100644 --- a/src/Tgstation.Server.Host/Authority/IUserGroupAuthority.cs +++ b/src/Tgstation.Server.Host/Authority/IUserGroupAuthority.cs @@ -33,6 +33,16 @@ namespace Tgstation.Server.Host.Authority [TgsAuthorize(AdministrationRights.ReadUsers)] RequirementsGated> GetId(long id, bool includeJoins, CancellationToken cancellationToken); + /// + /// Gets the with a given . + /// + /// The result type after projection. + /// The of the . + /// The for the operation. + /// A for . + RequirementsGated> GetId(long id, CancellationToken cancellationToken) + where TResult : notnull; + /// /// Gets all registered s. /// diff --git a/src/Tgstation.Server.Host/Authority/UserGroupAuthority.cs b/src/Tgstation.Server.Host/Authority/UserGroupAuthority.cs index 27ea03feda..78c643a328 100644 --- a/src/Tgstation.Server.Host/Authority/UserGroupAuthority.cs +++ b/src/Tgstation.Server.Host/Authority/UserGroupAuthority.cs @@ -111,6 +111,23 @@ namespace Tgstation.Server.Host.Authority return new AuthorityResponse(userGroup); }); + /// + public RequirementsGated> GetId(long id, CancellationToken cancellationToken) + where TResult : notnull + => new( + () => Flag(AdministrationRights.ReadUsers), + () => Projectable.Create( + QueryableImpl(true) + .Where(x => x.Id == id), + projectable => + { + if (projectable == null) + return Gone(); + + return new AuthorityResponse(projectable.Result); + }, + cancellationToken)); + /// public RequirementsGated> Read(CancellationToken cancellationToken) where TResult : notnull