Initial Commit ...

This commit is contained in:
2024-01-25 04:42:47 +03:30
commit 844b4c47ad
50 changed files with 2615 additions and 0 deletions
+23
View File
@@ -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 ()
);
}
}
}