AddAuditEntry() 공개 메소드

public AddAuditEntry ( SecretAuditEntry entry ) : void
entry SecretAuditEntry
리턴 void
예제 #1
0
        public override async Task Write(Secret secret, string clientOperation)
        {
            // Try to read the secret
            var existingSecret = await UnauditedReadSecret(secret.Name, GetFileName(secret.Name));

            // Try to undelete the secret, in case a deleted form exists
            if (existingSecret == null && await Undelete(secret.Name, clientOperation))
            {
                existingSecret = await UnauditedReadSecret(secret.Name, GetFileName(secret.Name));
            }

            if (existingSecret != null)
            {
                // Copy the new data and add audit records
                existingSecret.AddAuditEntry(await SecretAuditEntry.CreateForLocalUser(clientOperation, SecretAuditAction.Changed, existingSecret.Value));
                existingSecret.Update(secret);

                // Now resave the existing secret instead
                secret = existingSecret;
            }
            else
            {
                // Add an audit record
                secret.AddAuditEntry(await SecretAuditEntry.CreateForLocalUser(clientOperation, SecretAuditAction.Created));
            }

            // Write the secret
            await UnauditedWriteSecret(secret);
        }
예제 #2
0
        public override async Task Write(Secret secret, string clientOperation)
        {
            // Try to read the secret
            var existingSecret = await UnauditedReadSecret(secret.Name, GetFileName(secret.Name));
            
            // Try to undelete the secret, in case a deleted form exists
            if (existingSecret == null && await Undelete(secret.Name, clientOperation))
            {
                existingSecret = await UnauditedReadSecret(secret.Name, GetFileName(secret.Name));
            }

            if (existingSecret != null)
            {
                // Copy the new data and add audit records
                existingSecret.AddAuditEntry(await SecretAuditEntry.CreateForLocalUser(clientOperation, SecretAuditAction.Changed, existingSecret.Value));
                existingSecret.Update(secret);

                // Now resave the existing secret instead
                secret = existingSecret;
            }
            else
            {
                // Add an audit record
                secret.AddAuditEntry(await SecretAuditEntry.CreateForLocalUser(clientOperation, SecretAuditAction.Created));
            }

            // Write the secret
            await UnauditedWriteSecret(secret);
        }