Exemplo n.º 1
0
        public IEnumerable <string> GetOperator(OperateRightEventArgs e)
        {
            IFunctionRight funcRight = WebGlobalVariable.SessionGbl.AppRight.FunctionRight;

            TkDebug.AssertNotNull(funcRight, "系统没有配置功能权限", this);

            return(funcRight.GetSubFunctions(FunctionKey));
        }
Exemplo n.º 2
0
        public WebAppRight(IAppRightBuilder builder)
        {
            TkDebug.AssertArgumentNull(builder, nameof(builder), null);

            var empty = EmptyAppRightBuilder.Instance;

            fLogOnRight    = builder.CreateLogOnRight() ?? empty.CreateLogOnRight();
            fFunctionRight = builder.CreateFunctionRight() ?? empty.CreateFunctionRight();
            fScriptBuilder = builder.CreateScriptBuilder() ?? empty.CreateScriptBuilder();
        }
Exemplo n.º 3
0
        public override IEnumerable <string> GetOperator(OperateRightEventArgs e)
        {
            var result = base.GetOperator(e);

            if (result == null)
            {
                return(null);
            }
            IFunctionRight funcRight = WebGlobalVariable.SessionGbl.AppRight.FunctionRight;

            TkDebug.AssertNotNull(funcRight, "系统没有配置功能权限", this);
            var nextResult = from item in result
                             where funcRight.IsSubFunction(item, FunctionKey)
                             select item;

            return(nextResult);
        }
Exemplo n.º 4
0
        protected void CheckFunctionRight()
        {
            ISupportFunction functionSource = Source as ISupportFunction;

            if (functionSource != null)
            {
                IFunctionRight functionRight = SessionGbl.AppRight.FunctionRight;
                switch (functionSource.FunctionType)
                {
                case FunctionRightType.Admin:
                    if (!functionRight.IsAdmin())
                    {
                        throw new NoFunctionRightException();
                    }
                    break;

                case FunctionRightType.Function:
                    if (!functionRight.IsFunction(functionSource.FunctionKey))
                    {
                        throw new NoFunctionRightException();
                    }
                    break;

                case FunctionRightType.SubFunction:
                    if (Style.Style == PageStyle.List || Style.Style == PageStyle.Detail ||
                        MetaDataUtil.Equals(Style, DbListSource.TabStyle))
                    {
                        // List和Detail不禁止子功能权限,子功能权限主要控制Insert,Update这些操作。如果想禁止查看数据,考虑使用DataRight过滤
                        break;
                    }
                    var subKey = GetSubFunctionKey();
                    if (!functionRight.IsSubFunction(subKey, functionSource.FunctionKey))
                    {
                        throw new NoFunctionRightException();
                    }
                    break;

                case FunctionRightType.None:
                    break;
                }
            }
        }