(多)H2中的角色定义和检查

发布于 2024-11-10 05:36:55 字数 754 浏览 6 评论 0原文

您好,

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

£烟消云散 2024-11-17 05:36:55

通常你应该选择最简单的解决方案,在你的情况下它可能是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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文