ow
This commit is contained in:
commit
f05d2d215f
678 files changed
+73865
No files matched your search
@@ -0,0 +1,37 @@
|
||||
using CloudBuilder;
|
||||
using CloudBuilder.Gui;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
|
||||
namespace Krypton.Toolkit
|
||||
{
|
||||
public static class KryptonButtonExtensions
|
||||
{
|
||||
public static void Set(this KryptonButton kryptonButton,
|
||||
string permissionName,
|
||||
Operate permissionMode)
|
||||
{
|
||||
GetProvider().SetCustomAttribute(kryptonButton, permissionName, permissionMode);
|
||||
}
|
||||
|
||||
public static void Set(this KryptonButton kryptonButton, string permissionName, string dependentDetailName, Operate permissionMode)
|
||||
{
|
||||
GetProvider().SetCustomAttribute(kryptonButton, permissionName, dependentDetailName, permissionMode);
|
||||
}
|
||||
|
||||
public static void Set(this KryptonButton kryptonButton, string permissionName, string dependentDetailName)
|
||||
{
|
||||
GetProvider().SetCustomAttribute(kryptonButton, permissionName, dependentDetailName);
|
||||
}
|
||||
|
||||
public static BindingContextCustomAttribute GetCustomAttribute(this KryptonButton kryptonButton)
|
||||
{
|
||||
return GetProvider().GetCustomAttribute(kryptonButton);
|
||||
}
|
||||
|
||||
private static BindingContextAttributeProvider GetProvider()
|
||||
{
|
||||
return ServiceHelper.GetService<BindingContextAttributeProvider>() ??
|
||||
throw new InvalidOperationException("BindingContextAttributeProvider is not registered in the service GetProvider().");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user