aboutsummaryrefslogtreecommitdiff
path: root/admin.go
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2020-02-10 09:44:18 +0100
committerAlex Auvolat <alex@adnab.me>2020-02-10 09:44:18 +0100
commit9f891bdb9a41de73f5970219b2557b4039358a4f (patch)
tree703079e5b19a80dd74ed3b2f1495d89552ee3445 /admin.go
parenta6114cda7cc145c9f8f2bb0d2f1fd47e94ae845c (diff)
downloadguichet-9f891bdb9a41de73f5970219b2557b4039358a4f.tar.gz
guichet-9f891bdb9a41de73f5970219b2557b4039358a4f.zip
Minor UI changes
Diffstat (limited to 'admin.go')
-rw-r--r--admin.go14
1 files changed, 12 insertions, 2 deletions
diff --git a/admin.go b/admin.go
index 33c63e7..8803531 100644
--- a/admin.go
+++ b/admin.go
@@ -50,6 +50,7 @@ func (d EntryList) Less(i, j int) bool {
type AdminUsersTplData struct {
Login *LoginStatus
UserNameAttr string
+ UserBaseDN string
Users EntryList
}
@@ -77,6 +78,7 @@ func handleAdminUsers(w http.ResponseWriter, r *http.Request) {
data := &AdminUsersTplData{
Login: login,
UserNameAttr: config.UserNameAttr,
+ UserBaseDN: config.UserBaseDN,
Users: EntryList(sr.Entries),
}
sort.Sort(data.Users)
@@ -87,6 +89,7 @@ func handleAdminUsers(w http.ResponseWriter, r *http.Request) {
type AdminGroupsTplData struct {
Login *LoginStatus
GroupNameAttr string
+ GroupBaseDN string
Groups EntryList
}
@@ -114,6 +117,7 @@ func handleAdminGroups(w http.ResponseWriter, r *http.Request) {
data := &AdminGroupsTplData{
Login: login,
GroupNameAttr: config.GroupNameAttr,
+ GroupBaseDN: config.GroupBaseDN,
Groups: EntryList(sr.Entries),
}
sort.Sort(data.Groups)
@@ -439,7 +443,7 @@ func handleAdminLDAP(w http.ResponseWriter, r *http.Request) {
if val, ok := props["objectclass"]; ok {
objectClass = val.Values
}
- hasMembers, hasGroups := false, false
+ hasMembers, hasGroups, isOrganization := false, false, false
for _, oc := range objectClass {
if strings.EqualFold(oc, "organizationalperson") || strings.EqualFold(oc, "person") {
hasGroups = true
@@ -447,6 +451,9 @@ func handleAdminLDAP(w http.ResponseWriter, r *http.Request) {
if strings.EqualFold(oc, "groupOfNames") {
hasMembers = true
}
+ if strings.EqualFold(oc, "organization") {
+ isOrganization = true
+ }
}
templateAdminLDAP.Execute(w, &AdminLDAPTplData{
@@ -455,7 +462,7 @@ func handleAdminLDAP(w http.ResponseWriter, r *http.Request) {
Path: path,
Children: children,
Props: props,
- CanAddChild: dn_last_attr == "ou",
+ CanAddChild: dn_last_attr == "ou" || isOrganization,
CanDelete: dn != config.BaseDN && len(children) == 0,
HasMembers: len(members) > 0 || hasMembers,
@@ -477,6 +484,7 @@ type CreateData struct {
DisplayName string
StructuralObjectClass string
ObjectClass string
+ IsTemplated bool
Error string
}
@@ -518,10 +526,12 @@ func handleAdminCreate(w http.ResponseWriter, r *http.Request) {
data.IdType = config.UserNameAttr
data.StructuralObjectClass = "inetOrgPerson"
data.ObjectClass = "inetOrgPerson\norganizationalPerson\nperson\ntop"
+ data.IsTemplated = true
} else if template == "group" {
data.IdType = config.UserNameAttr
data.StructuralObjectClass = "groupOfNames"
data.ObjectClass = "groupOfNames\ntop"
+ data.IsTemplated = true
} else {
data.IdType = "cn"
data.ObjectClass = "top"