Esempio n. 1
0
        /// <summary>
        /// 更新权限设置
        /// </summary>
        /// <param name="nodeId">权限节点</param>
        protected void UpdateAccessControl(T_GroupEntity data)
        {
            String sql = "SELECT * FROM [T_AccessControl] WHERE tablename='t_group' AND node=" + data.ID;
            List <T_AccessControlEntity> acc = db.ExecuteObject <List <T_AccessControlEntity> >(sql);

            foreach (T_AccessControlEntity node in acc)
            {
                List <ActionType> items = ActionTypeHelper.GetValueItem(node.ActionType);
                foreach (ActionType n in items)
                {
                    if (!data.ActionType.HasFlag(n))
                    {
                        node.ActionType = ActionTypeHelper.RemoveACLoptions(node.ActionType, n);
                    }
                }
            }

            db.ExecuteCommand <List <T_AccessControlEntity> >(acc, CmdType.UPDATE);
        }
Esempio n. 2
0
        /// <summary>
        /// 更新权限设置
        /// </summary>
        /// <param name="nodeId">权限节点</param>
        protected void UpdateAccessControl(T_SiteMenuEntity data)
        {
            String strSql = "SELECT * FROM [T_AccessControl] WHERE tablename='t_sitemenu' AND node=" + data.ID;
            List <T_AccessControlEntity> acc = db.ExecuteObject <List <T_AccessControlEntity> >(strSql);

            foreach (T_AccessControlEntity node in acc)
            {
                List <ActionType> items = ActionTypeHelper.GetValueItem(node.ActionType);
                foreach (ActionType n in items)
                {
                    if (!data.ActionType.HasFlag(n))
                    {
                        node.ActionType = ActionTypeHelper.RemoveACLoptions(node.ActionType, n);
                    }
                }
            }

            db.ExecuteCommand <List <T_AccessControlEntity> >(acc, CmdType.UPDATE);

            CacheHelper.Delete(ISessionKeys.cache_table_accesscontrol);
        }