[英]Linking CanExecute method of commands and authorization management
I want to manage permissions to execute commands and view controls and so on. 我想管理执行命令和查看控件等的权限。 Therefore I have a class UserAction implementing ICommand interface. 因此,我有一个实现ICommand接口的UserAction类。
I want to define UserActions available for the UserManagement using one Enum. 我想使用一个枚举定义可用于UserManagement的UserAction。
For simplifying UserManagement I want to wrap multiple UserActions to UserActivities which permissions are set in a database table. 为了简化UserManagement,我想将多个UserAction包装到UserActivities中,在数据库表中设置了权限。
On runtime I have a Role class which maintains the currently set of permissions (stored as UserActivities), these permissions are likely to change during runtime. 在运行时,我有一个Role类,该类维护当前的权限集(存储为UserActivities),这些权限在运行时可能会更改。
Does anyone know how to manage this CanExecute methods correctly or are there any nice patterns or frameworks meant for this topic? 有谁知道如何正确地管理CanExecute方法,或者有没有适合该主题的好的模式或框架?
I did not find a lot about this for now on the net. 我目前在网上找不到很多有关此的内容。
As a whole what you want to achieve is called externalized authorization management . 总体而言,您要实现的目标称为外部化授权管理 。 You can consider two different approaches: 您可以考虑两种不同的方法:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.