设计基于权限的安全模型
我在开发一个 vb.net winforms 应用程序,目前我们使用简单的角色来确保安全。我们根据当前用户是否具有所需的角色来启用/禁用特定控件。我们已经到了这样的地步:这已经不够精细了。
我们的应用程序基于我们称之为站点的不同物理位置。用户可能有权在一个站点上执行某些操作(例如,编辑站点的配置),但无权在另一个站点上执行某些操作。因此,我们现在需要根据当前用户和当前站点查找权限。此外,某个用户的权限可能非常特定于他们自己,即。没有其他用户的权限与其他用户的权限完全相同。因此,我们需要一个更多基于权限而不是基于角色的安全模型。
设计满足这些要求的新权限模型的最佳方法是什么?我想确保很容易实现代码检查(我不希望在 SetUIPermissions 方法中散布一百万个 if 语句),并且我们不想每次都更新每个用户(超过 400 个并且还在增加)是时候我们添加一个新的权限了。由于最后一个要求,我认为我们需要保留角色的概念,但可能会添加/删除特定用户的特定权限的例外。
有什么想法吗?
I work on a vb.net winforms app where we currently are using simple roles for security. We enable/disable specific controls based on if the current user has the required role. We are to the point where this is no longer granular enough.
Our application is based on different physical locations we call sites. A user might have permission to do something (for example, edit a site's configuration) at one site but not another. Therefore, we now need to lookup permissions based on current user AND current site. Also, a certain user's permissions may be very specific to themselves ie. no other user's permissions are exactly the same as another user's. Therefore we need a security model that's more permissions based rather than role based.
What's the best way to design a new permissions model that can meet these requirements? I want to make sure that it's easy to implement the checking in the code (I don't want a million if statements sprinkled in our SetUIPermissions methods) and we don't want to have to update every user (400+ and counting) each time we add a new permission. Because of this last requirement I think we need to keep the idea of roles but possibly add/remove exceptions for particular permissions for specific users.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的角色和权限处于正确的轨道上。让角色引用一组“默认”权限是一种相对常见的解决方案;通过让用户拥有一个角色和一组权限,您可以允许该角色被专门为该用户授予/撤销的一组权限覆盖。这提供了合理的灵活性和粒度,并支持您添加新权限(在角色中)而无需接触每个用户的情况。
You're on the right track with the roles and permissions. It's a relatively common solution to have a role refer to a set of "default" permissions; by having a user have a role and a set of permissions, you allow for the role to be overridden by the set of permissions specifically granted / revoked for that user. This gives reasonable flexibility and granularity, and supports your situation of adding new permissions (in the role) without needing to touch every user.