Files
PSProxmoxVE/src/PSProxmoxVE.Core/Models/Users/PveRole.cs
T
Clint Branham 0532327d46 refactor: remove redundant System.Text.Json attributes from models
The codebase uses Newtonsoft.Json (JObject.Parse + ToObject<T>) exclusively.
Removed all [JsonPropertyName] attributes and [System.Text.Json.Serialization.
JsonIgnore] attributes from 41 model files, along with the now-unused
using System.Text.Json.Serialization imports. [JsonProperty] (Newtonsoft)
attributes remain as the sole serialization annotations.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 08:15:23 -05:00

38 lines
1.2 KiB
C#

using Newtonsoft.Json;
namespace PSProxmoxVE.Core.Models.Users;
/// <summary>
/// Represents a Proxmox VE role as returned by the /access/roles endpoint.
/// Roles are named collections of privileges that can be assigned to users or groups via ACLs.
/// </summary>
public class PveRole
{
/// <summary>
/// The unique role identifier (e.g., "Administrator", "PVEVMAdmin", "PVEDatastoreUser").
/// </summary>
[JsonProperty("roleid")]
public string RoleId { get; set; } = string.Empty;
/// <summary>
/// Comma-separated list of privilege strings assigned to this role
/// (e.g., "VM.Allocate,VM.Config.Disk,Datastore.AllocateSpace").
/// </summary>
[JsonProperty("privs")]
public string? Privileges { get; set; }
/// <summary>
/// Indicates whether this is a built-in / special role (1) that cannot be deleted,
/// or a custom role (0).
/// </summary>
[JsonProperty("special")]
public int? Special { get; set; }
/// <inheritdoc />
public override string ToString()
{
var specialStr = Special is 1 ? " [built-in]" : string.Empty;
return $"Role: {RoleId}{specialStr} | Privs: {Privileges ?? "none"}";
}
}