diff options
| author | Jake Mannens <jake@asger.xyz> | 2023-10-05 15:53:02 +1100 |
|---|---|---|
| committer | Jake Mannens <jake@asger.xyz> | 2023-10-05 15:53:02 +1100 |
| commit | 3d5f6e47bd74ce77d5ec253f51b7cef1b42099ef (patch) | |
| tree | 26add459f06b46ed74bfb0b6788b258d2dd11b3d /Pages/Component/AclDialog.razor | |
| parent | aa0b68f7648bd5a7c14b64737a4f8d3e402bfce5 (diff) | |
Continued to refine ACLDialog
Diffstat (limited to 'Pages/Component/AclDialog.razor')
| -rw-r--r-- | Pages/Component/AclDialog.razor | 97 |
1 files changed, 59 insertions, 38 deletions
diff --git a/Pages/Component/AclDialog.razor b/Pages/Component/AclDialog.razor index 87fbd6e..6df9320 100644 --- a/Pages/Component/AclDialog.razor +++ b/Pages/Component/AclDialog.razor @@ -2,50 +2,71 @@ @inject IDbContextFactory<HBContext> dbFactory; @implements IDialog -<Dialog WidthPixels=900 Title="Edit permissions" @ref=dialog> - <div class="container"> - <div> - @if(obj?.Acl is not null) { - <table class="data-table"> - <tr> - <th>Action</th> - <th>Subject</th> - <th colspan="2">Permissions</th> - </tr> - @foreach(var rule in obj.Acl.Rules.OrderByDescending(r => r.Action)) { +<Dialog HeightPixels=500 WidthPixels=900 Title="Edit permissions" @ref=dialog> + <div class="vcontainer"> + <div class="hcontainer"> + <div> + @if(obj?.Acl is not null) { + <label> + Owner + <input type="text" autocomplete="off"/> + </label> + <table class="data-table"> <tr> - <td><div><AclActionSwitch InitialValue=@(rule.Action == AclRuleAction.Allow)/></div></td> - <td> - <a class="nondecorated" href="javascript:;">@(WellKnownSid.TranslateSid(rule.Principal) ?? rule.Principal.ToString())</a> - </td> - <td>@GetActivePermissions(rule)</td> - <td> - <a title="Edit" href="javascript:;">🖉</a> - <a title="Delete" href="javascript:;">✖</a> - </td> + <th>Action</th> + <th>Subject</th> + <th colspan="2">Permissions</th> </tr> + @foreach(var rule in obj.Acl.Rules.OrderByDescending(r => r.Action)) { + <tr> + <td><div><AclActionSwitch InitialValue=@(rule.Action == AclRuleAction.Allow)/></div></td> + <td> + @(WellKnownSid.TranslateSid(rule.Principal) ?? rule.Principal.ToString()) + </td> + <td>@GetActivePermissions(rule)</td> + <td> + <a title="Edit" href="javascript:;">🖉</a> + <a title="Delete" href="javascript:;">✖</a> + </td> + </tr> + } + </table> + <br/> + <center><a href="javascript:;">Add new</a></center> + } else { + <p><i>This item does not have any permissions set!</i></p> + } + </div> + <div> + @if(obj?.Acl is not null) { + <div class="principal-select"> + <label> + Subject + <input type="text" autocomplete="off"/> + </label> + <button>Submit</button> + </div> + var permissions = Acl.GetPermissionDescriptions(obj) + .OrderByDescending(kv => BitOperations.PopCount(kv.Value)) + .ThenBy(kv => kv.Value); + foreach(var kv in permissions) { + <label> + <input type="checkbox"/> + @kv.Key + </label> } - </table> - <br/> - <center><a href="javascript:;">Add new</a></center> - } else { - <center><i>This item does not have any permissions set!</i></center> - } - </div> - <div> - <p><i>Click Edit next to an ACL to edit it's permissions</i></p> + } else { + <p><i>Click Edit next to an ACL to edit it's permissions</i></p> + } + </div> </div> - </div> - @if(obj?.Acl is not null) { - <ButtonContainer> - <button class="secondary" @onclick=Hide>Cancel</button> - <button data-keyboard-shortcut="a" @onclick=Hide><u>A</u>pply</button> - </ButtonContainer> - } else { <ButtonContainer> <button class="secondary" @onclick=Hide>Cancel</button> + @if(obj?.Acl is not null) { + <button data-keyboard-shortcut="a" @onclick=Hide><u>A</u>pply</button> + } </ButtonContainer> - } + </div> </Dialog> @code { @@ -109,7 +130,7 @@ return string.Join(", ", perms .OrderByDescending(kv => BitOperations.PopCount(kv.Value)) - .ThenByDescending(kv => kv.Value) + .ThenBy(kv => kv.Value) .Select(kv => kv.Key)); } }
\ No newline at end of file |
