mirror of
https://github.com/LD-Reborn/Berufsschule_HAM.git
synced 2025-12-20 23:11:54 +00:00
Implemented Groups edit buttons
This commit is contained in:
@@ -6,15 +6,18 @@ namespace Berufsschule_HAM.Models;
|
||||
|
||||
public class GroupModel
|
||||
{
|
||||
[JsonPropertyName("Cn")]
|
||||
public required string Cn { get; set; }
|
||||
[JsonPropertyName("DisplayName")]
|
||||
public string DisplayName { get; set; }
|
||||
[JsonPropertyName("GidNumber")]
|
||||
public string? GidNumber { get; set; }
|
||||
[JsonPropertyName("Permissions")]
|
||||
public List<GroupPermission> Permissions { get; set; }
|
||||
public GroupModel(Dictionary<string, string> ldapData)
|
||||
{
|
||||
Cn = ldapData.GetValueOrDefault("cn") ?? throw new GroupModelConfigurationException();
|
||||
GidNumber = ldapData.GetValueOrDefault("gidNumber");
|
||||
DisplayName = ldapData.GetValueOrDefault("displayName") ?? Cn;
|
||||
string? descriptionValue = ldapData.GetValueOrDefault("description");
|
||||
if (descriptionValue is null)
|
||||
{
|
||||
@@ -22,13 +25,18 @@ public class GroupModel
|
||||
}
|
||||
else
|
||||
{
|
||||
Permissions = JsonSerializer.Deserialize<GroupPermissions>(descriptionValue)?.Permissions ?? [];
|
||||
GroupDescription? description = JsonSerializer.Deserialize<GroupDescription>(descriptionValue);
|
||||
DisplayName = description?.DisplayName ?? Cn;
|
||||
Permissions = description?.Permissions ?? [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class GroupPermissions
|
||||
public class GroupDescription
|
||||
{
|
||||
[JsonPropertyName("DisplayName")]
|
||||
public required string DisplayName { get; set; }
|
||||
[JsonPropertyName("Permissions")]
|
||||
public required List<GroupPermission> Permissions { get; set; }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user