Initial Commit ...
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
using System.Linq;
|
||||
using xCommons.Extensions;
|
||||
using xIdentityModels.Models;
|
||||
using xIdentityModels.Interfaces;
|
||||
|
||||
namespace xIdentityModels.Providers {
|
||||
public class XDefaultUserRoleHelper : IXUserRoleHelper {
|
||||
public bool canReadCriticalData (XUserClaimsInfoDto userInfo) {
|
||||
return isInRole (userInfo, "admin");
|
||||
}
|
||||
|
||||
public bool canDoDangerousAction (XUserClaimsInfoDto userInfo) {
|
||||
return isInRole (userInfo, "admin");
|
||||
}
|
||||
|
||||
public bool isInRole (XUserClaimsInfoDto userInfo, string role) {
|
||||
return userInfo.Roles
|
||||
.Any (r =>
|
||||
r.ToNormalString () == role.ToNormalString ()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user