feature: flag permissions

feature: flag permissions
This commit is contained in:
Gary Sharp
2025-07-20 10:45:55 +10:00
parent 7deead494b
commit be7ee4cae8
72 changed files with 5590 additions and 2109 deletions
+13 -5
View File
@@ -154,7 +154,7 @@ namespace Disco.Services.Users
AuthorizationLog.LogRoleCreated(role, CurrentUserId);
// Add to Cache
RoleCache.AddRole(role);
RoleCache.AddOrUpdateRole(role);
// Flush User Cache
Cache.FlushCache();
@@ -164,7 +164,7 @@ namespace Disco.Services.Users
public static void DeleteAuthorizationRole(DiscoDataContext Database, AuthorizationRole Role)
{
if (Role == null)
throw new ArgumentNullException("Role");
throw new ArgumentNullException(nameof(Role));
Database.AuthorizationRoles.Remove(Role);
Database.SaveChanges();
@@ -180,19 +180,27 @@ namespace Disco.Services.Users
public static void UpdateAuthorizationRole(DiscoDataContext Database, AuthorizationRole Role)
{
if (Role == null)
throw new ArgumentNullException("Role");
throw new ArgumentNullException(nameof(Role));
if (Database == null)
throw new ArgumentNullException("Database");
throw new ArgumentNullException(nameof(Database));
Database.SaveChanges();
// Update Role Cache
RoleCache.UpdateRole(Role);
RoleCache.AddOrUpdateRole(Role);
// Flush User Cache
Cache.FlushCache();
}
public static string GetAuthorizationRoleName(int roleId)
{
var role = RoleCache.GetRoleToken(roleId);
if (role == null)
return "Unknown authorization role";
return role.Role.Name;
}
public static IEnumerable<string> AdministratorSubjectIds
{
get