Table of Contents

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

id string
displayName string
color Color
priority int
permissions IEnumerable<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

string

Id

Unique id.

[JsonPropertyName("id")]
public string Id { get; }

Property Value

string

this[int]

Gets the element at the specified index in the read-only list.

public PermissionBranch this[int index] { get; }

Parameters

index int

The 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

IReadOnlyList<PermissionBranch>

Priority

Group priority, higher is used first.

[JsonPropertyName("priority")]
public int Priority { get; }

Property Value

int

Methods

AddPermission(PermissionBranch)

public bool AddPermission(PermissionBranch branch)

Parameters

branch PermissionBranch

Returns

bool

Equals(object?)

Determines whether the specified object is equal to the current object.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current object.

Returns

bool

true if the specified object is equal to the current object; otherwise, false.

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

reader Utf8JsonReader
options JsonSerializerOptions

Returns

PermissionGroup

ReadPermissionGroup(ByteReader)

public static PermissionGroup ReadPermissionGroup(ByteReader reader)

Parameters

reader ByteReader

Returns

PermissionGroup

RemovePermission(PermissionBranch)

public bool RemovePermission(PermissionBranch permission)

Parameters

permission PermissionBranch

Returns

bool

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

formatter ITranslationValueFormatter
parameters ValueFormatParameters

Returns

string

UpdateFrom(PermissionGroup)

public void UpdateFrom(PermissionGroup other)

Parameters

other PermissionGroup

WriteJson(Utf8JsonWriter, PermissionGroup?, JsonSerializerOptions)

public static void WriteJson(Utf8JsonWriter writer, PermissionGroup? value, JsonSerializerOptions options)

Parameters

writer Utf8JsonWriter
value PermissionGroup
options JsonSerializerOptions

WritePermissionGroup(ByteWriter, PermissionGroup)

public static void WritePermissionGroup(ByteWriter writer, PermissionGroup group)

Parameters

writer ByteWriter
group PermissionGroup

Operators

operator ==(PermissionGroup?, object?)

public static bool operator ==(PermissionGroup? left, object? right)

Parameters

left PermissionGroup
right object

Returns

bool

operator !=(PermissionGroup?, object?)

public static bool operator !=(PermissionGroup? left, object? right)

Parameters

left PermissionGroup
right object

Returns

bool