做国外的营销的网站,淄博网站开发,界面设计工具,网站建设设计目的原创不易#xff0c;打字不易#xff0c;截图不易#xff0c;多多点赞#xff0c;送人玫瑰#xff0c;留有余香#xff0c;财务自由明日实现 1、权限概述
在应用软件中#xff0c;通常将软件的功能分为若干个子程序#xff0c;通过主程序调用。那么#xff0c;通过…原创不易打字不易截图不易多多点赞送人玫瑰留有余香财务自由明日实现 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/// 菜单权限转换器/// /summarypublic 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:ClassWest.StoreMgr.MainWindowxmlnshttp://schemas.microsoft.com/winfx/2006/xaml/presentationxmlns:xhttp://schemas.microsoft.com/winfx/2006/xamlxmlns:dhttp://schemas.microsoft.com/expression/blend/2008xmlns:mchttp://schemas.openxmlformats.org/markup-compatibility/2006xmlns:localclr-namespace:West.StoreMgr xmlns:Controlclr-namespace:West.StoreMgr.Controlmc:IgnorabledDataContext{Binding Source{StaticResource Locator},PathMain}WindowStartupLocationCenterScreenxmlns:converterclr-namespace:West.StoreMgr.Helper.ConverterTitle欢迎使用仓库管理系统 Height720 Width1380Window.Resourcesconverter:AdminVisibleConverter x:KeyAdminVisibleConverter//Window.ResourcesGrid!--整体布局分为2行2列--Grid.ColumnDefinitionsColumnDefinition Width276/ColumnDefinition//Grid.ColumnDefinitionsGrid.RowDefinitionsRowDefinition Height61/RowDefinition//Grid.RowDefinitions!--第1行第1列标识名称--Grid Grid.Row0 Grid.Column0 Tag标志 Background#367FA8TextBlock Text企业仓库管理系统 HorizontalAlignmentCenter VerticalAlignmentCenter Foreground#F6A518 FontSize28//Grid!--第1行第2列帐号信息--Grid Grid.Row0 Grid.Column1 Tag顶栏 Background#3C8DBBGrid.ColumnDefinitionsColumnDefinition/ColumnDefinition//Grid.ColumnDefinitionsStackPanel Grid.Column0 HorizontalAlignmentLeft VerticalAlignmentCenter OrientationHorizontalTextBlock Margin10 FontSize16 Text#xf039; FontFamilyFonts/#FontAwesome ForegroundWhite VerticalAlignmentCenter/TextBlock Margin0 10 0 10 FontSize16 Text欢迎 ForegroundWhite VerticalAlignmentCenter/TextBlock Margin5 10 0 10 FontSize16 Text{Binding AppData.User.Name} ForegroundWhite VerticalAlignmentCenter Style{StaticResource TextBoxBanberStyle} MouseUpTextBlock_MouseUp_2//StackPanelStackPanel Grid.Column1 HorizontalAlignmentRight VerticalAlignmentCenter OrientationHorizontal Margin0 0 20 0TextBlock Margin10 FontSize16 Text#xf023; FontFamilyFonts/#FontAwesome ForegroundWhite VerticalAlignmentCenter/TextBlock Margin0 10 0 10 FontSize16 Text修改密码 ForegroundWhite VerticalAlignmentCenter Style{StaticResource TextBoxBanberStyle} MouseUpTextBlock_MouseUp_1/TextBlock Margin10 FontSize16 Text#xf08b; FontFamilyFonts/#FontAwesome ForegroundWhite VerticalAlignmentCenter/TextBlock Margin0 10 0 10 FontSize16 Text退出系统 ForegroundWhite Style{StaticResource TextBoxBanberStyle} MouseUpTextBlock_MouseUp //StackPanel/Grid!--第2行1列菜单--Grid Grid.Row1 Grid.Column0 Tag菜单Grid.RowDefinitionsRowDefinition Heightauto/RowDefinition//Grid.RowDefinitionsBorder Height41 Background#1A2327 VerticalAlignmentCenterTextBlock Text导航菜单 FontSize20 ForegroundAntiqueWhite VerticalAlignmentCenter//Border!--左侧主菜单--ScrollViewer Grid.Row1 VerticalScrollBarVisibilityAutoStackPanel Background#222C32RadioButton x:NameIndexView ClickStoreView_Checked Height50 Content控制台首页 FontSize16 Tag#xf17a; Style{DynamicResource RadioButtonMenuStyle} Foreground#85979F /!--基础数据菜单加上权限设置--Expander Background#1D282B ExpandDirectionDown SnapsToDevicePixelsTrue VerticalAlignmentTop Style{DynamicResource ExpanderStyle} Visibility{Binding AppData.User.Role,Converter{StaticResource AdminVisibleConverter}}Expander.HeaderStackPanel OrientationHorizontal Height50 BackgroundTransparentTextBlock Widthauto Margin10 0 10 0 Text#xf170; FontFamilyFonts/#FontAwesome FontSize22 ForegroundRed VerticalAlignmentCenter/TextBlockTextBlock Width200 FontSize18 Text基础数据 Foreground#918C8C VerticalAlignmentCenter/TextBlock/StackPanel/Expander.HeaderExpander.ContentStackPanel Background#F6F8F8RadioButton x:NameGoodsTypeView ClickStoreView_Checked Height30 Content物资设置 FontSize16 Tag#xf069; Style{DynamicResource RadioButtonMenuStyle} Foreground#85979F /RadioButton x:NameGoodsView ClickStoreView_Checked Height30 Content物资登记 FontSize16 Tag#xf069; Style{DynamicResource RadioButtonMenuStyle} Foreground#85979F /RadioButton NameSupplierView ClickStoreView_Checked Height30 Content供应商设置 FontSize16 Tag#xf069; Style{DynamicResource RadioButtonMenuStyle} Foreground#85979F /RadioButton NameCustomerView ClickStoreView_Checked Height30 Content客户管理 FontSize16 Tag#xf069; Style{DynamicResource RadioButtonMenuStyle} Foreground#85979F /RadioButton x:NameStoreView ClickStoreView_Checked Height30 Content仓库设置 FontSize16 Tag#xf069; Style{DynamicResource RadioButtonMenuStyle} Foreground#85979F /RadioButton x:NameSpecView ClickStoreView_Checked Height30 Content规格设置 FontSize16 Tag#xf069; Style{DynamicResource RadioButtonMenuStyle} Foreground#85979F //StackPanel/Expander.Content/Expander!--物品管理菜单--Expander Background#1D282B ExpandDirectionDown SnapsToDevicePixelsTrue VerticalAlignmentTop Style{DynamicResource ExpanderStyle}Expander.HeaderStackPanel OrientationHorizontal Height50 BackgroundTransparentTextBlock Widthauto Margin10 0 10 0 Text#xf170; FontFamilyFonts/#FontAwesome FontSize22 ForegroundRed VerticalAlignmentCenter/TextBlockTextBlock Width200 FontSize18 Text物品管理 Foreground#918C8C VerticalAlignmentCenter/TextBlock/StackPanel/Expander.HeaderExpander.ContentStackPanel Background#F6F8F8RadioButton x:NameInStoreView ClickStoreView_Checked Height30 Content入库管理 FontSize16 Tag#xf172; Style{DynamicResource RadioButtonMenuStyle} Foreground#85979F /RadioButton x:NameOutStoreView ClickStoreView_Checked Height30 Content出库管理 FontSize16 Tag#xf172; Style{DynamicResource RadioButtonMenuStyle} Foreground#85979F /RadioButton x:NameInventoryView ClickStoreView_Checked Height30 Content盘存管理 FontSize16 Tag#xf172; Style{DynamicResource RadioButtonMenuStyle} Foreground#85979F //StackPanel/Expander.Content/Expander!--查询统计菜单--Expander Background#1D282B ExpandDirectionDown SnapsToDevicePixelsTrue VerticalAlignmentTop Style{DynamicResource ExpanderStyle}Expander.HeaderStackPanel OrientationHorizontal Height50 BackgroundTransparentTextBlock Widthauto Margin10 0 10 0 Text#xf170; FontFamilyFonts/#FontAwesome FontSize22 ForegroundRed VerticalAlignmentCenter/TextBlockTextBlock Width200 FontSize18 Text查询统计 Foreground#918C8C VerticalAlignmentCenter/TextBlock/StackPanel/Expander.HeaderExpander.ContentStackPanel Background#F6F8F8RadioButton x:NameQueryStockView ClickStoreView_Checked Height30 Content库存查询 FontSize16 Tag#xf080; Style{DynamicResource RadioButtonMenuStyle} Foreground#85979F /RadioButton x:NameQueryInStoreView ClickStoreView_Checked Height30 Content入库查询 FontSize16 Tag#xf080; Style{DynamicResource RadioButtonMenuStyle} Foreground#85979F /RadioButton x:NameQueryOutStoreView ClickStoreView_Checked Height30 Content出库查询 FontSize16 Tag#xf080; Style{DynamicResource RadioButtonMenuStyle} Foreground#85979F /RadioButton x:NameLiveChartView ClickStoreView_Checked Height30 Content报表统计 FontSize16 Tag#xf080; Style{DynamicResource RadioButtonMenuStyle} Foreground#85979F //StackPanel/Expander.Content/Expander!--系统维护菜单--Expander Background#1D282B ExpandDirectionDown SnapsToDevicePixelsTrue VerticalAlignmentTop Style{DynamicResource ExpanderStyle} Visibility{Binding AppData.User.Role,Converter{StaticResource AdminVisibleConverter}}Expander.HeaderStackPanel OrientationHorizontal Height50 BackgroundTransparentTextBlock Widthauto Margin10 0 10 0 Text#xf170; FontFamilyFonts/#FontAwesome FontSize22 ForegroundRed VerticalAlignmentCenter/TextBlockTextBlock Width200 FontSize18 Text系统维护 Foreground#918C8C VerticalAlignmentCenter/TextBlock/StackPanel/Expander.HeaderExpander.ContentStackPanel Background#F6F8F8RadioButton x:NameDataExportView ClickStoreView_Checked Height30 Content数据导出 FontSize16 Tag#xf073; Style{DynamicResource RadioButtonMenuStyle} Foreground#85979F //StackPanel/Expander.Content/Expander!--系统应用菜单--Expander Background#1D282B ExpandDirectionDown SnapsToDevicePixelsTrue VerticalAlignmentTop Style{DynamicResource ExpanderStyle}Expander.HeaderStackPanel OrientationHorizontal Height50 BackgroundTransparentTextBlock Widthauto Margin10 0 10 0 Text#xf170; FontFamilyFonts/#FontAwesome FontSize22 ForegroundRed VerticalAlignmentCenter/TextBlockTextBlock Width200 FontSize18 Text系统应用 Foreground#918C8C VerticalAlignmentCenter/TextBlock/StackPanel/Expander.HeaderExpander.ContentStackPanel Background#F6F8F8!--权限设置--RadioButton x:NameUserInfoView ClickStoreView_Checked Height30 Content用户管理 FontSize16 Tag#xf2bb; Style{DynamicResource RadioButtonMenuStyle} Foreground#85979F Visibility{Binding AppData.User.Role,Converter{StaticResource AdminVisibleConverter}} /RadioButton ClickRadioButton_Click Height30 Content退出系统 FontSize16 Tag#xf2bb; Style{DynamicResource RadioButtonMenuStyle} Foreground#85979F //StackPanel/Expander.Content/Expander/StackPanel/ScrollViewer/Grid!--第2行2列内容--Grid Grid.Row1 Grid.Column1 Tag舞台 Background#E4ECEFContentControl x:Namecontainer!--Control:ButtonCard Logo#xf1ae; Title入库管理 Content这是一个可以入库的快捷操作/Control:ButtonCard--/ContentControl/Grid/Grid
/Window3使用转换器 3、运行效果