示例#1
0
文件: app.go 项目: jango2015/bloggo
func (c Application) NavLeft() revel.Result {
	UserCreate := c.ActiveUser.CanBeCreatedBy(c.MongoSession, c.ActiveUser)

	article := new(models.Article)
	ArticleCreate := article.CanBeCreatedBy(c.MongoSession, c.ActiveUser)
	return c.Render(UserCreate, ArticleCreate)
}
示例#2
0
文件: blog.go 项目: jango2015/bloggo
func (c Blog) GetCreate() revel.Result {
	article := models.Article{}
	if article.CanBeCreatedBy(c.MongoSession, c.ActiveUser) {
		action := "/blog/create"
		actionButton := "Create"
		return c.Render(action, article, actionButton)
	}
	return c.Forbidden("You are not allowed to create articles.")
}