diff options
author | MrArmonius <mrarmonius@gmail.com> | 2021-07-26 23:01:48 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2021-08-16 12:54:08 +0200 |
commit | 815e9bfe2a912f0804de4882a11fd349b2f4d796 (patch) | |
tree | 0e9abbaef84d8ef900f217984808821c8234c817 /profile.go | |
parent | cf4918e901da8f2c388eebd33a500bf737943685 (diff) | |
download | guichet-815e9bfe2a912f0804de4882a11fd349b2f4d796.tar.gz guichet-815e9bfe2a912f0804de4882a11fd349b2f4d796.zip |
Add Description and visibility attributes
Modify in profil's page your description and your choice about show you
on the directory. The default visibility's choice is false. Tthe
description is empty by default.
In the directory, a new row exist to show the description.
Adapt view in column Description
I use the style `word-break: break-all;` on the `<td>`
Diffstat (limited to 'profile.go')
-rw-r--r-- | profile.go | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -16,6 +16,8 @@ type ProfileTplData struct { DisplayName string GivenName string Surname string + Visibility string + Description string } func handleProfile(w http.ResponseWriter, r *http.Request) { @@ -36,6 +38,8 @@ func handleProfile(w http.ResponseWriter, r *http.Request) { data.DisplayName = login.UserEntry.GetAttributeValue("displayname") data.GivenName = login.UserEntry.GetAttributeValue("givenname") data.Surname = login.UserEntry.GetAttributeValue("sn") + data.Visibility = login.UserEntry.GetAttributeValue("visibility") + data.Description = login.UserEntry.GetAttributeValue("description") if r.Method == "POST" { r.ParseForm() @@ -43,11 +47,15 @@ func handleProfile(w http.ResponseWriter, r *http.Request) { data.DisplayName = strings.TrimSpace(strings.Join(r.Form["display_name"], "")) data.GivenName = strings.TrimSpace(strings.Join(r.Form["given_name"], "")) data.Surname = strings.TrimSpace(strings.Join(r.Form["surname"], "")) + data.Description = strings.Trim(strings.Join(r.Form["description"], ""), "") + data.Visibility = strings.TrimSpace(strings.Join(r.Form["visibility"], "")) modify_request := ldap.NewModifyRequest(login.Info.DN, nil) modify_request.Replace("displayname", []string{data.DisplayName}) modify_request.Replace("givenname", []string{data.GivenName}) modify_request.Replace("sn", []string{data.Surname}) + modify_request.Replace("description", []string{data.Description}) + modify_request.Replace("visibility", []string{data.Visibility}) err := login.conn.Modify(modify_request) if err != nil { |