From 54e2afd7a12fb705d10163032ac065b00fb7840c Mon Sep 17 00:00:00 2001 From: Halil ibrahim Kalkan Date: Thu, 3 Jan 2019 09:05:19 +0300 Subject: [PATCH] Added CurrentUser.GetAllClaims() --- .../src/Volo.Abp.Security/Volo/Abp/Users/CurrentUser.cs | 5 +++++ .../src/Volo.Abp.Security/Volo/Abp/Users/ICurrentUser.cs | 3 +++ 2 files changed, 8 insertions(+) diff --git a/framework/src/Volo.Abp.Security/Volo/Abp/Users/CurrentUser.cs b/framework/src/Volo.Abp.Security/Volo/Abp/Users/CurrentUser.cs index 884c9078f1..c785f951fd 100644 --- a/framework/src/Volo.Abp.Security/Volo/Abp/Users/CurrentUser.cs +++ b/framework/src/Volo.Abp.Security/Volo/Abp/Users/CurrentUser.cs @@ -46,6 +46,11 @@ namespace Volo.Abp.Users return _principalAccessor.Principal?.Claims.Where(c => c.Type == claimType).ToArray() ?? EmptyClaimsArray; } + public virtual Claim[] GetAllClaims() + { + return _principalAccessor.Principal?.Claims.ToArray() ?? EmptyClaimsArray; + } + public bool IsInRole(string roleName) { return FindClaims(AbpClaimTypes.Role).Any(c => c.Value == roleName); diff --git a/framework/src/Volo.Abp.Security/Volo/Abp/Users/ICurrentUser.cs b/framework/src/Volo.Abp.Security/Volo/Abp/Users/ICurrentUser.cs index d2aebf8e93..18613406d8 100644 --- a/framework/src/Volo.Abp.Security/Volo/Abp/Users/ICurrentUser.cs +++ b/framework/src/Volo.Abp.Security/Volo/Abp/Users/ICurrentUser.cs @@ -35,6 +35,9 @@ namespace Volo.Abp.Users [NotNull] Claim[] FindClaims(string claimType); + [NotNull] + Claim[] GetAllClaims(); + bool IsInRole(string roleName); } }