// Copyright Epic Games, Inc. All Rights Reserved.
using System;
using System.Collections.Generic;
using System.Text.Json;
#pragma warning disable CA2227
namespace EpicGames.Horde.Users
{
///
/// Response describing the current user
///
public class GetUserResponse
{
///
/// Id of the user
///
public UserId Id { get; set; }
///
/// Name of the user
///
public string Name { get; set; }
///
/// Avatar image URL (24px)
///
public string? Image24 { get; set; }
///
/// Avatar image URL (32px)
///
public string? Image32 { get; set; }
///
/// Avatar image URL (48px)
///
public string? Image48 { get; set; }
///
/// Avatar image URL (72px)
///
public string? Image72 { get; set; }
///
/// Email of the user
///
public string? Email { get; set; }
///
/// Claims for the user
///
public List? Claims { get; set; }
///
/// Whether to enable experimental features for this user
///
public bool? EnableExperimentalFeatures { get; set; }
///
/// Whether to always tag preflight changelists
///
public bool? AlwaysTagPreflightCL { get; set; }
///
/// Settings for the dashboard
///
public object? DashboardSettings { get; set; }
///
/// Settings for whether various dashboard features should be shown for the current user
///
public GetDashboardFeaturesResponse? DashboardFeatures { get; set; }
///
/// User job template preferences
///
public List? JobTemplateSettings { get; set; }
///
/// List of pinned job ids
///
public List? PinnedJobIds { get; set; }
///
/// List of pinned bisection task ids
///
public List? PinnedBisectTaskIds { get; set; }
///
/// Constructor
///
public GetUserResponse(UserId id, string name)
{
Id = id;
Name = name;
}
}
///
/// New claim document
///
public class GetUserClaimResponse
{
///
/// Type of the claim
///
public string Type { get; set; }
///
/// Value for the claim
///
public string Value { get; set; }
///
/// Constructor
///
public GetUserClaimResponse(string type, string value)
{
Type = type;
Value = value;
}
}
///
/// Resolved permissions for an action in a given ACL scope
///
public class UserAclPermission
{
///
/// Scope name
///
public string Scope { get; set; }
///
/// Action name
///
public string Action { get; set; }
///
/// Whether action is authorized in given scope
///
public bool IsAuthorized { get; set; }
///
/// Constructor
///
public UserAclPermission(string scope, string action, bool isAuthorized)
{
Scope = scope;
Action = action;
IsAuthorized = isAuthorized;
}
}
///
/// Resolved permissions for ACL scopes for a given user
///
public class GetUserAclPermissionsResponse
{
///
/// List of ACL permissions
///
public List AclPermissions { get; set; }
///
/// Constructor
///
public GetUserAclPermissionsResponse(List aclPermissions)
{
AclPermissions = aclPermissions;
}
}
///
/// Job template settings for the current user
///
public class GetJobTemplateSettingsResponse
{
///
/// The stream the job was run in
///
public string StreamId { get; set; }
///
/// The template id of the job
///
public string TemplateId { get; set; }
///
/// The hash of the template definition
///
public string TemplateHash { get; set; }
///
/// The arguments defined when creating the job
///
public List Arguments { get; set; }
///
/// The last update time of the job template
///
public DateTimeOffset UpdateTimeUtc { get; set; }
///
/// Constructor
///
public GetJobTemplateSettingsResponse(string streamId, string templateId, string templateHash, List arguments, DateTime updateTimeUtc)
{
StreamId = streamId;
TemplateId = templateId;
TemplateHash = templateHash;
Arguments = arguments;
UpdateTimeUtc = new DateTimeOffset(updateTimeUtc);
}
}
///
/// Settings for whether various features should be enabled on the dashboard
///
public class GetDashboardFeaturesResponse
{
///
/// Navigate to the landing page by default
///
public bool ShowLandingPage { get; set; }
///
/// Custom landing page route to direct users to
///
public string LandingPageRoute { get; set; } = String.Empty;
///
/// Enable CI functionality
///
public bool ShowCI { get; set; }
///
/// Whether to show functionality related to agents, pools, and utilization on the dashboard.
///
public bool ShowAgents { get; set; }
///
/// Whether to show the agent registration page. When using registration tokens from elsewhere this is not needed.
///
public bool ShowAgentRegistration { get; set; }
///
/// Show the Perforce server option on the server menu
///
public bool ShowPerforceServers { get; set; }
///
/// Show the device manager on the server menu
///
public bool ShowDeviceManager { get; set; }
///
/// Show automated tests on the server menu
///
public bool ShowTests { get; set; }
///
/// Whether the remote desktop button should be shown on the agent modal
///
public bool ShowAccounts { get; set; }
///
/// Whether the notice editor should be listed in the server menu
///
public bool ShowNoticeEditor { get; set; }
///
/// Whether controls for modifying pools should be shown
///
public bool ShowPoolEditor { get; set; }
///
/// Whether the remote desktop button should be shown on the agent modal
///
public bool ShowRemoteDesktop { get; set; }
}
///
/// Basic information about a user. May be embedded in other responses.
///
public class GetThinUserInfoResponse
{
///
/// Id of the user
///
public UserId Id { get; set; }
///
/// Name of the user
///
public string Name { get; set; }
///
/// The user's email address
///
public string? Email { get; set; }
///
/// The user login [DEPRECATED]
///
public string? Login { get; set; }
///
/// Constructor
///
public GetThinUserInfoResponse(UserId id, string name, string? email, string? login)
{
Id = id;
Name = name;
Email = email;
Login = login;
}
}
///
/// Request to update settings for a user
///
public class UpdateUserRequest
{
///
/// Whether to enable experimental features for this user
///
public bool? EnableExperimentalFeatures { get; set; }
///
/// Whether to always tag preflight CL
///
public bool? AlwaysTagPreflightCL { get; set; }
///
/// New dashboard settings
///
public JsonElement? DashboardSettings { get; set; }
///
/// Job ids to add to the pinned list
///
public List? AddPinnedJobIds { get; set; }
///
/// Jobs ids to remove from the pinned list
///
public List? RemovePinnedJobIds { get; set; }
///
/// Bisection task ids to add to the pinned list
///
public List? AddPinnedBisectTaskIds { get; set; }
///
/// Bisection task ids to remove from the pinned list
///
public List? RemovePinnedBisectTaskIds { get; set; }
}
}