aboutsummaryrefslogtreecommitdiff
path: root/directory.go
diff options
context:
space:
mode:
authorMrArmonius <mrarmonius@gmail.com>2021-07-26 23:01:48 +0200
committerAlex Auvolat <alex@adnab.me>2021-08-16 12:54:08 +0200
commit815e9bfe2a912f0804de4882a11fd349b2f4d796 (patch)
tree0e9abbaef84d8ef900f217984808821c8234c817 /directory.go
parentcf4918e901da8f2c388eebd33a500bf737943685 (diff)
downloadguichet-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 'directory.go')
-rw-r--r--directory.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/directory.go b/directory.go
index 6a7ade2..6c1ab29 100644
--- a/directory.go
+++ b/directory.go
@@ -25,6 +25,7 @@ type SearchResult struct {
Identifiant string `json:"identifiant"`
Name string `json:"name"`
Email string `json:"email"`
+ Description string `json:"description"`
DN string `json:"dn"`
}
@@ -47,12 +48,12 @@ func handleSearch(w http.ResponseWriter, r *http.Request) {
return
}
- //Search value with ldap and filter
+ //Search values with ldap and filter
searchRequest := ldap.NewSearchRequest(
config.UserBaseDN,
ldap.ScopeSingleLevel, ldap.NeverDerefAliases, 0, 0, false,
- "(&(objectclass=organizationalPerson)(visibility=all))",
- []string{config.UserNameAttr, "displayname", "mail"},
+ "(&(objectclass=organizationalPerson)(visibility=on))",
+ []string{config.UserNameAttr, "displayname", "mail", "description"},
nil)
sr, err := login.conn.Search(searchRequest)
@@ -71,6 +72,7 @@ func handleSearch(w http.ResponseWriter, r *http.Request) {
Identifiant: values.GetAttributeValue("cn"),
Name: values.GetAttributeValue("displayname"),
Email: values.GetAttributeValue("email"),
+ Description: values.GetAttributeValue("description"),
DN: values.DN,
}),
}
@@ -78,7 +80,7 @@ func handleSearch(w http.ResponseWriter, r *http.Request) {
}
- //Convert interface to uint32 with Type Assertions and not a simple convert
+ //Convert interface to uint32 with Type Assertions and not a simple convert for messageID
if val_Raw, ok_raw := session.Values["MessageID"]; ok_raw {
if val, ok := val_Raw.(uint32); ok {
val += 1