last ...
This commit is contained in:
@@ -4,6 +4,7 @@ using xCommons.Extensions;
|
|||||||
using xIdentityModels.Configurations;
|
using xIdentityModels.Configurations;
|
||||||
using xIdentityModels.Constants;
|
using xIdentityModels.Constants;
|
||||||
using xIdentityModels.Dtos;
|
using xIdentityModels.Dtos;
|
||||||
|
using xIdentityModels.Models;
|
||||||
|
|
||||||
namespace xIdentityModels.Extensions
|
namespace xIdentityModels.Extensions
|
||||||
{
|
{
|
||||||
@@ -148,6 +149,29 @@ namespace xIdentityModels.Extensions
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Check Specified User Has Access to Provided Roles ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="source"></param>
|
||||||
|
/// <param name="roles"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static bool HasAccess(
|
||||||
|
this XUserClaimsInfoDto source,
|
||||||
|
string[] roles
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
var result =
|
||||||
|
!source.IsNullOrDefault() &&
|
||||||
|
source.Roles
|
||||||
|
.Any(r => roles
|
||||||
|
.Any(ar => r.ToNormalString()
|
||||||
|
.Contains(ar.ToNormalString())));
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Check Specified User Contains Specified UserSelectByParam or not ...
|
/// Check Specified User Contains Specified UserSelectByParam or not ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user