用户授权,活动日志和软件设置 [英] User Authorization, Activity Log and Software settings

查看:85
本文介绍了用户授权,活动日志和软件设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的第一篇文章,我希望足够清楚.

我正在使用C#语言编写.NET应用程序.该应用程序将在工业环境中运行(我的意思是,它将控制机器),因此它需要该领域中经常需要的一些特定功能:

1.该软件必须对用户进行身份验证:例如,某些用户只能启动/停止计算机,其他用户可以更改设置并进行备份,其他用户只能读取设置,依此类推...

我不希望为此使用基于Windows用户的身份验证,是否有关于如何实现某些基本身份验证系统(例如,使用数据库)的良好示例?

2.我还需要跟踪用户活动(谁/什么时候登录,他做了什么修改)和机器统计信息(每个会话工作了多少部分,会话结果,等等...)

我知道这还不是很具体,但是我实际上必须决定实现什么以及如何实现,因此只需要一些有关使用什么Approuch的好主意(也许是数据库日志记录或xml文件?.

3.最后一个问题是关于软件设置:考虑到我需要导出/导入设置,在哪里存储设置?如果我使用标准的.NET属性"类,则不知道如何导出/导入.关于如何管理数据库和/或xml文件中的设置,是否有任何好的示例/库?

不幸的是,我来自旧的" c ++编程,并且在.NET/Windows编程方面经验很少.

非常感谢您的建议,
Simone

Hi there, this is my first post and I hope to be clear enought.

I''m writing a .NET application using C# language. This application will run in Industrial environment (I mean, it will control a machine) and so it need some specific features often required in this field:

1. The software must authenticate the user: for example, some users can only start/stop the machine, others can change settings and make backups, others can only read settings, and so on...

I would not prefer tu use authentication based on windows users for this, is there any good example on how to implement some base authentication system, maybe using database?

2. I also need to trace user activity (who/when logged, what he has modified) and machine statistics (how many parts worked per session, session results, and so on...)

I know this is not so specific point, but I actually have to decide what to implement and how, so just need some good ideas about what approuch to use (maybe database logging, or xml files?.

3. Last question is about software settings: where to store settings, considering that I will need to export/import them? If I use standard .NET "properties" class, I don''t know how to export/import. Is there any good example/library on how to manage settings in database and/or xml file?

Unfortunately I come from "old" c++ programming, and have very little experience in .NET/Windows programming.

Thanks a lot for your suggestions,
Simone

推荐答案

simonerom写道:
simonerom wrote:

1.该软件必须对用户进行身份验证:例如,某些用户只能启动/停止机器,其他用户可以更改设置和进行备份,其他用户只能读取设置,依此类推...

我不希望为此使用基于Windows用户的身份验证,是否有关于如何实现某些基本身份验证系统(例如,使用数据库)的良好示例?

1. The software must authenticate the user: for example, some users can only start/stop the machine, others can change settings and make backups, others can only read settings, and so on...

I would not prefer to use authentication based on windows users for this, is there any good example on how to implement some base authentication system, maybe using database?



当然-您可以使用数据库.您需要定义占据角色的用户,每个角色都具有权限.用户可以具有一个或多个角色,并且角色可以具有一个或多个权限.

我写了一篇有关用户身份验证的文章:

WinForm应用程序的用户登录 [



Sure - you can use a database. You need to define users, who occupy roles, each of which have permissions. A user can have one or more roles, and roles can have one or more permissions.

I wrote an article about user authentication:

User Login For WinForm Applications[^]

simonerom写道:
simonerom wrote:

2.我还需要跟踪用户活动(谁/什么时候登录,他做了什么修改)和机器统计信息(每个会话工作了多少部分,会话结果,等等).

我知道这不是很具体,但是我实际上必须决定实现什么以及如何实现,因此只需要一些关于使用哪种方法的好主意(也许是数据库日志记录或xml文件?.)

2. I also need to trace user activity (who/when logged, what he has modified) and machine statistics (how many parts worked per session, session results, and so on...)

I know this is not so specific point, but I actually have to decide what to implement and how, so just need some good ideas about what approach to use (maybe database logging, or xml files?.



这是一个实现细节,但是我将使用数据库进行日志记录.如果您以后想要的话,总是可以导出到XML.无论哪种方式,您都必须开发一个界面来查看用户活动日志.




This is an implementation detail, but I would use the database for logging. You can always export to XML if you want to later on. Either way, you''re going to have to develop an interface to view the user activity log.


simonerom写道:
simonerom wrote:

3.最后一个问题是关于软件设置的:考虑到我需要导出/导入设置,在哪里存储设置?如果我使用标准的.NET属性"类,则不知道如何导出/导入.关于如何管理数据库和/或xml文件中的设置,是否有任何好的示例/库?

3. Last question is about software settings: where to store settings, considering that I will need to export/import them? If I use standard .NET "properties" class, I don''t know how to export/import. Is there any good example/library on how to manage settings in database and/or xml file?



.Net支持XML设置-除非需要从其他应用程序导入/导出现有设置,否则您不必担心它.顺便说一句,任何应用程序数据/设置都应保存在用户的applicationdata文件夹中. DotNet为您提供了一种动态确定文件夹名称的方法,但是它特定于* Windows用户*.如果多个用户可以登录到该应用程序,我将使用全局applicationdata文件夹,而不是用户特定的文件夹.同样,.Net为您提供了一种通过代码确定此文件夹名称的方法.



.Net supports XML settings - unless there''s a need to import/export existing settings from another application, you shouldn''t have to worry about it. BTW, any application data/settings should be saved int he user''s applicationdata folder. DotNet provies a method for yyou to determine that foldername on the fly, but it IS *Windows user* specific. If multiple users can log into the application, I would use the global applicationdata folder instead of the user-specific one. Again, .Net gives you a way to determine this folder name through code.


这篇关于用户授权,活动日志和软件设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆