admin: Allow impersonation and deactivation
This commit is contained in:
parent
2384ee0841
commit
7d0fb60d67
6 changed files with 74 additions and 5 deletions
|
|
@ -30,6 +30,7 @@ type UserPanel struct {
|
|||
|
||||
var (
|
||||
_ component.Routeable = (*UserPanel)(nil)
|
||||
_ component.Menuable = (*UserPanel)(nil)
|
||||
)
|
||||
|
||||
func (panel *UserPanel) Routes() component.Routes {
|
||||
|
|
@ -37,9 +38,18 @@ func (panel *UserPanel) Routes() component.Routes {
|
|||
Prefix: "/user/",
|
||||
CSRF: true,
|
||||
Decorator: panel.Dependencies.Auth.Require(nil),
|
||||
}
|
||||
}
|
||||
|
||||
MenuPriority: component.MenuUser,
|
||||
MenuTitle: "User",
|
||||
func (panel *UserPanel) Menu(r *http.Request) []component.MenuItem {
|
||||
title := "Login"
|
||||
|
||||
user, err := panel.Dependencies.Auth.UserOf(r)
|
||||
if user != nil && err == nil {
|
||||
title = user.User.User
|
||||
}
|
||||
return []component.MenuItem{
|
||||
{Title: title, Priority: component.MenuUser, Path: "/user/"},
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue