/// <summary>
        /// 删除授权节点
        /// </summary>
        /// <param name="node">授权节点</param>
        public void Delete(AuthorizationNode node)
        {
            IList <AuthorizationNode> lns = db.Query <AuthorizationNode>((AuthorizationNode an) => an.AuthorizationUri == node.AuthorizationUri);

            foreach (AuthorizationNode an in lns)
            {
                db.Delete(an); // 删除所有授权节点
            }
        }
Example #2
0
        /// <summary>
        /// 从数据库恢复列表布局信息
        /// </summary>
        /// <param name="user">用户</param>
        /// <param name="module">模块</param>
        /// <param name="appUri">应用程序路径</param>
        /// <returns>如果存在列表布局信息则返回其布局信息否则为空</returns>
        public Layout RestoreLayout(string user, string appUri)
        {
            IList <Layout> layouts = db.Query <Layout>(lay =>
                                                       lay.User == user && lay.AppUri == appUri);

            if (layouts.Count > 0)
            {
                return(layouts[0]);
            }
            else
            {
                // 如果不存在用户定义的布局信息则加载管理员的布局
                layouts = db.Query <Layout>(lay =>
                                            lay.User == DEFAULT_USER && lay.AppUri == appUri);
                if (layouts.Count > 0)
                {
                    return(layouts[0]);
                }
            }
            return(null);
        }
Example #3
0
        /// <summary>
        /// 保存操作命令
        /// </summary>
        /// <param name="command">命令</param>
        public void Save(AuthorizationCommand command)
        {
            Delete(command);

            // 为操作指定一个唯一的序号
            if (command.Sequence == -1)
            {
                IList <AuthorizationCommand> lcs = db.Query <AuthorizationCommand>((AuthorizationCommand cmd) => cmd.Category == command.Category);
                command.Sequence = lcs.Count + 1;
            }
            db.Store(command);
        }