(多)H2中的角色定义和检查
您好,
H2中的数据库角色是什么意思?这是某种权利还是赠款?
应使用哪种方法:
A. 一个用户具有多个角色
==或==
B. 一个用户具有一个角色
情况如下:
假设我们有 2 个表:tbl1 和 tbl2。假设
User1 对 tbl1 具有完全权限,但对 tbl2 仅有读取权限。
用户2 对 tbl1 和 tbl2 具有只读访问权限。
采用上述方法:
创建 3 个角色:TBL1_READ、
将 TBL1_READ、TBL1_WRITE 和 TBL3_READ 分配给 User1
将 TBL1_READ 和 TBL2_READ 分配给 User2
采用上述 B 方法:
创建 2 个角色:TBL1_READ_WRITE_TBL2_READ 和 TBL1_READ_TBL2_READ
将 TBL1_READ_WRITE_TBL2_READ 分配给 User1
- User1
将 TBL1_READ_TBL2_READ 分配给 User2
应使用哪种方法?还是我误解了角色?
PS:可以检查一下她/他被分配了什么角色吗?
谢谢。
Greetings,
What is the meaning of database role in H2? Is it kind of rights or grants?
Which approach should be used:
A. multiple roles for one user
==or==
B. one role for one user
Here is the case:
Say we have 2 tables: tbl1 and tbl2.
User1 has full permissions on tbl1, but only read access on tbl2.
User2 has read only access on both tbl1 and tbl2.
Taking A approach above:
Create 3 roles: TBL1_READ, TBL1_WRITE, TBL2_REaD
Assign TBL1_READ, TBL1_WRITE and TBL3_READ to User1
Assign TBL1_READ and TBL2_READ to User2
Taking B approach above:
Create 2 roles: TBL1_READ_WRITE_TBL2_READ and TBL1_READ_TBL2_READ
Assign TBL1_READ_WRITE_TBL2_READ to User1
Assign TBL1_READ_TBL2_READ to User2
Which approach should be used? Or i missunderstanding roles?
PS: could one check what roles she/he been assigned?
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通常你应该选择最简单的解决方案,在你的情况下它可能是A。
但是你可以选择其中一个;您甚至可以直接将权限分配给用户。角色只是一种间接手段,有助于简化管理权限。
Usually you should pick the easiest solution, in your case it's probably A.
But you can do either; you could even assign the rights directly to the users. A role is just an indirection, to help simplify administrating rights.