仓库管理系统26--权限设置
原创不易,打字不易,截图不易,多多点赞,送人玫瑰,留有余香,财务自由明日实现

1、权限概述
在应用软件中,通常将软件的功能分为若干个子程序,通过主程序调用。那么,通过众多客户来说,如果设置各人的权限呢?软件系统的权限控制几乎是非常常见且必备的,这篇文章整理下常见的九种模型,几乎基本够你用了,主流的权限模型主要有以下9种:
1、ACL模型
访问控制列表
2、DAC模型
自主访问控制
3、MAC模型
强制访问控制
4、ABAC模型
基于属性的访问控制,更灵活复杂
5、RBAC模型
基于角色的权限访问控制,最常用
6、TBAC模型
基于任务和工作流的访问控制
7、T-RBAC模型
基于任务和角色的访问控制
8、OBAC模型
基于对象的访问控制
9、UCON模型
使用控制模型

2、权限实现
本项目没有采用复杂的权限管理,只采用最简单的操作方法,具体是根据不同角色隐藏或显示菜单,具体实现方法是:
1)创建转换器对象
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Data;namespace West.StoreMgr.Helper.Converter
{/// <summary>/// 菜单权限转换器/// </summary>public class AdminVisibleConverter : IValueConverter{public object Convert(object value, Type targetType, object parameter, CultureInfo culture){if (value == null) return Visibility.Collapsed;if (int.TryParse(value.ToString(), out int index)){return index == 0 ? Visibility.Visible : Visibility.Collapsed;}else{return Visibility.Collapsed;}}public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture){throw new NotImplementedException();}}
}

2、主界面引入转换器 
<Window x:Class="West.StoreMgr.MainWindow"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:d="http://schemas.microsoft.com/expression/blend/2008"xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"xmlns:local="clr-namespace:West.StoreMgr" xmlns:Control="clr-namespace:West.StoreMgr.Control"mc:Ignorable="d"DataContext="{Binding Source={StaticResource Locator},Path=Main}"WindowStartupLocation="CenterScreen"xmlns:converter="clr-namespace:West.StoreMgr.Helper.Converter"Title="欢迎使用仓库管理系统" Height="720" Width="1380"><Window.Resources><converter:AdminVisibleConverter x:Key="AdminVisibleConverter"/></Window.Resources><Grid><!--整体布局分为2行2列--><Grid.ColumnDefinitions><ColumnDefinition Width="276"/><ColumnDefinition/></Grid.ColumnDefinitions><Grid.RowDefinitions><RowDefinition Height="61"/><RowDefinition/></Grid.RowDefinitions><!--第1行第1列标识名称--><Grid Grid.Row="0" Grid.Column="0" Tag="标志" Background="#367FA8"><TextBlock Text="企业仓库管理系统" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#F6A518" FontSize="28"/></Grid><!--第1行第2列帐号信息--><Grid Grid.Row="0" Grid.Column="1" Tag="顶栏" Background="#3C8DBB"><Grid.ColumnDefinitions><ColumnDefinition/><ColumnDefinition/></Grid.ColumnDefinitions><StackPanel Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center" Orientation="Horizontal"><TextBlock Margin="10" FontSize="16" Text="" FontFamily="Fonts/#FontAwesome" Foreground="White" VerticalAlignment="Center"/><TextBlock Margin="0 10 0 10" FontSize="16" Text="欢迎" Foreground="White" VerticalAlignment="Center"/><TextBlock Margin="5 10 0 10" FontSize="16" Text="{Binding AppData.User.Name}" Foreground="White" VerticalAlignment="Center" Style="{StaticResource TextBoxBanberStyle}" MouseUp="TextBlock_MouseUp_2"/></StackPanel><StackPanel Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Center" Orientation="Horizontal" Margin="0 0 20 0"><TextBlock Margin="10" FontSize="16" Text="" FontFamily="Fonts/#FontAwesome" Foreground="White" VerticalAlignment="Center"/><TextBlock Margin="0 10 0 10" FontSize="16" Text="修改密码" Foreground="White" VerticalAlignment="Center" Style="{StaticResource TextBoxBanberStyle}" MouseUp="TextBlock_MouseUp_1"/><TextBlock Margin="10" FontSize="16" Text="" FontFamily="Fonts/#FontAwesome" Foreground="White" VerticalAlignment="Center"/><TextBlock Margin="0 10 0 10" FontSize="16" Text="退出系统" Foreground="White" Style="{StaticResource TextBoxBanberStyle}" MouseUp="TextBlock_MouseUp" /></StackPanel></Grid><!--第2行1列菜单--><Grid Grid.Row="1" Grid.Column="0" Tag="菜单"><Grid.RowDefinitions><RowDefinition Height="auto"/><RowDefinition/></Grid.RowDefinitions><Border Height="41" Background="#1A2327" VerticalAlignment="Center"><TextBlock Text="导航菜单" FontSize="20" Foreground="AntiqueWhite" VerticalAlignment="Center"/></Border><!--左侧主菜单--><ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto"><StackPanel Background="#222C32"><RadioButton x:Name="IndexView" Click="StoreView_Checked" Height="50" Content="控制台首页" FontSize="16" Tag="" Style="{DynamicResource RadioButtonMenuStyle}" Foreground="#85979F" /><!--基础数据菜单,加上权限设置--><Expander Background="#1D282B" ExpandDirection="Down" SnapsToDevicePixels="True" VerticalAlignment="Top" Style="{DynamicResource ExpanderStyle}" Visibility="{Binding AppData.User.Role,Converter={StaticResource AdminVisibleConverter}}"><Expander.Header><StackPanel Orientation="Horizontal" Height="50" Background="Transparent"><TextBlock Width="auto" Margin="10 0 10 0" Text="" FontFamily="Fonts/#FontAwesome" FontSize="22" Foreground="Red" VerticalAlignment="Center"></TextBlock><TextBlock Width="200" FontSize="18" Text="基础数据" Foreground="#918C8C" VerticalAlignment="Center"></TextBlock></StackPanel></Expander.Header><Expander.Content><StackPanel Background="#F6F8F8"><RadioButton x:Name="GoodsTypeView" Click="StoreView_Checked" Height="30" Content="物资设置" FontSize="16" Tag="" Style="{DynamicResource RadioButtonMenuStyle}" Foreground="#85979F" /><RadioButton x:Name="GoodsView" Click="StoreView_Checked" Height="30" Content="物资登记" FontSize="16" Tag="" Style="{DynamicResource RadioButtonMenuStyle}" Foreground="#85979F" /><RadioButton Name="SupplierView" Click="StoreView_Checked" Height="30" Content="供应商设置" FontSize="16" Tag="" Style="{DynamicResource RadioButtonMenuStyle}" Foreground="#85979F" /><RadioButton Name="CustomerView" Click="StoreView_Checked" Height="30" Content="客户管理" FontSize="16" Tag="" Style="{DynamicResource RadioButtonMenuStyle}" Foreground="#85979F" /><RadioButton x:Name="StoreView" Click="StoreView_Checked" Height="30" Content="仓库设置" FontSize="16" Tag="" Style="{DynamicResource RadioButtonMenuStyle}" Foreground="#85979F" /><RadioButton x:Name="SpecView" Click="StoreView_Checked" Height="30" Content="规格设置" FontSize="16" Tag="" Style="{DynamicResource RadioButtonMenuStyle}" Foreground="#85979F" /></StackPanel></Expander.Content></Expander><!--物品管理菜单--><Expander Background="#1D282B" ExpandDirection="Down" SnapsToDevicePixels="True" VerticalAlignment="Top" Style="{DynamicResource ExpanderStyle}"><Expander.Header><StackPanel Orientation="Horizontal" Height="50" Background="Transparent"><TextBlock Width="auto" Margin="10 0 10 0" Text="" FontFamily="Fonts/#FontAwesome" FontSize="22" Foreground="Red" VerticalAlignment="Center"></TextBlock><TextBlock Width="200" FontSize="18" Text="物品管理" Foreground="#918C8C" VerticalAlignment="Center"></TextBlock></StackPanel></Expander.Header><Expander.Content><StackPanel Background="#F6F8F8"><RadioButton x:Name="InStoreView" Click="StoreView_Checked" Height="30" Content="入库管理" FontSize="16" Tag="" Style="{DynamicResource RadioButtonMenuStyle}" Foreground="#85979F" /><RadioButton x:Name="OutStoreView" Click="StoreView_Checked" Height="30" Content="出库管理" FontSize="16" Tag="" Style="{DynamicResource RadioButtonMenuStyle}" Foreground="#85979F" /><RadioButton x:Name="InventoryView" Click="StoreView_Checked" Height="30" Content="盘存管理" FontSize="16" Tag="" Style="{DynamicResource RadioButtonMenuStyle}" Foreground="#85979F" /></StackPanel></Expander.Content></Expander><!--查询统计菜单--><Expander Background="#1D282B" ExpandDirection="Down" SnapsToDevicePixels="True" VerticalAlignment="Top" Style="{DynamicResource ExpanderStyle}"><Expander.Header><StackPanel Orientation="Horizontal" Height="50" Background="Transparent"><TextBlock Width="auto" Margin="10 0 10 0" Text="" FontFamily="Fonts/#FontAwesome" FontSize="22" Foreground="Red" VerticalAlignment="Center"></TextBlock><TextBlock Width="200" FontSize="18" Text="查询统计" Foreground="#918C8C" VerticalAlignment="Center"></TextBlock></StackPanel></Expander.Header><Expander.Content><StackPanel Background="#F6F8F8"><RadioButton x:Name="QueryStockView" Click="StoreView_Checked" Height="30" Content="库存查询" FontSize="16" Tag="" Style="{DynamicResource RadioButtonMenuStyle}" Foreground="#85979F" /><RadioButton x:Name="QueryInStoreView" Click="StoreView_Checked" Height="30" Content="入库查询" FontSize="16" Tag="" Style="{DynamicResource RadioButtonMenuStyle}" Foreground="#85979F" /><RadioButton x:Name="QueryOutStoreView" Click="StoreView_Checked" Height="30" Content="出库查询" FontSize="16" Tag="" Style="{DynamicResource RadioButtonMenuStyle}" Foreground="#85979F" /><RadioButton x:Name="LiveChartView" Click="StoreView_Checked" Height="30" Content="报表统计" FontSize="16" Tag="" Style="{DynamicResource RadioButtonMenuStyle}" Foreground="#85979F" /></StackPanel></Expander.Content></Expander><!--系统维护菜单--><Expander Background="#1D282B" ExpandDirection="Down" SnapsToDevicePixels="True" VerticalAlignment="Top" Style="{DynamicResource ExpanderStyle}" Visibility="{Binding AppData.User.Role,Converter={StaticResource AdminVisibleConverter}}"><Expander.Header><StackPanel Orientation="Horizontal" Height="50" Background="Transparent"><TextBlock Width="auto" Margin="10 0 10 0" Text="" FontFamily="Fonts/#FontAwesome" FontSize="22" Foreground="Red" VerticalAlignment="Center"></TextBlock><TextBlock Width="200" FontSize="18" Text="系统维护" Foreground="#918C8C" VerticalAlignment="Center"></TextBlock></StackPanel></Expander.Header><Expander.Content><StackPanel Background="#F6F8F8"><RadioButton x:Name="DataExportView" Click="StoreView_Checked" Height="30" Content="数据导出" FontSize="16" Tag="" Style="{DynamicResource RadioButtonMenuStyle}" Foreground="#85979F" /></StackPanel></Expander.Content></Expander><!--系统应用菜单--><Expander Background="#1D282B" ExpandDirection="Down" SnapsToDevicePixels="True" VerticalAlignment="Top" Style="{DynamicResource ExpanderStyle}"><Expander.Header><StackPanel Orientation="Horizontal" Height="50" Background="Transparent"><TextBlock Width="auto" Margin="10 0 10 0" Text="" FontFamily="Fonts/#FontAwesome" FontSize="22" Foreground="Red" VerticalAlignment="Center"></TextBlock><TextBlock Width="200" FontSize="18" Text="系统应用" Foreground="#918C8C" VerticalAlignment="Center"></TextBlock></StackPanel></Expander.Header><Expander.Content><StackPanel Background="#F6F8F8"><!--权限设置--><RadioButton x:Name="UserInfoView" Click="StoreView_Checked" Height="30" Content="用户管理" FontSize="16" Tag="" Style="{DynamicResource RadioButtonMenuStyle}" Foreground="#85979F" Visibility="{Binding AppData.User.Role,Converter={StaticResource AdminVisibleConverter}}" /><RadioButton Click="RadioButton_Click" Height="30" Content="退出系统" FontSize="16" Tag="" Style="{DynamicResource RadioButtonMenuStyle}" Foreground="#85979F" /></StackPanel></Expander.Content></Expander></StackPanel></ScrollViewer></Grid><!--第2行2列内容--><Grid Grid.Row="1" Grid.Column="1" Tag="舞台" Background="#E4ECEF"><ContentControl x:Name="container"><!--<Control:ButtonCard Logo="" Title="入库管理" Content="这是一个可以入库的快捷操作"></Control:ButtonCard>--></ContentControl></Grid></Grid>
</Window>
3)使用转换器 
3、运行效果



相关文章:
仓库管理系统26--权限设置
原创不易,打字不易,截图不易,多多点赞,送人玫瑰,留有余香,财务自由明日实现 1、权限概述 在应用软件中,通常将软件的功能分为若干个子程序,通过主程序调用。那么,通过…...
d3dx9_43.dll丢失怎么解决?d3dx9_43.dll怎么安装详细教程
在使用计算机中,如果遇到d3dx9_43.dll丢失或许找不到d3dx9_43.dll无法运行打开软件怎么办?这个是非常常见问题,下面我详细介绍一下d3dx9_43.dll是什么文件与d3dx9_43.dll的各种问题以及d3dx9_43.dll丢失的多个解决方法! 一、d3dx9…...
[C++] 退出清理函数解读(exit、_exit、abort、atexit)
说明:在C中,exit、_exit(或_Exit)、abort和atexit是用于控制程序退出和清理的标准库函数。下面是对这些函数的详细解读: exit 函数原型:void exit(int status);作用:exit函数用于正常退出程序…...
代码随想录(回溯)
组合(Leetcode77) 思路 用递归每次遍历从1-n得数,然后list来记录是不是组合到k个了,然后这个每次for循环的开始不能和上一个值的开始重复,所以设置个遍历开始索引startindex class Solution {static List<List<…...
编译原理1
NFA&DFA 在正规式的等价证明可以借助正规集,也可以通过有限自动机DFA来证明等价,以下例题是针对DFA证明正规式的等价,主要步骤是①NFA;②状态转换表; ③状态转换矩阵; ④化简DFA; 文法和语…...
【信息系统项目管理师知识点速记】组织通用管理:流程管理
23.2 流程管理 通过流程视角能够真正看清楚组织系统的本质与内在联系,理顺流程能够理顺整个组织系统。流程是组织运行体系的框架基础,流程框架的质量影响和决定了整个组织运行体系的质量。把流程作为组织运行体系的主线,配备满足流程运作需要的资源,并构建与流程框架相匹配…...
前端 JS 经典:箭头函数的意义
箭头函数是为了消除函数的二义性。 1. 二义性 函数的二义性指函数有不同的两种用法,就造成了二义性,函数的两种用法:1. 指令序列。2. 构造器 1.1 指令序列 就是调用函数,相当于将函数内部的代码再从头执行一次。 1.2 构造器 …...
Java List操作详解及常用方法
Java List操作详解及常用方法 大家好,我是免费搭建查券返利机器人省钱赚佣金就用微赚淘客系统3.0的小编,也是冬天不穿秋裤,天冷也要风度的程序猿! 什么是Java List? Java中的List是一种动态数组,它允许存…...
《mysql篇》--查询(进阶)
目录 将查询结果作为插入数据 聚合查询 聚合函数 count sum group by子句 having 联合查询 笛卡尔积 多表查询 join..on实现多表查询 内连接 外连接 自连接 子查询 合并查询 将查询结果作为插入数据 Insert into 表2 select * from 表1//将表1的查询数据插入…...
数据库-MySQL 实战项目——书店图书进销存管理系统数据库设计与实现(附源码)
一、前言 该项目非常适合MySQL入门学习的小伙伴,博主提供了源码、数据和一些查询语句,供大家学习和参考,代码和表设计有什么不恰当还请各位大佬多多指点。 所需环境 MySQL可视化工具:navicat; 数据库:MySq…...
eNSP中WLAN的配置和使用
一、基础配置 1.拓扑图 2.VLAN和IP配置 a.R1 <Huawei>system-view [Huawei]sysname R1 GigabitEthernet 0/0/0 [R1-GigabitEthernet0/0/0]ip address 200.200.200.200 24 b.S1 <Huawei>system-view [Huawei]sysname S1 [S1]vlan 100 [S1-vlan100]vlan 1…...
<sa8650>QCX ID16_UsecaseRawLiteAuto 使用详解
<sa8650>QCX ID16_UsecaseRawLiteAuto 使用详解 一、前言二、ID16_UsecaseRawLiteAuto拓扑图三、UsecaseRawLiteAuto拓扑图 解析3.1 camxUsecaseRawLiteAuto.xml3.2 camxRawLiteAuto.xml四、测试一、前言 我们在使用QCX时,如果由于使用的摄像头自带了ISP,那么可能不需要使…...
为什么3d重制变换模型会变形?---模大狮模型网
在当今数字技术飞速发展的时代,3D建模和动画制作已经成为影视、游戏和虚拟现实中不可或缺的一部分。然而,即使在高级的3D软件中,重制(rigging)和变换(transformation)过程中仍然会面临一个普遍的问题——模型变形。这种变形可能导致动画效果不…...
ElasticSearch中的BM25算法实现原理及应用分析
文章目录 一、引言二、BM25算法实现原理BM25算法的实现原理1. 词频(TF):2. 逆文档频率(IDF):3. 长度归一化:4. BM25评分公式: BM25算法示例 三、BM25算法在ElasticSearch中的应用分析…...
web权限到系统权限 内网学习第一天 权限提升 使用手工还是cs???msf可以不??
现在开始学习内网的相关的知识了,我们在拿下web权限过后,我们要看自己拿下的是什么权限,可能是普通的用户权限,这个连添加用户都不可以,这个时候我们就要进行权限提升操作了。 权限提升这点与我们后门进行内网渗透是乘…...
ros1仿真导航机器人 hector_mapping gmapping
仅为学习记录和一些自己的思考,不具有参考意义。 1 hector_mapping 建图过程 (1)gazebo仿真 roslaunch why_simulation why_slam.launch <launch><!-- We resume the logic in empty_world.launch, changing only the name of t…...
嵌入式实验---实验五 串口数据接收实验
一、实验目的 1、掌握STM32F103串口数据接收程序设计流程; 2、熟悉STM32固件库的基本使用。 二、实验原理 1、STM32F103R6能通过查询中断方式接收数据,每接收到一个字节,立即向对方发送一个相同内容的字节,并把该字节的十六进…...
ubuntu 22.04下编译安装glog共享库
笔者是完美主义者,在编译opencv4.9时,有个有关glog的warn,就下载编译google的glog库并把它编译成shared libaray。重新编译opencv4.9时,该warn解除。现把编译安装glog过程记录,以备后查。 以下操作全程以root身份或sudo执行。 cd…...
Linux环境安装配置nginx服务流程
Linux环境的Centos、麒麟、统信操作系统安装配置nginx服务流程操作: 1、官网下载 下载地址 或者通过命令下载 wget http://nginx.org/download/nginx-1.20.2.tar.gz 2、上传到指定的服务器并解压 tar -zxvf nginx-1.20.1.tar.gzcd nginx-1.20.1 3、编译并安装到…...
设计模式-模板模式
简介 模板方法模式是一种行为设计模式,它在父类中定义了一个操作的算法框架,允许子类在不改变算法结构的情况下重定义算法的某些步骤。这种模式是基于继承的,通过抽象类将通用的代码抽取到超类中,同时通过具体类实现或者改写算法…...
基于Flask实现的医疗保险欺诈识别监测模型
基于Flask实现的医疗保险欺诈识别监测模型 项目截图 项目简介 社会医疗保险是国家通过立法形式强制实施,由雇主和个人按一定比例缴纳保险费,建立社会医疗保险基金,支付雇员医疗费用的一种医疗保险制度, 它是促进社会文明和进步的…...
关于nvm与node.js
1 安装nvm 安装过程中手动修改 nvm的安装路径, 以及修改 通过nvm安装node后正在使用的node的存放目录【这句话可能难以理解,但接着往下看你就了然了】 2 修改nvm中settings.txt文件配置 nvm安装成功后,通常在该文件中会出现以下配置&…...
Objective-C常用命名规范总结
【OC】常用命名规范总结 文章目录 【OC】常用命名规范总结1.类名(Class Name)2.协议名(Protocol Name)3.方法名(Method Name)4.属性名(Property Name)5.局部变量/实例变量(Local / Instance Variables&…...
CentOS下的分布式内存计算Spark环境部署
一、Spark 核心架构与应用场景 1.1 分布式计算引擎的核心优势 Spark 是基于内存的分布式计算框架,相比 MapReduce 具有以下核心优势: 内存计算:数据可常驻内存,迭代计算性能提升 10-100 倍(文档段落:3-79…...
剑指offer20_链表中环的入口节点
链表中环的入口节点 给定一个链表,若其中包含环,则输出环的入口节点。 若其中不包含环,则输出null。 数据范围 节点 val 值取值范围 [ 1 , 1000 ] [1,1000] [1,1000]。 节点 val 值各不相同。 链表长度 [ 0 , 500 ] [0,500] [0,500]。 …...
unix/linux,sudo,其发展历程详细时间线、由来、历史背景
sudo 的诞生和演化,本身就是一部 Unix/Linux 系统管理哲学变迁的微缩史。来,让我们拨开时间的迷雾,一同探寻 sudo 那波澜壮阔(也颇为实用主义)的发展历程。 历史背景:su的时代与困境 ( 20 世纪 70 年代 - 80 年代初) 在 sudo 出现之前,Unix 系统管理员和需要特权操作的…...
Vue ③-生命周期 || 脚手架
生命周期 思考:什么时候可以发送初始化渲染请求?(越早越好) 什么时候可以开始操作dom?(至少dom得渲染出来) Vue生命周期: 一个Vue实例从 创建 到 销毁 的整个过程。 生命周期四个…...
论文阅读:LLM4Drive: A Survey of Large Language Models for Autonomous Driving
地址:LLM4Drive: A Survey of Large Language Models for Autonomous Driving 摘要翻译 自动驾驶技术作为推动交通和城市出行变革的催化剂,正从基于规则的系统向数据驱动策略转变。传统的模块化系统受限于级联模块间的累积误差和缺乏灵活性的预设规则。…...
Leetcode33( 搜索旋转排序数组)
题目表述 整数数组 nums 按升序排列,数组中的值 互不相同 。 在传递给函数之前,nums 在预先未知的某个下标 k(0 < k < nums.length)上进行了 旋转,使数组变为 [nums[k], nums[k1], …, nums[n-1], nums[0], nu…...
大模型真的像人一样“思考”和“理解”吗?
Yann LeCun 新研究的核心探讨:大语言模型(LLM)的“理解”和“思考”方式与人类认知的根本差异。 核心问题:大模型真的像人一样“思考”和“理解”吗? 人类的思考方式: 你的大脑是个超级整理师。面对海量信…...
