rulessecuritypermission.cs

来自「nice book for data mining」· CS 代码 · 共 71 行

CS
71
字号
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 + =
减小字号Ctrl + -
显示快捷键?