mirror of
https://github.com/osmarks/mycorrhiza.git
synced 2025-01-07 02:10:26 +00:00
Add /admin/reindex-users
This commit is contained in:
parent
8fc036ba1c
commit
f11314488c
@ -5,6 +5,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/bouncepaw/mycorrhiza/user"
|
"github.com/bouncepaw/mycorrhiza/user"
|
||||||
|
"github.com/bouncepaw/mycorrhiza/util"
|
||||||
"github.com/bouncepaw/mycorrhiza/views"
|
"github.com/bouncepaw/mycorrhiza/views"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -13,6 +14,7 @@ func initAdmin() {
|
|||||||
if user.AuthUsed {
|
if user.AuthUsed {
|
||||||
http.HandleFunc("/admin", handlerAdmin)
|
http.HandleFunc("/admin", handlerAdmin)
|
||||||
http.HandleFunc("/admin/shutdown", handlerAdminShutdown)
|
http.HandleFunc("/admin/shutdown", handlerAdminShutdown)
|
||||||
|
http.HandleFunc("/admin/reindex-users", handlerAdminReindexUsers)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -31,3 +33,11 @@ func handlerAdminShutdown(w http.ResponseWriter, rq *http.Request) {
|
|||||||
log.Fatal("An admin commanded the wiki to shutdown")
|
log.Fatal("An admin commanded the wiki to shutdown")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func handlerAdminReindexUsers(w http.ResponseWriter, rq *http.Request) {
|
||||||
|
log.Println(rq.URL)
|
||||||
|
if user.CanProceed(rq, "admin") && rq.Method == "POST" {
|
||||||
|
user.ReadUsersFromFilesystem()
|
||||||
|
http.Redirect(w, rq, "/hypha/"+util.UserHypha, http.StatusSeeOther)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -141,6 +141,12 @@ for u := range user.YieldUsers() {
|
|||||||
<input type="submit">
|
<input type="submit">
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</form>
|
</form>
|
||||||
|
<form action="/admin/reindex-users" method="POST" style="float:left">
|
||||||
|
<fieldset>
|
||||||
|
<legend>Reindex users</legend>
|
||||||
|
<input type="submit">
|
||||||
|
</fieldset>
|
||||||
|
</form>
|
||||||
</section>
|
</section>
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
|
@ -468,35 +468,41 @@ func StreamAdminPanelHTML(qw422016 *qt422016.Writer) {
|
|||||||
<input type="submit">
|
<input type="submit">
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</form>
|
</form>
|
||||||
|
<form action="/admin/reindex-users" method="POST" style="float:left">
|
||||||
|
<fieldset>
|
||||||
|
<legend>Reindex users</legend>
|
||||||
|
<input type="submit">
|
||||||
|
</fieldset>
|
||||||
|
</form>
|
||||||
</section>
|
</section>
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
`)
|
`)
|
||||||
//line views/stuff.qtpl:147
|
//line views/stuff.qtpl:153
|
||||||
}
|
}
|
||||||
|
|
||||||
//line views/stuff.qtpl:147
|
//line views/stuff.qtpl:153
|
||||||
func WriteAdminPanelHTML(qq422016 qtio422016.Writer) {
|
func WriteAdminPanelHTML(qq422016 qtio422016.Writer) {
|
||||||
//line views/stuff.qtpl:147
|
//line views/stuff.qtpl:153
|
||||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||||
//line views/stuff.qtpl:147
|
//line views/stuff.qtpl:153
|
||||||
StreamAdminPanelHTML(qw422016)
|
StreamAdminPanelHTML(qw422016)
|
||||||
//line views/stuff.qtpl:147
|
//line views/stuff.qtpl:153
|
||||||
qt422016.ReleaseWriter(qw422016)
|
qt422016.ReleaseWriter(qw422016)
|
||||||
//line views/stuff.qtpl:147
|
//line views/stuff.qtpl:153
|
||||||
}
|
}
|
||||||
|
|
||||||
//line views/stuff.qtpl:147
|
//line views/stuff.qtpl:153
|
||||||
func AdminPanelHTML() string {
|
func AdminPanelHTML() string {
|
||||||
//line views/stuff.qtpl:147
|
//line views/stuff.qtpl:153
|
||||||
qb422016 := qt422016.AcquireByteBuffer()
|
qb422016 := qt422016.AcquireByteBuffer()
|
||||||
//line views/stuff.qtpl:147
|
//line views/stuff.qtpl:153
|
||||||
WriteAdminPanelHTML(qb422016)
|
WriteAdminPanelHTML(qb422016)
|
||||||
//line views/stuff.qtpl:147
|
//line views/stuff.qtpl:153
|
||||||
qs422016 := string(qb422016.B)
|
qs422016 := string(qb422016.B)
|
||||||
//line views/stuff.qtpl:147
|
//line views/stuff.qtpl:153
|
||||||
qt422016.ReleaseByteBuffer(qb422016)
|
qt422016.ReleaseByteBuffer(qb422016)
|
||||||
//line views/stuff.qtpl:147
|
//line views/stuff.qtpl:153
|
||||||
return qs422016
|
return qs422016
|
||||||
//line views/stuff.qtpl:147
|
//line views/stuff.qtpl:153
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user