top
 	rbac := middleware.NewRbac()
 	m.Map(rbac)

	m.Get("/article/edit", func(c *middleware.Context, rbac *middleware.Rbac) {
		ok := rbac.IsGranted("editor", "edit.article",
			func(role, permission string, rbac *middleware.Rbac) bool {
				return article.Owner == User.Id
			})
		if ok {
			fmt.Println("have permission....")
		} else {
			fmt.Println("not have permission....")
		}
		c.HTML(200, "index", c.Data)
	})

Imports 5 package(s) ΒΆ

  1. github.com/go-martini/martini
  2. github.com/forease/i18n
  3. github.com/martini-contrib/sessions
  4. github.com/martini-contrib/binding
  5. github.com/martini-contrib/render