using System; using System.Collections.Generic; using System.Linq; namespace Alkami.Ops.Certificates.SecretServer.Models { internal class Secret { public int ID; public string Name; public int SecretTemplateID; public int FolderID = -1; public bool Active; public List Items; public int? LauncherConnectAsSecretID; public int? CheckOutMinutesRemaining; public bool? CheckedOut; public string CheckOutUserDisplayName; public int? CheckOutUserID; public bool IsRestricted; public bool IsOutOfSync; public string OutOfSyncReason; public bool? AutoChangeEnabled; public bool? AutoChangeNextPassword; public bool? RequiresApprovalForAccess; public bool? RequiresComment; public bool? CheckOutEnabled; public int? CheckOutIntervalMinutes; public bool? CheckOutChangePasswordEnabled; public int? AccessRequestWorkflowMapID; public bool? ProxyEnabled; public bool? SessionRecordingEnabled; public bool? RestrictSshCommands; public bool? AllowOwnersUnrestrictedSshCommands; public bool? IsDoubleLock; public int? DoubleLockId; public bool? EnableInheritPermissions; public int? PasswordTypeWebScriptID; public int? SiteID; public bool? EnableInheritSecretPolicy; public int? SecretPolicyID; public string LastHeartBeatStatus; public DateTime? LastHeartBeatCheck; public int? FailedPasswordChangeAttempts; public DateTime? LastPasswordChangeAttempt; public string SecretTemplateName; public string LastAccessed; /// /// Sets string field values that are not files. /// /// The secret field to set. /// public string this[string field] { get { if (Items != null) { return Items.Where(f => !f.IsFile && string.Equals(f.FieldName.Trim(), field, StringComparison.OrdinalIgnoreCase)).First().ItemValue; } else { return null; } } set { if (Items == null) { Items = new List(); } Items.Where(f => !f.IsFile && string.Equals(f.FieldName.Trim(), field, StringComparison.OrdinalIgnoreCase)).First().ItemValue = value; } } } }