mirror of
https://github.com/streetwriters/notesnook-sync-server.git
synced 2026-02-12 19:22:45 +00:00
global: add null safety checks
This commit is contained in:
@@ -10,5 +10,8 @@ namespace System.Security.Claims
|
||||
private readonly static string[] SUBSCRIBED_CLAIMS = ["believer", "education", "essential", "pro", "legacy_pro"];
|
||||
public static bool IsUserSubscribed(this ClaimsPrincipal user)
|
||||
=> user.Claims.Any((c) => c.Type == "notesnook:status" && SUBSCRIBED_CLAIMS.Contains(c.Value));
|
||||
|
||||
public static string GetUserId(this ClaimsPrincipal user)
|
||||
=> user.FindFirstValue("sub") ?? throw new Exception("User ID not found in claims.");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user