Skip to content

Commit

Permalink
Secret class - rework GetFileFields() method fixes #203
Browse files Browse the repository at this point in the history
  • Loading branch information
wsmelton committed Jul 21, 2021
1 parent 214da74 commit 25e7b6b
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/Thycotic.SecretServer/classes/secrets/Secret.cs
@@ -1,5 +1,6 @@
using System;
using System.Security;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Management.Automation;
using System.Management.Automation.Runspaces;
Expand Down Expand Up @@ -114,18 +115,22 @@ public void SetFieldValue(string SlugName, string NewValue)
}
}

public object GetFileFields()
public List<FileField> GetFileFields()
{
PSObject fileDetails = new PSObject();
List<FileField> files = new List<FileField>();
foreach (var item in this.Items)
{
if (item.IsFile)
{
fileDetails.Properties.Add(new PSNoteProperty("SlugName", item.Slug));
fileDetails.Properties.Add(new PSNoteProperty("Filename", item.Filename));
files.Add(new FileField { SlugName = item.Slug, Filename = item.Filename });
}
}
return fileDetails;
return files;
}
public class FileField
{
public string SlugName { get; set; }
public string Filename { get; set; }
}
}
}

0 comments on commit 25e7b6b

Please sign in to comment.