From 85a0a21d15533b93d444a7253e5447b2cb5557aa Mon Sep 17 00:00:00 2001 From: Francesco Minnocci Date: Sun, 28 Aug 2022 12:23:24 +0200 Subject: [PATCH] feat: update users via Ldap --- cmd/phc-website-server/main.go | 8 ++++---- handler/handler.go | 9 ++++----- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/cmd/phc-website-server/main.go b/cmd/phc-website-server/main.go index 97a4f43..101707e 100644 --- a/cmd/phc-website-server/main.go +++ b/cmd/phc-website-server/main.go @@ -3,7 +3,6 @@ package main import ( "log" - "git.phc.dm.unipi.it/phc/website" "git.phc.dm.unipi.it/phc/website/articles" "git.phc.dm.unipi.it/phc/website/auth" "git.phc.dm.unipi.it/phc/website/config" @@ -25,9 +24,10 @@ func main() { ), NewsArticlesRegistry: articles.NewRegistry("./_content/news"), GuideArticlesRegistry: articles.NewRegistry("./_content/guide"), - ListaUtenti: &website.JsonFileListaUtenti{ - Path: "./utenti-poisson-2022.local.json", - }, + // ListaUtenti: &website.JsonFileListaUtenti{ + // Path: "./utenti-poisson-2022.local.json", + // }, + ListaUtentiService: auth.NewLDAPAuthService(config.AuthServiceHost), Storia: &storia.JsonFileStoria{ Path: "./storia.json", }, diff --git a/handler/handler.go b/handler/handler.go index e76c889..34aab02 100644 --- a/handler/handler.go +++ b/handler/handler.go @@ -5,7 +5,6 @@ import ( "html/template" "io" - "git.phc.dm.unipi.it/phc/website" "git.phc.dm.unipi.it/phc/website/articles" "git.phc.dm.unipi.it/phc/website/auth" "git.phc.dm.unipi.it/phc/website/model" @@ -18,7 +17,7 @@ import ( type Service interface { HandleStaticPage(w io.Writer, view string, ctx Context) error HandleUtenti() ([]*model.User, error) - HandleListaUtenti() ([]website.UserInfo, error) + HandleListaUtenti() ([]*model.User, error) HandleStoriaPage(w io.Writer, ctx Context) error HandleQueryAppunti(w io.Writer, query string, ctx Context) error HandleAppuntiCondivisiPage(w io.Writer, ctx Context) error @@ -51,7 +50,7 @@ type DefaultHandler struct { Renderer *templates.TemplateRenderer NewsArticlesRegistry *articles.Registry GuideArticlesRegistry *articles.Registry - ListaUtenti website.ListaUtentiService + ListaUtentiService auth.Service Storia storia.StoriaService } @@ -70,8 +69,8 @@ func (h *DefaultHandler) HandleUtenti() ([]*model.User, error) { return utenti, nil } -func (h *DefaultHandler) HandleListaUtenti() ([]website.UserInfo, error) { - utenti, err := h.ListaUtenti.GetUtenti() +func (h *DefaultHandler) HandleListaUtenti() ([]*model.User, error) { + utenti, err := h.ListaUtentiService.GetUsers() if err != nil { return nil, err }