仓库管理系统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、编译并安装到…...
设计模式-模板模式
简介 模板方法模式是一种行为设计模式,它在父类中定义了一个操作的算法框架,允许子类在不改变算法结构的情况下重定义算法的某些步骤。这种模式是基于继承的,通过抽象类将通用的代码抽取到超类中,同时通过具体类实现或者改写算法…...
RestClient
什么是RestClient RestClient 是 Elasticsearch 官方提供的 Java 低级 REST 客户端,它允许HTTP与Elasticsearch 集群通信,而无需处理 JSON 序列化/反序列化等底层细节。它是 Elasticsearch Java API 客户端的基础。 RestClient 主要特点 轻量级ÿ…...
Chapter03-Authentication vulnerabilities
文章目录 1. 身份验证简介1.1 What is authentication1.2 difference between authentication and authorization1.3 身份验证机制失效的原因1.4 身份验证机制失效的影响 2. 基于登录功能的漏洞2.1 密码爆破2.2 用户名枚举2.3 有缺陷的暴力破解防护2.3.1 如果用户登录尝试失败次…...
【Java学习笔记】Arrays类
Arrays 类 1. 导入包:import java.util.Arrays 2. 常用方法一览表 方法描述Arrays.toString()返回数组的字符串形式Arrays.sort()排序(自然排序和定制排序)Arrays.binarySearch()通过二分搜索法进行查找(前提:数组是…...
PPT|230页| 制造集团企业供应链端到端的数字化解决方案:从需求到结算的全链路业务闭环构建
制造业采购供应链管理是企业运营的核心环节,供应链协同管理在供应链上下游企业之间建立紧密的合作关系,通过信息共享、资源整合、业务协同等方式,实现供应链的全面管理和优化,提高供应链的效率和透明度,降低供应链的成…...
渗透实战PortSwigger靶场-XSS Lab 14:大多数标签和属性被阻止
<script>标签被拦截 我们需要把全部可用的 tag 和 event 进行暴力破解 XSS cheat sheet: https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 通过爆破发现body可以用 再把全部 events 放进去爆破 这些 event 全部可用 <body onres…...
GitHub 趋势日报 (2025年06月08日)
📊 由 TrendForge 系统生成 | 🌐 https://trendforge.devlive.org/ 🌐 本日报中的项目描述已自动翻译为中文 📈 今日获星趋势图 今日获星趋势图 884 cognee 566 dify 414 HumanSystemOptimization 414 omni-tools 321 note-gen …...
九天毕昇深度学习平台 | 如何安装库?
pip install 库名 -i https://pypi.tuna.tsinghua.edu.cn/simple --user 举个例子: 报错 ModuleNotFoundError: No module named torch 那么我需要安装 torch pip install torch -i https://pypi.tuna.tsinghua.edu.cn/simple --user pip install 库名&#x…...
sipsak:SIP瑞士军刀!全参数详细教程!Kali Linux教程!
简介 sipsak 是一个面向会话初始协议 (SIP) 应用程序开发人员和管理员的小型命令行工具。它可以用于对 SIP 应用程序和设备进行一些简单的测试。 sipsak 是一款 SIP 压力和诊断实用程序。它通过 sip-uri 向服务器发送 SIP 请求,并检查收到的响应。它以以下模式之一…...
Java + Spring Boot + Mybatis 实现批量插入
在 Java 中使用 Spring Boot 和 MyBatis 实现批量插入可以通过以下步骤完成。这里提供两种常用方法:使用 MyBatis 的 <foreach> 标签和批处理模式(ExecutorType.BATCH)。 方法一:使用 XML 的 <foreach> 标签ÿ…...
CppCon 2015 学习:Time Programming Fundamentals
Civil Time 公历时间 特点: 共 6 个字段: Year(年)Month(月)Day(日)Hour(小时)Minute(分钟)Second(秒) 表示…...
