diff --git a/admin.go b/admin.go index 1604f3f..47b6344 100644 --- a/admin.go +++ b/admin.go @@ -89,6 +89,20 @@ func handleAdminActivateUser(w http.ResponseWriter, r *http.Request) { http.Redirect(w, r, "/admin/ldap/"+"cn="+cn+","+config.UserBaseDN, http.StatusFound) } +func handleAdminUnactivateUser(w http.ResponseWriter, r *http.Request) { + cn := mux.Vars(r)["cn"] + login := checkAdminLogin(w, r) + if login == nil { + return + } + modifyRequest := *ldap.NewModifyDNRequest("cn="+cn+","+config.UserBaseDN, "cn="+cn, true, config.InvitationBaseDN) + err := login.conn.ModifyDN(&modifyRequest) + if err != nil { + return + } + http.Redirect(w, r, "/admin/ldap/"+"cn="+cn+","+config.UserBaseDN, http.StatusFound) +} + func handleAdminUsers(w http.ResponseWriter, r *http.Request) { templateAdminUsers := getTemplate("admin_users.html") diff --git a/templates/admin_activate.html b/templates/admin_activate.html index f7add1d..fde4f46 100644 --- a/templates/admin_activate.html +++ b/templates/admin_activate.html @@ -3,6 +3,7 @@ {{define "body"}} + @@ -16,9 +17,12 @@ + diff --git a/templates/admin_users.html b/templates/admin_users.html index 2fadf7c..f20ddcd 100644 --- a/templates/admin_users.html +++ b/templates/admin_users.html @@ -10,6 +10,7 @@
Login Email Nom d'ffichage
- {{$user.GetAttributeValue "cn"}} + Activer + {{$user.GetAttributeValue "cn"}} + {{$user.GetAttributeValue "mail"}} {{$user.GetAttributeValue "displayName"}} {{$user.GetAttributeValue "givenName"}}
+ @@ -18,6 +19,11 @@ {{with $root := .}} {{range $user := $root.Users}} +
Identifiant Nom complet Email
+ + Dèsactiver + + {{$user.GetAttributeValue $root.UserNameAttr}}