是否可以在keycloak中为不同组中的用户添加不同的角色?

Is it possible to add different roles to a user in different groups in keycloak?

用户-Ankit 他在两个名为航班和酒店的组中。 在航班上,他是经理 在酒店,他是主管。

我们可以在keycloak的不同组中将这些不同的角色分配给Ankit吗?

我认为您必须将角色分开以特定于组 - 您需要一个航班经理角色和一个单独的酒店经理角色等等。

你可以assign roles to a user or group but assigning roles to a group effectively assigns those roles to all the members of the group. I think this is pretty typical.

当您将角色分配给用户时,您只是将角色分配给用户,而不是组内的用户:

有一个 thread in the keycloak mailing list 出现了这个问题。基本上,组只是收集用户的方式,而不是访问控制结构的一部分。

如果酒店和航班对应于应用程序,那么您可能要考虑是否可以将它们作为 来处理,但我认为您仍然需要有不同的角色集。