实现权限访问控制列表
This commit is contained in:
1 parent
5a170f3024
commit
258781bdc5
17 files changed
+557
-7
No files matched your search
@@ -0,0 +1,23 @@
|
||||
namespace HelloShop.ServiceDefaults.Authorization;
|
||||
|
||||
public class PermissionGrantCacheItem(bool isGranted = false)
|
||||
{
|
||||
public bool IsGranted { get; set; } = isGranted;
|
||||
|
||||
public static string CreateCacheKey(int roleId, string name, string? resourceType = null, string? resourceId = null)
|
||||
{
|
||||
string cacheKey = $"acl:role:{roleId}:{name}";
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(resourceType))
|
||||
{
|
||||
cacheKey += $":{resourceType}";
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(resourceId))
|
||||
{
|
||||
cacheKey += $":{resourceId}";
|
||||
}
|
||||
|
||||
return cacheKey;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user