From 72458814532b50f69f107eed17366ab64adffb90 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Wed, 4 Apr 2018 16:51:45 -0400 Subject: [PATCH] Remove PermissionAttribute.ComplexWrite --- src/Tgstation.Server.Api/Models/Configuration.cs | 2 ++ src/Tgstation.Server.Api/Models/Instance.cs | 2 +- src/Tgstation.Server.Api/Models/Repository.cs | 6 +++--- src/Tgstation.Server.Api/PermissionsAttribute.cs | 5 ----- .../Rights/InstanceManagerRights.cs | 10 +++------- src/Tgstation.Server.Api/Rights/RepositoryRights.cs | 8 ++------ 6 files changed, 11 insertions(+), 22 deletions(-) diff --git a/src/Tgstation.Server.Api/Models/Configuration.cs b/src/Tgstation.Server.Api/Models/Configuration.cs index 8497408366..4b750c9e6a 100644 --- a/src/Tgstation.Server.Api/Models/Configuration.cs +++ b/src/Tgstation.Server.Api/Models/Configuration.cs @@ -5,8 +5,10 @@ namespace Tgstation.Server.Api.Models /// /// Represents a static game file. Create and delete actions uncerimonuously overwrite/delete files /// +#pragma warning disable CA1724 // System.Configuration name conflict [Model(RightsType.Configuration, CanCrud = true, CanList = true, RequiresInstance = true, ReadRight = ConfigurationRights.Read, WriteRight = ConfigurationRights.Write)] public sealed class Configuration +#pragma warning restore CA1724 // System.Configuration name conflict { /// /// The path to the file diff --git a/src/Tgstation.Server.Api/Models/Instance.cs b/src/Tgstation.Server.Api/Models/Instance.cs index cbe4334161..43d3eea404 100644 --- a/src/Tgstation.Server.Api/Models/Instance.cs +++ b/src/Tgstation.Server.Api/Models/Instance.cs @@ -29,7 +29,7 @@ namespace Tgstation.Server.Api.Models /// /// If the is online /// - [Permissions(ComplexWrite = true)] + [Permissions(WriteRight = InstanceManagerRights.SetOnline)] public bool Online { get; set; } } } diff --git a/src/Tgstation.Server.Api/Models/Repository.cs b/src/Tgstation.Server.Api/Models/Repository.cs index d4411e7d45..57c1a14f7d 100644 --- a/src/Tgstation.Server.Api/Models/Repository.cs +++ b/src/Tgstation.Server.Api/Models/Repository.cs @@ -12,7 +12,7 @@ namespace Tgstation.Server.Api.Models /// /// The origin URL. If , the does not exist /// - [Permissions(ComplexWrite = true)] + [Permissions(WriteRight = RepositoryRights.SetOrigin)] public string Origin { get; set; } /// @@ -24,7 +24,7 @@ namespace Tgstation.Server.Api.Models /// /// The branch or tag HEAD points to /// - [Permissions(ComplexWrite = true)] + [Permissions(WriteRight = RepositoryRights.SetReference)] public string Reference { get; set; } /// @@ -48,7 +48,7 @@ namespace Tgstation.Server.Api.Models /// /// Associated list of GitHub pull request number -> sha for merged pull requests. Adding a value to this list will merge the latest commit of the pull request numbered by the key /// - [Permissions(ComplexWrite = true)] + [Permissions(WriteRight = RepositoryRights.MergePullRequest)] public Dictionary PullRequests { get; set; } /// diff --git a/src/Tgstation.Server.Api/PermissionsAttribute.cs b/src/Tgstation.Server.Api/PermissionsAttribute.cs index fd35005dcb..7d4962758f 100644 --- a/src/Tgstation.Server.Api/PermissionsAttribute.cs +++ b/src/Tgstation.Server.Api/PermissionsAttribute.cs @@ -22,10 +22,5 @@ namespace Tgstation.Server.Api /// If the field cannot be written to /// public bool DenyWrite { get; set; } - - /// - /// If the field has multiple write permissions - /// - public bool ComplexWrite { get; set; } } } diff --git a/src/Tgstation.Server.Api/Rights/InstanceManagerRights.cs b/src/Tgstation.Server.Api/Rights/InstanceManagerRights.cs index 31a7eea0d3..a00d4ffedc 100644 --- a/src/Tgstation.Server.Api/Rights/InstanceManagerRights.cs +++ b/src/Tgstation.Server.Api/Rights/InstanceManagerRights.cs @@ -31,18 +31,14 @@ namespace Tgstation.Server.Api.Rights /// /// User can online s they can view /// - Online = 16, - /// - /// User can offline s they can view - /// - Offline = 32, + SetOnline = 16, /// /// User can delete s they can view /// - Delete = 64, + Delete = 32, /// /// User can view all s /// - List = 128 + List = 64 } } diff --git a/src/Tgstation.Server.Api/Rights/RepositoryRights.cs b/src/Tgstation.Server.Api/Rights/RepositoryRights.cs index a17ab1c6f8..80339d9d7f 100644 --- a/src/Tgstation.Server.Api/Rights/RepositoryRights.cs +++ b/src/Tgstation.Server.Api/Rights/RepositoryRights.cs @@ -45,16 +45,12 @@ namespace Tgstation.Server.Api.Rights /// ChangeCredentials = 256, /// - /// User may reset the 's HEAD to the origin reference of whatever branch it is tracking + /// User may set to another git reference (not a SHA) /// - Reset = 512, + SetReference = 512, /// /// User may read all fields in the with the exception of /// Read = 1024, - /// - /// User may set to a backup tag - /// - CheckoutBackup = 2048, } }