forked from DevExpress-Examples/XAF_Security_E4908
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCellEditTemplateBase.cs
21 lines (17 loc) · 972 Bytes
/
CellEditTemplateBase.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
using DevExpress.ExpressApp.Security;
using Microsoft.AspNetCore.Components;
namespace Blazor.ServerSide.Components {
public class CellEditTemplateBase<T> : ComponentBase {
[Parameter] public T CurrentObject { get; set; }
[Parameter] public string PropertyName { get; set; }
[Inject] private ISecurityProvider SecurityProvider { get; set; }
private SecurityStrategy Security { get; set; }
protected string ProtectedContent { get; } = "*******";
protected bool CanWrite => CurrentObject is null ? Security.CanWrite(typeof(T), PropertyName) : Security.CanWrite(CurrentObject, PropertyName);
protected bool CanRead => CurrentObject is null ? Security.CanRead(typeof(T), PropertyName) : Security.CanRead(CurrentObject, PropertyName);
protected override void OnInitialized() {
Security = (SecurityStrategy)SecurityProvider.GetSecurity();
base.OnInitialized();
}
}
}