Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ai3
accountserver
Commits
3ae8fb58
Commit
3ae8fb58
authored
Jul 19, 2018
by
ale
Browse files
Get UIDs from LDAP (where present)
parent
9dc319af
Changes
1
Hide whitespace changes
Inline
Side-by-side
backend/resources.go
View file @
3ae8fb58
...
...
@@ -3,6 +3,7 @@ package backend
import
(
"errors"
"fmt"
"strconv"
"strings"
"gopkg.in/ldap.v2"
...
...
@@ -256,6 +257,7 @@ func (h *websiteResourceHandler) FromLDAP(entry *ldap.Entry) (*accountserver.Res
parentSite
:=
entry
.
GetAttributeValue
(
"parentSite"
)
name
:=
fmt
.
Sprintf
(
"%s/%s"
,
parentSite
,
alias
)
url
:=
fmt
.
Sprintf
(
"https://www.%s/%s/"
,
parentSite
,
alias
)
uid
,
_
:=
strconv
.
Atoi
(
entry
.
GetAttributeValue
(
uidNumberLDAPAttr
))
username
,
err
:=
getParentRDN
(
entry
.
DN
,
"uid"
)
if
err
!=
nil
{
...
...
@@ -270,6 +272,7 @@ func (h *websiteResourceHandler) FromLDAP(entry *ldap.Entry) (*accountserver.Res
Name
:
name
,
Website
:
&
accountserver
.
Website
{
URL
:
url
,
UID
:
uid
,
ParentDomain
:
parentSite
,
Options
:
entry
.
GetAttributeValues
(
"option"
),
DocumentRoot
:
entry
.
GetAttributeValue
(
"documentRoot"
),
...
...
@@ -324,6 +327,8 @@ func (h *domainResourceHandler) FromLDAP(entry *ldap.Entry) (*accountserver.Reso
if
err
!=
nil
{
return
nil
,
err
}
uid
,
_
:=
strconv
.
Atoi
(
entry
.
GetAttributeValue
(
uidNumberLDAPAttr
))
return
&
accountserver
.
Resource
{
ID
:
accountserver
.
NewResourceID
(
accountserver
.
ResourceTypeDomain
,
...
...
@@ -333,6 +338,7 @@ func (h *domainResourceHandler) FromLDAP(entry *ldap.Entry) (*accountserver.Reso
Name
:
cn
,
Website
:
&
accountserver
.
Website
{
URL
:
fmt
.
Sprintf
(
"https://%s/"
,
cn
),
UID
:
uid
,
Options
:
entry
.
GetAttributeValues
(
"option"
),
DocumentRoot
:
entry
.
GetAttributeValue
(
"documentRoot"
),
AcceptMail
:
s2b
(
entry
.
GetAttributeValue
(
"acceptMail"
)),
...
...
@@ -385,6 +391,7 @@ func (h *webdavResourceHandler) FromLDAP(entry *ldap.Entry) (*accountserver.Reso
if
err
!=
nil
{
return
nil
,
err
}
uid
,
_
:=
strconv
.
Atoi
(
entry
.
GetAttributeValue
(
uidNumberLDAPAttr
))
return
&
accountserver
.
Resource
{
ID
:
accountserver
.
NewResourceID
(
accountserver
.
ResourceTypeDAV
,
...
...
@@ -394,6 +401,7 @@ func (h *webdavResourceHandler) FromLDAP(entry *ldap.Entry) (*accountserver.Reso
Name
:
name
,
DAV
:
&
accountserver
.
WebDAV
{
Homedir
:
entry
.
GetAttributeValue
(
"homeDirectory"
),
UID
:
uid
,
},
},
nil
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment