加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

希望这些建议,能推动管理软件开发的规范化进程 (当前操作员类Bas

发布时间:2020-12-17 01:25:13 所属栏目:安全 来源:网络整理
导读:我们编写管理软件时,很重要的一个基础观念是: ?1. 当前软件系统是谁在操作? ?2. 当前软件系统的操作者部门信息是什么? 公司信息是什么? 通过这些信息获得相关数据. ?3. 当前软件系统操作者是否为系统管理员? ?4. 当前软件系统是谁在输入数据,谁在修改数据?

我们编写管理软件时,很重要的一个基础观念是:

?1. 当前软件系统是谁在操作?
?2. 当前软件系统的操作者部门信息是什么? 公司信息是什么? 通过这些信息获得相关数据.
?3. 当前软件系统操作者是否为系统管理员?
?4. 当前软件系统是谁在输入数据,谁在修改数据?

这个基础思想甚至会影响你整个系统的架构,贯穿各个层。
若没有这些数据,操作员在你系统里干了坏事,总得能记录吧?好让警察来破案。
在管理软件中,在登录过程中,确认当前操作员是谁?谁在操作数据等。
当软件系统不需要登录时,也可以把IP地址等标示信息,看成是一个特定的用户信息。


每个公司侧重的数据,每个软件侧重的数据理念都会有些不同,命名也有些不同,
其中的信息也大有不同,现在我只是提一个建议。
大家都统一命名为 BaseUserInfo,类的实体都命名为 UserInfo。
你可能这里的属性只需要几个,但是多几个也无妨,就当是后备用好了。
在C/S系统中,当前用户的信息可以存储在 Static 类里,在B/S系统中可以存在 Session 中。

?

?

? 1//------------------------------------------------------------
? 2// All Rights Reserved,Copyright (C) 2008,Jirisoft,Ltd.
? 3//------------------------------------------------------------
? 4
? 5using System;
? 6
? 7namespace Jirisoft.Common.Utilities
? 8{
? 9 /**//// <summary>
?10??? /// BaseUserInfo
?11??? /// 当前操作员信息的简要信息类
?12??? ///
?13??? /// 修改纪录
?14??? ///
?15??? ///? 2008.08.26 JiRiGaLa 版本:1.2 整理代码。
?16??? ///? 2006.05.03 JiRiGaLa 版本:1.1 添加到工程项目中。
?17??? ///? 2006.01.21 JiRiGaLa 版本:1.0 远程传递参数用。
?18??? ///?
?19??? /// 版本:1.2
?20??? ///
?21??? /// <author>
?22??? ///? <name>JiRiGaLa</name>
?23??? ///? <date>2008.08.26</date>
?24 /// </author>
?25 /// </summary>
?26 [Serializable]
?27 public class BaseUserInfo
?28 {
?29??????? /**//// <summary>
?30??????? /// 操作员代码
?31??????? /// </summary>
?32??????? private String id = String.Empty;
?33??????? public String ID
?34??????? {
?35??????????? get
?36??????????? {
?37??????????????? return this.id;
?38??????????? }
?39??????????? set
?40??????????? {
?41??????????????? this.id = value;
?42??????????? }
?43??????? }
?44???????
?45??????? /**//// <summary>
?46??????? /// 操作员用户名
?47??????? /// </summary>
?48??????? private String userName = String.Empty;
?49??????? public String UserName
?50??????? {
?51??????????? get
?52??????????? {
?53??????????????? return this.userName;
?54??????????? }
?55??????????? set
?56??????????? {
?57??????????????? this.userName = value;
?58??????????? }
?59??????? }
?60???????
?61??????? /**//// <summary>
?62??????? /// 操作员姓名
?63??????? /// </summary>
?64??????? private String realname = String.Empty;
?65??????? public String Realname
?66??????? {
?67??????????? get
?68??????????? {
?69??????????????? return this.realname;
?70??????????? }
?71??????????? set
?72??????????? {
?73??????????????? this.realname = value;
?74??????????? }
?75??????? }
?76
?77??????? /**//// <summary>
?78??????? /// 当前的组织结构部门代码
?79??????? /// </summary>
?80??????? private String departmentID = String.Empty;
?81??????? public String DepartmentID
?82??????? {
?83??????????? get
?84??????????? {
?85??????????????? return this.departmentID;
?86??????????? }
?87??????????? set
?88??????????? {
?89??????????????? this.departmentID = value;
?90??????????? }
?91??????? }
?92
?93??????? /**//// <summary>
?94??????? /// 当前的组织结构部门编号
?95??????? /// </summary>
?96??????? private String departmentCode = String.Empty;
?97??????? public String DepartmentCode
?98??????? {
?99??????????? get
100??????????? {
101??????????????? return this.departmentCode;
102??????????? }
103??????????? set
104??????????? {
105??????????????? this.departmentCode = value;
106??????????? }
107??????? }
108
109??????? /**//// <summary>
110??????? /// 当前的组织结构部门名称
111??????? /// </summary>
112??????? private String departmentFullName = String.Empty;
113??????? public String DepartmentFullName
114??????? {
115??????????? get
116??????????? {
117??????????????? return this.departmentFullName;
118??????????? }
119??????????? set
120??????????? {
121??????????????? this.departmentFullName = value;
122??????????? }
123??????? }
124???????
125??????? /**//// <summary>
126??????? /// 当前的组织结构公司代码
127??????? /// </summary>
128??????? private String companyID = String.Empty;
129??????? public String CompanyID
130??????? {
131??????????? get
132??????????? {
133??????????????? return this.companyID;
134??????????? }
135??????????? set
136??????????? {
137??????????????? this.companyID = value;
138??????????? }
139??????? }
140???????
141??????? /**//// <summary>
142??????? /// 当前的组织结构公司编号
143??????? /// </summary>
144??????? private String companyCode = String.Empty;
145??????? public String CompanyCode
146??????? {
147??????????? get
148??????????? {
149??????????????? return this.companyCode;
150??????????? }
151??????????? set
152??????????? {
153??????????????? this.companyCode = value;
154??????????? }
155??????? }
156???????
157??????? /**//// <summary>
158??????? /// 当前的组织结构公司名称
159??????? /// </summary>
160??????? private String companyFullName = String.Empty;
161??????? public String CompanyFullName
162??????? {
163??????????? get
164??????????? {
165??????????????? return this.companyFullName;
166??????????? }
167??????????? set
168??????????? {
169??????????????? this.companyFullName = value;
170??????????? }
171??????? }
172
173??????? /**//// <summary>
174??????? /// 操作员类型
175??????? /// </summary>
176??????? private String operatorCategory = String.Empty;
177??????? public String OperatorCategory
178??????? {
179??????????? get
180??????????? {
181??????????????? return this.operatorCategory;
182??????????? }
183??????????? set
184??????????? {
185??????????????? this.operatorCategory = value;
186??????????? }
187??????? }
188
189??????? /**//// <summary>
190??????? /// 操作员类型名称
191??????? /// </summary>
192??????? private String operatorCategoryFullName = String.Empty;
193??????? public String OperatorCategoryFullName
194??????? {
195??????????? get
196??????????? {
197??????????????? return this.operatorCategoryFullName;
198??????????? }
199??????????? set
200??????????? {
201??????????????? this.operatorCategoryFullName = value;
202??????????? }
203??????? }
204
205??????? /**//// <summary>
206??????? /// IP地址
207??????? /// </summary>
208??????? private String iPAddress = String.Empty;
209??????? public String IPAddress
210??????? {
211??????????? get
212??????????? {
213??????????????? return this.iPAddress;
214??????????? }
215??????????? set
216??????????? {
217??????????????? this.iPAddress = value;
218??????????? }
219??????? }
220???????
221??????? /**//// <summary>
222??????? /// MAC地址
223??????? /// </summary>
224??????? private String macAddress = String.Empty;
225??????? public String MACAddress
226??????? {
227??????????? get
228??????????? {
229??????????????? return this.macAddress;
230??????????? }
231??????????? set
232??????????? {
233??????????????? this.macAddress = value;
234??????????? }
235??????? }
236
237??????? /**//// <summary>
238??????? /// 当前语言选择
239??????? /// </summary>
240??????? private String currentLanguage = String.Empty;
241??????? public String CurrentLanguage
242??????? {
243??????????? get
244??????????? {
245??????????????? return this.currentLanguage;
246??????????? }
247??????????? set
248??????????? {
249??????????????? this.currentLanguage = value;
250??????????? }
251??????? }
252
253??????? /**//// <summary>
254??????? /// 当前布局风格选择
255??????? /// </summary>
256??????? private String themes = String.Empty;
257??????? public String Themes
258??????? {
259??????????? get
260??????????? {
261??????????????? return this.themes;
262??????????? }
263??????????? set
264??????????? {
265??????????????? this.themes = value;
266??????????? }
267??????? }
268???????
269??????? /**//// <summary>
270??????? /// 描述
271??????? /// </summary>
272??????? private String description = String.Empty;
273??????? public String Description
274??????? {
275??????????? get
276??????????? {
277??????????????? return this.description;
278??????????? }
279??????????? set
280??????????? {
281??????????????? this.description = value;
282??????????? }
283??????? }
284
285??????? /**//// <summary>
286??????? /// WebService 用户名
287??????? /// </summary>
288??????? private String webServiceUsername = "Jirisoft";
289??????? public String WebServiceUsername
290??????? {
291??????????? get
292??????????? {
293??????????????? return this.webServiceUsername;
294??????????? }
295??????????? set
296??????????? {
297??????????????? this.webServiceUsername = value;
298??????????? }
299??????? }
300
301??????? /**//// <summary>
302??????? /// WebService 密码
303??????? /// </summary>
304??????? private String webServicePassword = "Jirisoft";
305??????? public String WebServicePassword
306??????? {
307??????????? get
308??????????? {
309??????????????? return this.webServicePassword;
310??????????? }
311??????????? set
312??????????? {
313??????????????? this.webServicePassword = value;
314??????????? }
315??????? }
316
317??????? public BaseUserInfo()
318??????? {
319??????????? this.GetUserInfo();
320??????? }
321
322??????? public void GetUserInfo()#region public void GetUserInfo()
323??????? /**//// <summary>
324??????? /// 获取信息
325??????? /// </summary>
326??????? public void GetUserInfo()
327? {
328??????????? this.WebServiceUsername???????? = BaseConfiguration.Instance.WebServiceUsername;
329??????????? this.WebServicePassword???????? = BaseConfiguration.Instance.WebServicePassword;
330??????????? this.ID???????????????????????? = BaseSystemInfo.OperatorID;
331??????????? this.Realname?????????????????? = BaseSystemInfo.OperatorFullName;
332??????????? this.UserName?????????????????? = BaseSystemInfo.OperatorUserName;
333??????????? this.OperatorCategory?????????? = BaseSystemInfo.OperatorCategory;
334??????????? this.OperatorCategoryFullName?? = BaseSystemInfo.OperatorCategoryFullName;
335??????????? this.CompanyID????????????????? = BaseSystemInfo.OperatorCompanyID;
336??????????? this.CompanyCode??????????????? = BaseSystemInfo.OperatorCompanyCode;
337??????????? this.CompanyFullName??????????? = BaseSystemInfo.OperatorCompanyFullName;
338??????????? this.DepartmentID?????????????? = BaseSystemInfo.OperatorDepartmentID;
339??????????? this.DepartmentCode???????????? = BaseSystemInfo.OperatorDepartmentCode;
340??????????? this.DepartmentFullName???????? = BaseSystemInfo.OperatorDepartmentFullName;
341??????????? this.CurrentLanguage??????????? = BaseSystemInfo.CurrentLanguage;
342??????????? this.Themes???????????????????? = BaseSystemInfo.Themes;
343??????????? this.IPAddress????????????????? = BaseSystemInfo.IPAddress;
344??????????? this.MACAddress???????????????? = BaseSystemInfo.MACAddress;
345??????? }
346? #endregion
347?
348??????? /**//// <summary>
349??????? /// 当前操作员是否为系统管理员
350??????? /// </summary>
351? public bool IsAdministrator
352??????? {
353??????????? get
354??????????? {
355??????????????? if (this.ID.Equals(Jirisoft.Common.OperatorCategory.Administrator.ToString()))
356??????????????? {
357??????????????????? return true;
358??????????????? }
359??????????????? if (this.OperatorCategory.Equals(Jirisoft.Common.OperatorCategory.Administrator.ToString()))
360??????????????? {
361??????????????????? return true;
362??????????????? }
363??????????????? return false;
364??????????? }
365??????? }
366 }
367}
368
将权限管理、工作流管理做到我能力的极致,一个人只能做好那么很少的几件事情。
?不仅仅是通用权限设计
关注 - 128
粉丝 - 358
关注博主2 0 0
(请您对文章做出评价)? 上一篇:一些常用的场景进行描述分析(权限管理、6个典型场景)
? 下一篇:希望这些建议,能推动管理软件开发的规范化进程 (数据库版本、修改记录)

posted on 2008-08-26 14:17 不仅仅是通用权限设计 阅读(722) 评论(2) 编辑 收藏

?
评论
1298469
#1楼  回复 引用 查看 ??
没看出什么意义,我认为在某些环境下只需要一部分的字段,有些环境下需要的字段这里却没有

至少国外项目以下各项不可或缺:
Email
FirstName
LastName
ExtNo
...
2008-08-26 15:39 | LanceZhang??????
#2楼[楼主]  回复 引用 查看 ??
谢谢你的补充,你的补充意见正是我所需要的效果.
很多公司开发的A系统的架构与B系统的架构差别很大,
无法将A系统中的部分模块复制到B系统里来重复利用。

当然A公司的AX系统与B公司的BY系统之间,差别就
更大了,里面的模块复用的价值很低,我是想,有个
标准化组织一样,能让大家编写的软件模块能有很高的
重复利用的价值。

当然A这个人N年前写的AX系统中的模块能在N年后写的
AY系统中的架构差距不大,能重复利用就非常爽了。

公司不能每做一个项目,都从头来过,一个程序员不同 系统中写的同一个模块希望是能兼容的,这样劳动成果 才能积累,才能不断完善,将这个模块做得越来越好了。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读