feat: Benutzerrollen und JWT-Konfiguration aktualisieren

- Benutzerrollen-Enums im Frontend aktualisiert, um die neuen Namenskonventionen für 'sDigital Data'-Rollen zu reflektieren.
- Neue Rollen in `JwtGlobals` für Digital Data-Administratoren und Benutzer hinzugefügt.
- Die Rolleneinstellungen in `LdapUser` erweitert, um neue Digital Data-Rollen einzubeziehen.
- `JwtMiddlewareOptionsHelper` modifiziert, um zusätzliche Rollen zu unterstützen und die JWT-Rollenliste entsprechend strukturiert.
This commit is contained in:
Developer 02
2024-08-27 11:58:50 +02:00
parent 1d8ae2c371
commit c362cb30e1
5 changed files with 15 additions and 5 deletions

View File

@@ -1,5 +1,6 @@
namespace HRD.LDAPService.JWT
{
//TODO: get this from config file (etc. appsettings.json)
public static class JwtGlobals
{
public const string HttpContextItem_LdapUser = "ldapuser";
@@ -15,5 +16,7 @@
public const string ROLE_DEPARTMENTMASTER = "DepartmentMaster";
public const string ROLE_MASTER = "Master";
public const string ROLE_ADMIN = "Admin";
public const string ROLE_DD_ADMIN = "sDigital Data - IIM-Administratoren";
public const string ROLE_DD_USER = "sDigital Data - IIM-Benutzer";
}
}

View File

@@ -145,11 +145,13 @@ namespace HRD.LDAPService
public static bool IsJwtGlobalsRole(string roleName)
{
//TODO: Import them from db or config (etc. appsettigns.json)
return string.Equals(roleName, JwtGlobals.ROLE_USER, StringComparison.OrdinalIgnoreCase)
|| string.Equals(roleName, JwtGlobals.ROLE_DEPARTMENTUSER, StringComparison.OrdinalIgnoreCase)
|| string.Equals(roleName, JwtGlobals.ROLE_DEPARTMENTMASTER, StringComparison.OrdinalIgnoreCase)
|| string.Equals(roleName, JwtGlobals.ROLE_MASTER, StringComparison.OrdinalIgnoreCase)
|| string.Equals(roleName, JwtGlobals.ROLE_ADMIN, StringComparison.OrdinalIgnoreCase);
|| string.Equals(roleName, JwtGlobals.ROLE_ADMIN, StringComparison.OrdinalIgnoreCase)
|| string.Equals(roleName, JwtGlobals.ROLE_DD_ADMIN, StringComparison.OrdinalIgnoreCase);
}
public void AddExtendedAttribute(string key, string value)
@@ -246,7 +248,7 @@ namespace HRD.LDAPService
break;
case EN_LdapRoleListFilter.OnlyRoleList:
if (IsJwtGlobalsRole(item.Role)) { resultList.Add(item.Role); }
if (IsJwtGlobalsRole(item.Role)){ resultList.Add(item.Role); }
break;
case EN_LdapRoleListFilter.OnlyWebAppRoleList: