安全架构与业务合并
我以一种通用的方式进行身份验证/授权,但我有一个问题,系统的某些行为取决于用户角色,并且一个用户可以拥有多个角色。
它不仅涉及用户可以/不能执行某些操作,而且操作本身也会随着每个用户角色的变化而变化,有很多与每个角色相关的元数据,并且无法实现如何保持内聚性。
如果我将安全性与业务合并,耦合将会很高,并且一切都会变得混乱,如果为每个单独创建表,我会得到一些实体加倍,我也会变得混乱。
元数据的一小部分是:
如果初级人员只能为一个客户的一项工作构建基本部分,或者被同一客户的另一位初级人员放弃基本工作,则一名雇员
如果大师可以构建新的基本部分并修复/管理所有人制作的建筑来自一位客户的初级员工。
如果经理可以为所有客户做所有事情并控制主工作。
对于每项工作,一名初级人员需要选择一名相关的大师,一名大师需要选择一名经理,当一名初级人员被放弃的工作时,他成为所有者,但当大师修复一项工作时,创建者初级人员保留所有权。
Im doing authentication/authorization in a generic way but i have a problem, some behaviors of system are dependant of user role and one user can have more than one role.
Its not only about user can/cant do some action but action itself change for each user role, there is a lot of metadata related with each role and cant realize how keep cohesion.
If i merge security with business the coupling will be hight and all become a messy and if keep separate creating tables for each i will get some entities double and i get a messy too.
One small part of metadata is:
One employ if junior can build only basic part for one job for only one customer or get basic job abandoned started by another junior in same customer
If master can build new basic part and fix/manage building made by all juniors from one customer.
If manager can do everything for all customers and control master job.
For each job one junior need choose one master related and one master need choose one manager, when one junior get abandoned job he become owner but when master fix one job the creator junior keep ownership.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为每个实体创建一个表,直到达到一棵树,每次出现一个新角色时创建一个新表,然后使用这个结构来控制系统。将用户保留在用户表上,将雇员保留在雇员表上,每个用户都有一个密码和登录名,之后也必须使用雇员密码和登录名登录。它解决了你的问题。
Create one table to each entity until reach a tree, each time one new role appear create a new table, then use this structure to control system. Keep users on user tables and employees on employees table, each user has one password and login and after must login with employees password and login too. Its solve your problem.