mirror of
https://github.com/GoodOlClint/PSProxmoxVE.git
synced 2026-08-09 13:59:24 +00:00
0532327d46
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>
38 lines
1.2 KiB
C#
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"}";
|
|
}
|
|
}
|