Improved server share permission handling and share ui
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
using MoonlightServers.Frontend.Interfaces;
|
||||
using MoonlightServers.Frontend.Models;
|
||||
using MoonlightServers.Shared.Constants;
|
||||
using MoonlightServers.Shared.Http.Responses.Client.Servers;
|
||||
|
||||
namespace MoonlightServers.Frontend.Implementations;
|
||||
|
||||
public class DefaultPermissionProvider : IServerPermissionProvider
|
||||
{
|
||||
public Task<ServerPermission[]> GetPermissions(ServerDetailResponse server)
|
||||
{
|
||||
ServerPermission[] permissions = [
|
||||
new()
|
||||
{
|
||||
Identifier = ServerPermissionConstants.Console,
|
||||
Description = "Allows access to the console",
|
||||
DisplayName = "Console",
|
||||
Icon = "icon-square-terminal"
|
||||
},
|
||||
new()
|
||||
{
|
||||
Identifier = ServerPermissionConstants.Files,
|
||||
Description = "Allows access to the files",
|
||||
DisplayName = "Files",
|
||||
Icon = "icon-folder"
|
||||
},
|
||||
new()
|
||||
{
|
||||
Identifier = ServerPermissionConstants.Power,
|
||||
Description = "Allows actions like turning off the server and starting it",
|
||||
DisplayName = "Power",
|
||||
Icon = "icon-power"
|
||||
},
|
||||
new()
|
||||
{
|
||||
Identifier = ServerPermissionConstants.Settings,
|
||||
Description = "Gives permissions to perform re-installs or change other general settings",
|
||||
DisplayName = "Settings",
|
||||
Icon = "icon-settings"
|
||||
},
|
||||
new()
|
||||
{
|
||||
Identifier = ServerPermissionConstants.Shares,
|
||||
Description = "Dangerous! This allows control to the available shares and their access level for a server",
|
||||
DisplayName = "Shares",
|
||||
Icon = "icon-users"
|
||||
},
|
||||
new()
|
||||
{
|
||||
Identifier = ServerPermissionConstants.Variables,
|
||||
Description = "Allows access to the server software specific settings",
|
||||
DisplayName = "Variables",
|
||||
Icon = "icon-variable"
|
||||
}
|
||||
];
|
||||
|
||||
return Task.FromResult(permissions);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
using MoonlightServers.Frontend.Interfaces;
|
||||
using MoonlightServers.Frontend.Models;
|
||||
using MoonlightServers.Frontend.UI.Components.Servers.ServerTabs;
|
||||
using MoonlightServers.Shared.Constants;
|
||||
using MoonlightServers.Shared.Enums;
|
||||
using MoonlightServers.Shared.Http.Responses.Client.Servers;
|
||||
|
||||
namespace MoonlightServers.Frontend.Implementations;
|
||||
@@ -11,11 +13,11 @@ public class DefaultServerTabProvider : IServerTabProvider
|
||||
{
|
||||
ServerTab[] tabs =
|
||||
[
|
||||
ServerTab.CreateFromComponent<ConsoleTab>("Console", "console", 0, permission => permission.Identifier == "console"),
|
||||
ServerTab.CreateFromComponent<FilesTab>("Files", "files", 1, permission => permission.Identifier == "files"),
|
||||
ServerTab.CreateFromComponent<SharesTab>("Shares", "shares", 2, permission => permission.Identifier == "shares"),
|
||||
ServerTab.CreateFromComponent<VariablesTab>("Variables", "variables", 9, permission => permission.Identifier == "variables"),
|
||||
ServerTab.CreateFromComponent<SettingsTab>("Settings", "settings", 10, permission => permission.Identifier == "settings"),
|
||||
ServerTab.CreateFromComponent<ConsoleTab>("Console", "console", 0, ServerPermissionConstants.Console, ServerPermissionLevel.Read),
|
||||
ServerTab.CreateFromComponent<FilesTab>("Files", "files", 1, ServerPermissionConstants.Files, ServerPermissionLevel.Read),
|
||||
ServerTab.CreateFromComponent<SharesTab>("Shares", "shares", 2, ServerPermissionConstants.Shares, ServerPermissionLevel.ReadWrite),
|
||||
ServerTab.CreateFromComponent<VariablesTab>("Variables", "variables", 9, ServerPermissionConstants.Variables, ServerPermissionLevel.Read),
|
||||
ServerTab.CreateFromComponent<SettingsTab>("Settings", "settings", 10, ServerPermissionConstants.Settings, ServerPermissionLevel.Read),
|
||||
];
|
||||
|
||||
return Task.FromResult(tabs);
|
||||
|
||||
Reference in New Issue
Block a user