Remove PermissionAttribute.ComplexWrite

This commit is contained in:
Cyberboss
2018-04-04 16:51:45 -04:00
parent 1833623aa0
commit 7245881453
6 changed files with 11 additions and 22 deletions
@@ -5,8 +5,10 @@ namespace Tgstation.Server.Api.Models
/// <summary>
/// Represents a static game file. Create and delete actions uncerimonuously overwrite/delete files
/// </summary>
#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
{
/// <summary>
/// The path to the <see cref="Configuration"/> file
+1 -1
View File
@@ -29,7 +29,7 @@ namespace Tgstation.Server.Api.Models
/// <summary>
/// If the <see cref="Instance"/> is online
/// </summary>
[Permissions(ComplexWrite = true)]
[Permissions(WriteRight = InstanceManagerRights.SetOnline)]
public bool Online { get; set; }
}
}
@@ -12,7 +12,7 @@ namespace Tgstation.Server.Api.Models
/// <summary>
/// The origin URL. If <see langword="null"/>, the <see cref="Repository"/> does not exist
/// </summary>
[Permissions(ComplexWrite = true)]
[Permissions(WriteRight = RepositoryRights.SetOrigin)]
public string Origin { get; set; }
/// <summary>
@@ -24,7 +24,7 @@ namespace Tgstation.Server.Api.Models
/// <summary>
/// The branch or tag HEAD points to
/// </summary>
[Permissions(ComplexWrite = true)]
[Permissions(WriteRight = RepositoryRights.SetReference)]
public string Reference { get; set; }
/// <summary>
@@ -48,7 +48,7 @@ namespace Tgstation.Server.Api.Models
/// <summary>
/// Associated list of GitHub pull request number -> sha for merged pull requests. Adding a <see langword="null"/> value to this list will merge the latest commit of the pull request numbered by the key
/// </summary>
[Permissions(ComplexWrite = true)]
[Permissions(WriteRight = RepositoryRights.MergePullRequest)]
public Dictionary<int, string> PullRequests { get; set; }
/// <summary>
@@ -22,10 +22,5 @@ namespace Tgstation.Server.Api
/// If the field cannot be written to
/// </summary>
public bool DenyWrite { get; set; }
/// <summary>
/// If the field has multiple write permissions
/// </summary>
public bool ComplexWrite { get; set; }
}
}
@@ -31,18 +31,14 @@ namespace Tgstation.Server.Api.Rights
/// <summary>
/// User can online <see cref="Models.Instance"/>s they can view
/// </summary>
Online = 16,
/// <summary>
/// User can offline <see cref="Models.Instance"/>s they can view
/// </summary>
Offline = 32,
SetOnline = 16,
/// <summary>
/// User can delete <see cref="Models.Instance"/>s they can view
/// </summary>
Delete = 64,
Delete = 32,
/// <summary>
/// User can view all <see cref="Models.Instance"/>s
/// </summary>
List = 128
List = 64
}
}
@@ -45,16 +45,12 @@ namespace Tgstation.Server.Api.Rights
/// </summary>
ChangeCredentials = 256,
/// <summary>
/// User may reset the <see cref="Models.Repository"/>'s HEAD to the origin reference of whatever branch it is tracking
/// User may set <see cref="Models.Repository.Reference"/> to another git reference (not a SHA)
/// </summary>
Reset = 512,
SetReference = 512,
/// <summary>
/// User may read all fields in the <see cref="Models.Repository"/> with the exception of <see cref="Models.Repository.AccessToken"/>
/// </summary>
Read = 1024,
/// <summary>
/// User may set <see cref="Models.Repository.Reference"/> to a backup tag
/// </summary>
CheckoutBackup = 2048,
}
}