简体   繁体   English

kohana-配置文件控制器的组织

[英]kohana - organization of profile controller

I want to build a website with some simple social fetures. 我想建立一个具有一些简单社交功能的网站。 I wonder how to organize user profiles. 我想知道如何组织用户个人资料。 My doubts are: 我的怀疑是:

When example.com/user/someuser is executed 当执行example.com/user/someuser时

  • not logged user should see public profile without any edit profile options 未登录的用户应该看到没有任何编辑配置文件选项的公共配置文件

  • logged user should see private profile if his profile is shown but public profile if someones else profile is shown 登录的用户(如果显示了他的个人资料)应看到私人个人资料,但如果显示其他人的个人资料则应看到公共个人资料

I plan to make it like this: profile controller class - check if user is logged 我计划使其如下:Profile Controller类-检查用户是否已登录

  • if no, show public profile view 如果否,则显示公开个人资料视图

  • if user is logged show public profile or private profile dependant on authorization 如果用户已登录,则显示公共配置文件或私有配置文件取决于授权

But what if someone put something in url like: edit or something? 但是,如果有人在url中放置一些内容(例如:edit或其他内容)怎么办? Please give some advice how t organize something like this, or maybe someone could give some links with tutorials or something? 请提供一些建议,如何组织这样的事情,或者有人可以提供与教程或某些内容的链接?

The basic idea is to check for authentication in the controller's before() method, which gets executed prior to the controllers action methods. 基本思想是检查控制器的before()方法中的身份验证,该方法在控制器操作方法之前执行。 Here are links to a couple of examples: 以下是几个示例的链接:

Official Kohana Documentation - Controller: Before and after Kohana官方文档-控制器:之前和之后

Unofficial Kohana 3 Wiki - Using Auth with template extended controllers 非官方的Kohana 3 Wiki-使用Auth与模板扩展控制器

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM