用户具有角色角色时应如何呈现视图。蛋糕 [英] how should I render views when users habtm roles. cake

查看:65
本文介绍了用户具有角色角色时应如何呈现视图。蛋糕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好,这是我的问题...

ok here is my issue...

用户habtm组(角色)

user habtm groups(roles)

我有意见

因此,当用户只有一个角色时,应用程序会读取该角色,我们会很好...但是当他/ she /它有两个或多个角色,只是扮演第一个角色而解雇其他角色...

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


  • 我应该如何管理这些角色,以便
    用户可以选择要查看的视图?

  • 我应该告诉用户他
    登录后想要扮演什么角色吗?例如:让他决定(想打管理员,想打经理等)

  • 有没有办法让用户同时在一个$上扮演两个
    角色b $ b会话?例如:我有两个角色(vps,经理)。

  • 还是应该为一个具有更多特权的
    角色选择一个视图?例如:我有两个角色(管理员,经理),所以我使用管理员视图而不是经理的视图。

  • 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.

很多问题。 。所以开始回答hahaha
谢谢大家...

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

推荐答案

这很难回答,因为您遇到的问题是要求我们决定您的应用程序将如何工作。您必须自己做,并进行适当的设计和维护。

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.

对于HABTM记录的显示,我通常使用复选框或某些图形只读形式。

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

我的建议是您环顾网络,看看它如何在其他网站上工作-Flickr和Facebook等社交网站是一个不错的狩猎场,因为它们有很多的组,类别等。

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.

这篇关于用户具有角色角色时应如何呈现视图。蛋糕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆