Class PermissionGroup
- Namespace
- Uncreated.Warfare.Players.Permissions
- Assembly
- Uncreated.Warfare.dll
Group of permission branches that can be assigned to multiple players.
[JsonConverter(typeof(PermissionGroupJsonConverter))]
public sealed class PermissionGroup : IReadOnlyList<PermissionBranch>, IReadOnlyCollection<PermissionBranch>, IEnumerable<PermissionBranch>, IEnumerable, ITranslationArgument
- Inheritance
-
PermissionGroup
- Implements
- Inherited Members
- Extension Methods
Constructors
PermissionGroup(string, string, Color, int, IEnumerable<PermissionBranch>)
public PermissionGroup(string id, string displayName, Color color, int priority, IEnumerable<PermissionBranch> permissions)
Parameters
idstringdisplayNamestringcolorColorpriorityintpermissionsIEnumerable<PermissionBranch>
Properties
Color
Group display color.
[JsonPropertyName("color")]
public Color Color { get; }
Property Value
- Color
Count
Gets the number of elements in the collection.
public int Count { get; }
Property Value
- int
The number of elements in the collection.
DisplayName
Group display name.
[JsonPropertyName("name")]
public string DisplayName { get; }
Property Value
Id
Unique id.
[JsonPropertyName("id")]
public string Id { get; }
Property Value
this[int]
Gets the element at the specified index in the read-only list.
public PermissionBranch this[int index] { get; }
Parameters
indexintThe zero-based index of the element to get.
Property Value
- PermissionBranch
The element at the specified index in the read-only list.
Permissions
List of all permissions in the group.
[JsonPropertyName("permissions")]
public IReadOnlyList<PermissionBranch> Permissions { get; }
Property Value
Priority
Group priority, higher is used first.
[JsonPropertyName("priority")]
public int Priority { get; }
Property Value
Methods
AddPermission(PermissionBranch)
public bool AddPermission(PermissionBranch branch)
Parameters
branchPermissionBranch
Returns
Equals(object?)
Determines whether the specified object is equal to the current object.
public override bool Equals(object? obj)
Parameters
objobjectThe object to compare with the current object.
Returns
GetEnumerator()
Returns an enumerator that iterates through the collection.
public IEnumerator<PermissionBranch> GetEnumerator()
Returns
- IEnumerator<PermissionBranch>
An enumerator that can be used to iterate through the collection.
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current object.
ReadJson(ref Utf8JsonReader, JsonSerializerOptions)
public static PermissionGroup? ReadJson(ref Utf8JsonReader reader, JsonSerializerOptions options)
Parameters
readerUtf8JsonReaderoptionsJsonSerializerOptions
Returns
ReadPermissionGroup(ByteReader)
public static PermissionGroup ReadPermissionGroup(ByteReader reader)
Parameters
readerByteReader
Returns
RemovePermission(PermissionBranch)
public bool RemovePermission(PermissionBranch permission)
Parameters
permissionPermissionBranch
Returns
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
Translate(ITranslationValueFormatter, in ValueFormatParameters)
Allows objects to define how they're translated in their own definition instead of creating a value converter.
public string Translate(ITranslationValueFormatter formatter, in ValueFormatParameters parameters)
Parameters
formatterITranslationValueFormatterparametersValueFormatParameters
Returns
UpdateFrom(PermissionGroup)
public void UpdateFrom(PermissionGroup other)
Parameters
otherPermissionGroup
WriteJson(Utf8JsonWriter, PermissionGroup?, JsonSerializerOptions)
public static void WriteJson(Utf8JsonWriter writer, PermissionGroup? value, JsonSerializerOptions options)
Parameters
writerUtf8JsonWritervaluePermissionGroupoptionsJsonSerializerOptions
WritePermissionGroup(ByteWriter, PermissionGroup)
public static void WritePermissionGroup(ByteWriter writer, PermissionGroup group)
Parameters
writerByteWritergroupPermissionGroup
Operators
operator ==(PermissionGroup?, object?)
public static bool operator ==(PermissionGroup? left, object? right)
Parameters
leftPermissionGrouprightobject
Returns
operator !=(PermissionGroup?, object?)
public static bool operator !=(PermissionGroup? left, object? right)
Parameters
leftPermissionGrouprightobject