开发者

Selecting navigation items that have one or more user roles

I have a database table that I am using to control site navigation and I want to be able to restrict which navigation items show up depending on the users set role(s). The problem is the user might have multiple roles, and the navigation item might be available to multiple role levels. This开发者_StackOverflow中文版 means there will be a field that has roles that would be shown as: "a,b,c" In this example I want to show that navigation item if the user has any or all of the roles listed.

I have tried using where roles in ("a") but that does not return any results.

Is this even possible? I have thought about setting up a relational table to show the relationship between the navigation items and their required roles, however that seemed to be overkill? Maybe not.

Thanks!


It seems you have a denormalized structure, with a field holding a list of roles, which means you need some function to split out those values. Here's another post to help you out: Can Mysql Split a column?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜