完成权限点对点
This commit is contained in:
@@ -1040,9 +1040,14 @@ namespace Yi.Framework.Core
|
||||
|
||||
public bool SetEntryInHash<T>(string hashId, string key, T value)
|
||||
{
|
||||
|
||||
return this.TryCatch<bool>(() => this.client.SetEntryInHash(hashId, key, TextExtensions.SerializeToString<T>(value)), hashId);
|
||||
}
|
||||
|
||||
public bool SetEntryInHash<T>(string hashId, string key, T value, TimeSpan expiresIn)
|
||||
{
|
||||
|
||||
return this.TryCatch<bool>(() => this.client.SetEntryInHash(hashId, key, TextExtensions.SerializeToString<T>(value)), hashId);
|
||||
}
|
||||
public T GetValueFromHash<T>(string hashId, string key)
|
||||
{
|
||||
return this.TryCatch<T>(() => JsonSerializer.DeserializeFromString<T>(this.client.GetValueFromHash(hashId, key)), hashId);
|
||||
|
||||
@@ -37,10 +37,11 @@ namespace Yi.Framework.Core
|
||||
claims.Add(new Claim(JwtRegisteredClaimNames.Exp, $"{new DateTimeOffset(DateTime.Now.AddMinutes(30)).ToUnixTimeSeconds()}"));
|
||||
claims.Add(new Claim(ClaimTypes.Name, _user.user.username));
|
||||
claims.Add(new Claim(ClaimTypes.Sid, _user.user.id.ToString()));
|
||||
foreach (var k in _user?.menuIds)
|
||||
{
|
||||
claims.Add(new Claim("menuIds",k.id.ToString()));
|
||||
}
|
||||
//现在不存放在jwt中,而存放在redis中
|
||||
//foreach (var k in _user?.menuIds)
|
||||
//{
|
||||
// claims.Add(new Claim("menuIds",k.id.ToString()));
|
||||
//}
|
||||
foreach (var k in _user.user.roles)
|
||||
{
|
||||
claims.Add(new Claim(ClaimTypes.Role, k.role_name));
|
||||
|
||||
Reference in New Issue
Block a user