feat: Implement access level checking
This commit is contained in:
parent
de7eca3c3a
commit
a58a2d9397
6 changed files with 32 additions and 7 deletions
|
@ -26,7 +26,7 @@ func (m *Module) Name() string {
|
||||||
return "discord"
|
return "discord"
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Module) MinAccessLevel() int {
|
func (m *Module) MinAccessLevel() int64 {
|
||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ func (m *Module) FriendlyName() string {
|
||||||
return "Hello World"
|
return "Hello World"
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Module) MinAccessLevel() int {
|
func (m *Module) MinAccessLevel() int64 {
|
||||||
return 2136
|
return 2136
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
23
manager.go
23
manager.go
|
@ -16,6 +16,19 @@ func (mm *ModuleManager) RegisterViews(system http.FileSystem) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mm *ModuleManager) Fiber(handlers ...fiber.Handler) fiber.Router {
|
func (mm *ModuleManager) Fiber(handlers ...fiber.Handler) fiber.Router {
|
||||||
|
handlers = append([]fiber.Handler{
|
||||||
|
func(ctx *fiber.Ctx) error {
|
||||||
|
min := mm.module.MinAccessLevel()
|
||||||
|
if min > 0 {
|
||||||
|
user := mm.User(ctx)
|
||||||
|
if user == nil || user.AccessLevel < min {
|
||||||
|
return ctx.Redirect("/")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ctx.Next()
|
||||||
|
},
|
||||||
|
}, handlers...)
|
||||||
return mm.app.fiber.Group("/" + mm.module.Name() + "/", handlers...)
|
return mm.app.fiber.Group("/" + mm.module.Name() + "/", handlers...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,6 +40,16 @@ func (mm *ModuleManager) Session(ctx *fiber.Ctx) *session.Store {
|
||||||
return mm.app.sessions.Get(ctx)
|
return mm.app.sessions.Get(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (mm *ModuleManager) User(ctx *fiber.Ctx) *User {
|
||||||
|
sess := mm.app.sessions.Get(ctx)
|
||||||
|
if _, ok := sess.Get("user:id").(string); ok {
|
||||||
|
user := &User{}
|
||||||
|
user.Load(sess)
|
||||||
|
return user
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (mm *ModuleManager) SetHomepage(template string) {
|
func (mm *ModuleManager) SetHomepage(template string) {
|
||||||
mm.app.homepage = mm.module.Name() + "/" + template
|
mm.app.homepage = mm.module.Name() + "/" + template
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,5 +5,5 @@ type Module interface {
|
||||||
Name() string
|
Name() string
|
||||||
Init(mm *ModuleManager)
|
Init(mm *ModuleManager)
|
||||||
Hidden() bool
|
Hidden() bool
|
||||||
MinAccessLevel() int
|
MinAccessLevel() int64
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// Code generated by fileb0x at "2020-11-17 12:35:27.231593119 +0100 CET m=+0.000776517" from config file "b0x.yaml" DO NOT EDIT.
|
// Code generated by fileb0x at "2020-11-17 14:52:53.48227984 +0100 CET m=+0.000817080" from config file "b0x.yaml" DO NOT EDIT.
|
||||||
// modification hash(74f3a43ca362aef2d92e3524f489213c.a37039530e23f5be41165838b856aadc)
|
// modification hash(a2b5de76ae4db1495bdfcdc8ee505a4a.a37039530e23f5be41165838b856aadc)
|
||||||
|
|
||||||
package static
|
package static
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ var FileLayoutsMainHTML = []byte("\x3c\x21\x64\x6f\x63\x74\x79\x70\x65\x20\x68\x
|
||||||
var FilePartialsNavbarLoginHTML = []byte("\x3c\x64\x69\x76\x20\x63\x6c\x61\x73\x73\x3d\x22\x6e\x61\x76\x62\x61\x72\x2d\x65\x6e\x64\x22\x3e\x0a\x20\x20\x20\x20\x3c\x64\x69\x76\x20\x63\x6c\x61\x73\x73\x3d\x22\x6e\x61\x76\x62\x61\x72\x2d\x69\x74\x65\x6d\x22\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x7b\x7b\x20\x69\x66\x20\x2e\x75\x73\x65\x72\x20\x2d\x7d\x7d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x64\x69\x76\x20\x63\x6c\x61\x73\x73\x3d\x22\x62\x75\x74\x74\x6f\x6e\x73\x22\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x61\x20\x63\x6c\x61\x73\x73\x3d\x22\x62\x75\x74\x74\x6f\x6e\x20\x69\x73\x2d\x6c\x69\x67\x68\x74\x22\x20\x68\x72\x65\x66\x3d\x22\x2f\x6c\x6f\x67\x6f\x75\x74\x22\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x73\x70\x61\x6e\x3e\x4c\x6f\x67\x20\x6f\x75\x74\x20\x3c\x62\x3e\x7b\x7b\x20\x2e\x75\x73\x65\x72\x2e\x44\x69\x73\x70\x6c\x61\x79\x4e\x61\x6d\x65\x20\x7d\x7d\x3c\x2f\x62\x3e\x3c\x2f\x73\x70\x61\x6e\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x2f\x61\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x2f\x64\x69\x76\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x7b\x7b\x2d\x20\x65\x6c\x73\x65\x20\x2d\x7d\x7d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x7b\x7b\x20\x69\x66\x20\x65\x71\x20\x28\x6c\x65\x6e\x20\x2e\x61\x75\x74\x68\x29\x20\x31\x20\x2d\x7d\x7d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x7b\x7b\x20\x77\x69\x74\x68\x20\x28\x69\x6e\x64\x65\x78\x20\x2e\x61\x75\x74\x68\x20\x30\x29\x20\x2d\x7d\x7d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x64\x69\x76\x20\x63\x6c\x61\x73\x73\x3d\x22\x62\x75\x74\x74\x6f\x6e\x73\x22\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x61\x20\x63\x6c\x61\x73\x73\x3d\x22\x62\x75\x74\x74\x6f\x6e\x20\x69\x73\x2d\x6c\x69\x67\x68\x74\x22\x20\x68\x72\x65\x66\x3d\x22\x7b\x7b\x20\x2e\x4c\x6f\x67\x69\x6e\x55\x52\x4c\x20\x7d\x7d\x22\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x4c\x6f\x67\x20\x69\x6e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x2f\x61\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x7b\x7b\x20\x69\x66\x20\x2e\x52\x65\x67\x69\x73\x74\x65\x72\x55\x52\x4c\x20\x2d\x7d\x7d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x61\x20\x63\x6c\x61\x73\x73\x3d\x22\x62\x75\x74\x74\x6f\x6e\x20\x69\x73\x2d\x6c\x69\x67\x68\x74\x22\x20\x68\x72\x65\x66\x3d\x22\x7b\x7b\x20\x2e\x52\x65\x67\x69\x73\x74\x65\x72\x55\x52\x4c\x20\x7d\x7d\x22\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x52\x65\x67\x69\x73\x74\x65\x72\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x2f\x61\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x7b\x7b\x2d\x20\x65\x6e\x64\x20\x7d\x7d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x2f\x64\x69\x76\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x7b\x7b\x2d\x20\x65\x6e\x64\x20\x7d\x7d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x7b\x7b\x2d\x20\x65\x6e\x64\x20\x7d\x7d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x7b\x7b\x2d\x20\x65\x6e\x64\x20\x7d\x7d\x0a\x20\x20\x20\x20\x3c\x2f\x64\x69\x76\x3e\x0a\x3c\x2f\x64\x69\x76\x3e\x0a")
|
var FilePartialsNavbarLoginHTML = []byte("\x3c\x64\x69\x76\x20\x63\x6c\x61\x73\x73\x3d\x22\x6e\x61\x76\x62\x61\x72\x2d\x65\x6e\x64\x22\x3e\x0a\x20\x20\x20\x20\x3c\x64\x69\x76\x20\x63\x6c\x61\x73\x73\x3d\x22\x6e\x61\x76\x62\x61\x72\x2d\x69\x74\x65\x6d\x22\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x7b\x7b\x20\x69\x66\x20\x2e\x75\x73\x65\x72\x20\x2d\x7d\x7d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x64\x69\x76\x20\x63\x6c\x61\x73\x73\x3d\x22\x62\x75\x74\x74\x6f\x6e\x73\x22\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x61\x20\x63\x6c\x61\x73\x73\x3d\x22\x62\x75\x74\x74\x6f\x6e\x20\x69\x73\x2d\x6c\x69\x67\x68\x74\x22\x20\x68\x72\x65\x66\x3d\x22\x2f\x6c\x6f\x67\x6f\x75\x74\x22\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x73\x70\x61\x6e\x3e\x4c\x6f\x67\x20\x6f\x75\x74\x20\x3c\x62\x3e\x7b\x7b\x20\x2e\x75\x73\x65\x72\x2e\x44\x69\x73\x70\x6c\x61\x79\x4e\x61\x6d\x65\x20\x7d\x7d\x3c\x2f\x62\x3e\x3c\x2f\x73\x70\x61\x6e\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x2f\x61\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x2f\x64\x69\x76\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x7b\x7b\x2d\x20\x65\x6c\x73\x65\x20\x2d\x7d\x7d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x7b\x7b\x20\x69\x66\x20\x65\x71\x20\x28\x6c\x65\x6e\x20\x2e\x61\x75\x74\x68\x29\x20\x31\x20\x2d\x7d\x7d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x7b\x7b\x20\x77\x69\x74\x68\x20\x28\x69\x6e\x64\x65\x78\x20\x2e\x61\x75\x74\x68\x20\x30\x29\x20\x2d\x7d\x7d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x64\x69\x76\x20\x63\x6c\x61\x73\x73\x3d\x22\x62\x75\x74\x74\x6f\x6e\x73\x22\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x61\x20\x63\x6c\x61\x73\x73\x3d\x22\x62\x75\x74\x74\x6f\x6e\x20\x69\x73\x2d\x6c\x69\x67\x68\x74\x22\x20\x68\x72\x65\x66\x3d\x22\x7b\x7b\x20\x2e\x4c\x6f\x67\x69\x6e\x55\x52\x4c\x20\x7d\x7d\x22\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x4c\x6f\x67\x20\x69\x6e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x2f\x61\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x7b\x7b\x20\x69\x66\x20\x2e\x52\x65\x67\x69\x73\x74\x65\x72\x55\x52\x4c\x20\x2d\x7d\x7d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x61\x20\x63\x6c\x61\x73\x73\x3d\x22\x62\x75\x74\x74\x6f\x6e\x20\x69\x73\x2d\x6c\x69\x67\x68\x74\x22\x20\x68\x72\x65\x66\x3d\x22\x7b\x7b\x20\x2e\x52\x65\x67\x69\x73\x74\x65\x72\x55\x52\x4c\x20\x7d\x7d\x22\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x52\x65\x67\x69\x73\x74\x65\x72\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x2f\x61\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x7b\x7b\x2d\x20\x65\x6e\x64\x20\x7d\x7d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x2f\x64\x69\x76\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x7b\x7b\x2d\x20\x65\x6e\x64\x20\x7d\x7d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x7b\x7b\x2d\x20\x65\x6e\x64\x20\x7d\x7d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x7b\x7b\x2d\x20\x65\x6e\x64\x20\x7d\x7d\x0a\x20\x20\x20\x20\x3c\x2f\x64\x69\x76\x3e\x0a\x3c\x2f\x64\x69\x76\x3e\x0a")
|
||||||
|
|
||||||
// FilePartialsNavbarModulesHTML is "partials/navbar-modules.html"
|
// FilePartialsNavbarModulesHTML is "partials/navbar-modules.html"
|
||||||
var FilePartialsNavbarModulesHTML = []byte("\x3c\x64\x69\x76\x20\x63\x6c\x61\x73\x73\x3d\x22\x6e\x61\x76\x62\x61\x72\x2d\x73\x74\x61\x72\x74\x22\x3e\x0a\x20\x20\x20\x20\x7b\x7b\x20\x72\x61\x6e\x67\x65\x20\x2e\x6d\x6f\x64\x75\x6c\x65\x73\x20\x2d\x7d\x7d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x7b\x7b\x20\x69\x66\x20\x6e\x6f\x74\x20\x2e\x48\x69\x64\x64\x65\x6e\x20\x2d\x7d\x7d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x61\x20\x68\x72\x65\x66\x3d\x22\x2f\x7b\x7b\x20\x2e\x4e\x61\x6d\x65\x20\x7d\x7d\x2f\x22\x20\x63\x6c\x61\x73\x73\x3d\x22\x6e\x61\x76\x62\x61\x72\x2d\x69\x74\x65\x6d\x22\x3e\x7b\x7b\x20\x2e\x46\x72\x69\x65\x6e\x64\x6c\x79\x4e\x61\x6d\x65\x20\x7d\x7d\x3c\x2f\x61\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x7b\x7b\x2d\x20\x65\x6e\x64\x20\x7d\x7d\x0a\x20\x20\x20\x20\x7b\x7b\x2d\x20\x65\x6e\x64\x20\x7d\x7d\x0a\x3c\x2f\x64\x69\x76\x3e\x0a")
|
var FilePartialsNavbarModulesHTML = []byte("\x3c\x64\x69\x76\x20\x63\x6c\x61\x73\x73\x3d\x22\x6e\x61\x76\x62\x61\x72\x2d\x73\x74\x61\x72\x74\x22\x3e\x0a\x20\x20\x20\x20\x7b\x7b\x20\x72\x61\x6e\x67\x65\x20\x2e\x6d\x6f\x64\x75\x6c\x65\x73\x20\x2d\x7d\x7d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x7b\x7b\x20\x69\x66\x20\x6e\x6f\x74\x20\x2e\x48\x69\x64\x64\x65\x6e\x20\x2d\x7d\x7d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x7b\x7b\x20\x69\x66\x20\x67\x65\x20\x24\x2e\x75\x73\x65\x72\x2e\x41\x63\x63\x65\x73\x73\x4c\x65\x76\x65\x6c\x20\x2e\x4d\x69\x6e\x41\x63\x63\x65\x73\x73\x4c\x65\x76\x65\x6c\x20\x2d\x7d\x7d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x61\x20\x68\x72\x65\x66\x3d\x22\x2f\x7b\x7b\x20\x2e\x4e\x61\x6d\x65\x20\x7d\x7d\x2f\x22\x20\x63\x6c\x61\x73\x73\x3d\x22\x6e\x61\x76\x62\x61\x72\x2d\x69\x74\x65\x6d\x22\x3e\x7b\x7b\x20\x2e\x46\x72\x69\x65\x6e\x64\x6c\x79\x4e\x61\x6d\x65\x20\x7d\x7d\x3c\x2f\x61\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x7b\x7b\x2d\x20\x65\x6e\x64\x20\x7d\x7d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x7b\x7b\x2d\x20\x65\x6e\x64\x20\x7d\x7d\x0a\x20\x20\x20\x20\x7b\x7b\x2d\x20\x65\x6e\x64\x20\x7d\x7d\x0a\x3c\x2f\x64\x69\x76\x3e\x0a")
|
||||||
|
|
||||||
// FilePartialsNavbarHTML is "partials/navbar.html"
|
// FilePartialsNavbarHTML is "partials/navbar.html"
|
||||||
var FilePartialsNavbarHTML = []byte("\x3c\x6e\x61\x76\x20\x63\x6c\x61\x73\x73\x3d\x22\x6e\x61\x76\x62\x61\x72\x20\x69\x73\x2d\x69\x6e\x66\x6f\x22\x20\x72\x6f\x6c\x65\x3d\x22\x6e\x61\x76\x69\x67\x61\x74\x69\x6f\x6e\x22\x20\x61\x72\x69\x61\x2d\x6c\x61\x62\x65\x6c\x3d\x22\x6d\x61\x69\x6e\x20\x6e\x61\x76\x69\x67\x61\x74\x69\x6f\x6e\x22\x3e\x0a\x20\x20\x20\x20\x3c\x64\x69\x76\x20\x69\x64\x3d\x22\x6e\x61\x76\x62\x61\x72\x42\x61\x73\x69\x63\x45\x78\x61\x6d\x70\x6c\x65\x22\x20\x63\x6c\x61\x73\x73\x3d\x22\x6e\x61\x76\x62\x61\x72\x2d\x6d\x65\x6e\x75\x22\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x64\x69\x76\x20\x63\x6c\x61\x73\x73\x3d\x22\x6e\x61\x76\x62\x61\x72\x2d\x62\x72\x61\x6e\x64\x22\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x61\x20\x63\x6c\x61\x73\x73\x3d\x22\x6e\x61\x76\x62\x61\x72\x2d\x69\x74\x65\x6d\x22\x20\x68\x72\x65\x66\x3d\x22\x2f\x22\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x62\x3e\x7b\x7b\x20\x2e\x61\x70\x70\x2e\x43\x6f\x6e\x66\x69\x67\x2e\x41\x70\x70\x4e\x61\x6d\x65\x20\x7d\x7d\x3c\x2f\x62\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x2f\x61\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x2f\x64\x69\x76\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x7b\x7b\x20\x69\x66\x20\x6f\x72\x20\x2e\x75\x73\x65\x72\x20\x28\x6e\x6f\x74\x20\x2e\x61\x70\x70\x2e\x41\x75\x74\x68\x53\x75\x70\x70\x6f\x72\x74\x65\x64\x29\x20\x2d\x7d\x7d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x7b\x7b\x20\x74\x65\x6d\x70\x6c\x61\x74\x65\x20\x22\x70\x61\x72\x74\x69\x61\x6c\x73\x2f\x6e\x61\x76\x62\x61\x72\x2d\x6d\x6f\x64\x75\x6c\x65\x73\x22\x20\x2e\x20\x7d\x7d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x7b\x7b\x2d\x20\x65\x6e\x64\x20\x7d\x7d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x7b\x7b\x20\x69\x66\x20\x2e\x61\x70\x70\x2e\x41\x75\x74\x68\x53\x75\x70\x70\x6f\x72\x74\x65\x64\x20\x2d\x7d\x7d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x7b\x7b\x20\x74\x65\x6d\x70\x6c\x61\x74\x65\x20\x22\x70\x61\x72\x74\x69\x61\x6c\x73\x2f\x6e\x61\x76\x62\x61\x72\x2d\x6c\x6f\x67\x69\x6e\x22\x20\x2e\x20\x7d\x7d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x7b\x7b\x20\x65\x6e\x64\x20\x7d\x7d\x0a\x20\x20\x20\x20\x3c\x2f\x64\x69\x76\x3e\x0a\x3c\x2f\x6e\x61\x76\x3e\x0a")
|
var FilePartialsNavbarHTML = []byte("\x3c\x6e\x61\x76\x20\x63\x6c\x61\x73\x73\x3d\x22\x6e\x61\x76\x62\x61\x72\x20\x69\x73\x2d\x69\x6e\x66\x6f\x22\x20\x72\x6f\x6c\x65\x3d\x22\x6e\x61\x76\x69\x67\x61\x74\x69\x6f\x6e\x22\x20\x61\x72\x69\x61\x2d\x6c\x61\x62\x65\x6c\x3d\x22\x6d\x61\x69\x6e\x20\x6e\x61\x76\x69\x67\x61\x74\x69\x6f\x6e\x22\x3e\x0a\x20\x20\x20\x20\x3c\x64\x69\x76\x20\x69\x64\x3d\x22\x6e\x61\x76\x62\x61\x72\x42\x61\x73\x69\x63\x45\x78\x61\x6d\x70\x6c\x65\x22\x20\x63\x6c\x61\x73\x73\x3d\x22\x6e\x61\x76\x62\x61\x72\x2d\x6d\x65\x6e\x75\x22\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x64\x69\x76\x20\x63\x6c\x61\x73\x73\x3d\x22\x6e\x61\x76\x62\x61\x72\x2d\x62\x72\x61\x6e\x64\x22\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x61\x20\x63\x6c\x61\x73\x73\x3d\x22\x6e\x61\x76\x62\x61\x72\x2d\x69\x74\x65\x6d\x22\x20\x68\x72\x65\x66\x3d\x22\x2f\x22\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x62\x3e\x7b\x7b\x20\x2e\x61\x70\x70\x2e\x43\x6f\x6e\x66\x69\x67\x2e\x41\x70\x70\x4e\x61\x6d\x65\x20\x7d\x7d\x3c\x2f\x62\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x2f\x61\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x2f\x64\x69\x76\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x7b\x7b\x20\x69\x66\x20\x6f\x72\x20\x2e\x75\x73\x65\x72\x20\x28\x6e\x6f\x74\x20\x2e\x61\x70\x70\x2e\x41\x75\x74\x68\x53\x75\x70\x70\x6f\x72\x74\x65\x64\x29\x20\x2d\x7d\x7d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x7b\x7b\x20\x74\x65\x6d\x70\x6c\x61\x74\x65\x20\x22\x70\x61\x72\x74\x69\x61\x6c\x73\x2f\x6e\x61\x76\x62\x61\x72\x2d\x6d\x6f\x64\x75\x6c\x65\x73\x22\x20\x2e\x20\x7d\x7d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x7b\x7b\x2d\x20\x65\x6e\x64\x20\x7d\x7d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x7b\x7b\x20\x69\x66\x20\x2e\x61\x70\x70\x2e\x41\x75\x74\x68\x53\x75\x70\x70\x6f\x72\x74\x65\x64\x20\x2d\x7d\x7d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x7b\x7b\x20\x74\x65\x6d\x70\x6c\x61\x74\x65\x20\x22\x70\x61\x72\x74\x69\x61\x6c\x73\x2f\x6e\x61\x76\x62\x61\x72\x2d\x6c\x6f\x67\x69\x6e\x22\x20\x2e\x20\x7d\x7d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x7b\x7b\x20\x65\x6e\x64\x20\x7d\x7d\x0a\x20\x20\x20\x20\x3c\x2f\x64\x69\x76\x3e\x0a\x3c\x2f\x6e\x61\x76\x3e\x0a")
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
<div class="navbar-start">
|
<div class="navbar-start">
|
||||||
{{ range .modules -}}
|
{{ range .modules -}}
|
||||||
{{ if not .Hidden -}}
|
{{ if not .Hidden -}}
|
||||||
|
{{ if ge $.user.AccessLevel .MinAccessLevel -}}
|
||||||
<a href="/{{ .Name }}/" class="navbar-item">{{ .FriendlyName }}</a>
|
<a href="/{{ .Name }}/" class="navbar-item">{{ .FriendlyName }}</a>
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue