summaryrefslogtreecommitdiff
path: root/Pages/Component/MiniPrincipalSelect.razor
diff options
context:
space:
mode:
Diffstat (limited to 'Pages/Component/MiniPrincipalSelect.razor')
-rw-r--r--Pages/Component/MiniPrincipalSelect.razor44
1 files changed, 44 insertions, 0 deletions
diff --git a/Pages/Component/MiniPrincipalSelect.razor b/Pages/Component/MiniPrincipalSelect.razor
new file mode 100644
index 0000000..2202b95
--- /dev/null
+++ b/Pages/Component/MiniPrincipalSelect.razor
@@ -0,0 +1,44 @@
+@inject ISecurityService securityService
+
+<div>
+ @if(edit) {
+ <label>@Label</label>
+ <input type="text" autocomplete="off" @bind=name/>
+ <button class="secondary" @onclick=@(() => Edit(false))>Cancel</button>
+ <button @onclick=Submit>OK</button>
+ } else {
+ <label>@(Label):</label>
+ <a href="javascript:;" @onclick=@(() => Edit(true))>
+ @if(SecurityIdentifier is null || SecurityIdentifier == WellKnownSid.NullSid) {
+ <i>Please select a user or group</i>
+ } else {
+ @securityService.TranslateName(SecurityIdentifier)
+ }
+ </a>
+ }
+</div>
+
+@code {
+ [Parameter]
+ public string Label { get; set; }
+
+ [Parameter]
+ public EventCallback<SecurityIdentifier> OnChange { get; set; }
+
+ private bool edit = false;
+ private string name;
+
+ public SecurityIdentifier? SecurityIdentifier { get; set; }
+
+ private void Edit(bool enableEdit) {
+ edit = enableEdit;
+
+ if(enableEdit)
+ name = SecurityIdentifier is null ? "" :
+ securityService.TranslateName(SecurityIdentifier);
+ }
+
+ private void Submit() {
+ Edit(false);
+ }
+} \ No newline at end of file