📄 rulessecuritypermission.cs
字号:
using System;
using System.Data;
using System.Configuration;
using System.Security;
using System.Threading;
namespace Shokr.Security.RuleBasedSecurity
{
public class RulesSecurityPermission : IPermission
{
private string _rule;
public string Rule
{
get
{
return this._rule;
}
set
{
this._rule = value;
}
}
public RulesSecurityPermission(string roleName)
{
_rule = roleName;
}
void IPermission.Demand()
{
if (!SecurityProvider.IsUserInRule(Thread.CurrentPrincipal, Rule))
throw new SecurityException();
}
IPermission IPermission.Copy()
{
throw new Exception("The method or operation is not implemented.");
}
IPermission IPermission.Intersect(IPermission target)
{
throw new Exception("The method or operation is not implemented.");
}
bool IPermission.IsSubsetOf(IPermission target)
{
throw new Exception("The method or operation is not implemented.");
}
IPermission IPermission.Union(IPermission target)
{
throw new Exception("The method or operation is not implemented.");
}
#region ISecurityEncodable Members
void ISecurityEncodable.FromXml(SecurityElement e)
{
throw new Exception("The method or operation is not implemented.");
}
SecurityElement ISecurityEncodable.ToXml()
{
throw new Exception("The method or operation is not implemented.");
}
#endregion
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -