how should I render views when users habtm roles. cake

半城伤御伤魂 提交于 2019-12-24 10:29:23

问题


ok here is my issue...

user habtm groups(roles)

i have views for admins, boardmembers, managers, and vps.

so when an user have just one role the app reads the role and we're going fine... BUT when he/she/it have two or more roles it just take the first one and dissmiss the others...

the questions

  • how should i manage those role so the user can choose what view to see?
  • should i tell the user what role he wants to play after login? Ex: made him decide (want's to play admin, want's to play manager, etc)
  • is there a way the user can play two roles at the same time at one session? Ex: I have two roles (vps, manager). render two views in one?
  • or should i choose a view for that role that have more privilege? Ex: I have two roles (admin, manager) so i use admin views not the manager's ones.

a lot of questions... so start answering hahaha thanks guys...


回答1:


It's difficult to answer because the sort of questions you're asking require us to decide how your application will work. You have to do that yourself and make appropriate design & programming based on your decision.

As for display of HABTM records, I usually use checkboxes or some graphical readonly equivalent.

My suggestion is that you look around the web to see how it works on other sites - social sites like Flickr and Facebook are a good hunting ground as they have lots of groups, categories etc.




回答2:


user admin routing... and have many prefixes. and may be in the place where you display user information. you can also list the other roles he can play.



来源:https://stackoverflow.com/questions/4054182/how-should-i-render-views-when-users-habtm-roles-cake

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!