Skip to content

Feature: Improved design of the security property pages #11855

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/Files.App/Filesystem/Security/AccessControlEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,17 @@ public AccessControlType AccessControlType
}
}

public string AccessControlTypeHumanized
=> AccessControlType switch
{
AccessControlType.Allow => "Allow",
_ => "Deny" // AccessControlType.Deny
};

public string AccessControlTypeGlyph
=> AccessControlType switch
{
AccessControlType.Allow => "\xF13E",
AccessControlType.Allow => "\xE73E",
_ => "\xF140" // AccessControlType.Deny
};

Expand Down
12 changes: 7 additions & 5 deletions src/Files.App/Filesystem/Security/Principal.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using CommunityToolkit.Mvvm.ComponentModel;
using Files.App.Extensions;
using System.Collections.Generic;
using System.Text;
using static Vanara.PInvoke.AdvApi32;
Expand All @@ -25,11 +24,14 @@ public string Glyph

public string? Name { get; set; }

public string DisplayName
=> string.IsNullOrEmpty(Name) ? "SecurityUnknownAccount".GetLocalizedResource() : Name;
public string? DisplayName
=> string.IsNullOrEmpty(Name) ? Sid : Name;

public string FullNameOrSid
=> string.IsNullOrEmpty(Name) ? Sid : string.IsNullOrEmpty(Domain) ? Name : $"{Domain}\\{Name}";
public string? FullNameOrSid
=> string.IsNullOrEmpty(Domain) ? Sid : $"{Domain}\\{Name}";

public string? FullNameHumanized
=> string.IsNullOrEmpty(Domain) ? string.Empty : $"({Domain}\\{Name})";

public List<string> Groups { get; set; }

Expand Down
19 changes: 11 additions & 8 deletions src/Files.App/Strings/en-US/Resources.resw
Original file line number Diff line number Diff line change
Expand Up @@ -1605,7 +1605,7 @@
<data name="Allow" xml:space="preserve">
<value>Allow</value>
</data>
<data name="SecurityDenyLabel.Text" xml:space="preserve">
<data name="Deny" xml:space="preserve">
<value>Deny</value>
</data>
<data name="SecurityFullControlLabel.Text" xml:space="preserve">
Expand Down Expand Up @@ -1639,7 +1639,7 @@
<value>You do not have permissions to view the security properties of this object. Click "Advanced permissions" to proceed.</value>
</data>
<data name="SecurityOwnerLabel.Text" xml:space="preserve">
<value>Owner</value>
<value>Owner:</value>
</data>
<data name="SecurityUnknownOwnerText.Text" xml:space="preserve">
<value>Unknown owner</value>
Expand Down Expand Up @@ -1677,11 +1677,11 @@
<data name="Access" xml:space="preserve">
<value>Access</value>
</data>
<data name="SecurityAdvancedAppliesToLabel.Text" xml:space="preserve">
<data name="SecurityAdvancedAppliesTo" xml:space="preserve">
<value>Applies to</value>
</data>
<data name="SecurityAdvancedEntityLabel.Text" xml:space="preserve">
<value>Entity</value>
<data name="Principal" xml:space="preserve">
<value>Principal</value>
</data>
<data name="SecurityAdvancedFlagsFilesLabel" xml:space="preserve">
<value>files</value>
Expand All @@ -1692,10 +1692,10 @@
<data name="SecurityAdvancedFlagsSubfoldersLabel" xml:space="preserve">
<value>subfolders</value>
</data>
<data name="SecurityAdvancedInheritedLabel.Text" xml:space="preserve">
<data name="Inherited" xml:space="preserve">
<value>Inherited</value>
</data>
<data name="SecurityAdvancedPermissionsLabel.Text" xml:space="preserve">
<data name="Permissions" xml:space="preserve">
<value>Permissions</value>
</data>
<data name="SecurityAdvancedCannotReadProperties.Text" xml:space="preserve">
Expand Down Expand Up @@ -2664,7 +2664,10 @@
<data name="ExitCompactOverlayDescription" xml:space="preserve">
<value>Exit compact overlay</value>
</data>
<data name="Change" xml:space="preserve">
<value>Change</value>
</data>
<data name="ToggleSelect" xml:space="preserve">
<value>Toggle Selection</value>
</data>
</root>
</root>
35 changes: 35 additions & 0 deletions src/Files.App/ViewModels/Properties/SecurityViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Files.App.Filesystem;
using Files.App.Filesystem.Security;
using Files.App.Helpers;
using Microsoft.UI.Xaml;
using System.Threading.Tasks;
using Windows.Storage;

Expand Down Expand Up @@ -60,8 +61,14 @@ public AccessControlEntry SelectedAccessControlEntry
get => _selectedAccessControlEntry;
set
{
if (_selectedAccessControlEntry is not null)
_selectedAccessControlEntry.IsSelected = false;

if (SetProperty(ref _selectedAccessControlEntry, value))
{
value.IsSelected = true;
RemoveAccessControlEntryCommand.NotifyCanExecuteChanged();
}
}
}

Expand Down Expand Up @@ -89,6 +96,34 @@ public string DisableInheritanceOption

private bool _preserveInheritance;

private GridLength _columnType = new(64d);
public GridLength ColumnType
{
get => _columnType;
set => SetProperty(ref _columnType, value);
}

private GridLength _columnPrincipal = new(200d);
public GridLength ColumnPrincipal
{
get => _columnPrincipal;
set => SetProperty(ref _columnPrincipal, value);
}

private GridLength _columnAccess = new(160d);
public GridLength ColumnAccess
{
get => _columnAccess;
set => SetProperty(ref _columnAccess, value);
}

private GridLength _columnInherited = new(70d);
public GridLength ColumnInherited
{
get => _columnInherited;
set => SetProperty(ref _columnInherited, value);
}

public RelayCommand ChangeOwnerCommand { get; set; }
public RelayCommand AddAccessControlEntryCommand { get; set; }
public RelayCommand RemoveAccessControlEntryCommand { get; set; }
Expand Down
Loading