ldap user default role configuration
This commit is contained in:
parent
d5050338f3
commit
9a2257dd1e
|
@ -90,6 +90,8 @@ AuthFilter = "(&(uid=%s))"
|
|||
CoverAttributes = true
|
||||
TLS = false
|
||||
StartTLS = true
|
||||
# ldap user default roles
|
||||
DefaultRoles = ["Standard"]
|
||||
|
||||
[LDAP.Attributes]
|
||||
Nickname = "cn"
|
||||
|
|
|
@ -259,10 +259,14 @@ func LdapLogin(username, pass string) (*User, error) {
|
|||
|
||||
now := time.Now().Unix()
|
||||
|
||||
if len(config.C.LDAP.DefaultRoles) == 0 {
|
||||
config.C.LDAP.DefaultRoles = []string{"Standard"}
|
||||
}
|
||||
|
||||
user.Password = "******"
|
||||
user.Portrait = ""
|
||||
user.Roles = "Standard"
|
||||
user.RolesLst = []string{"Standard"}
|
||||
user.Roles = strings.Join(config.C.LDAP.DefaultRoles, " ")
|
||||
user.RolesLst = config.C.LDAP.DefaultRoles
|
||||
user.Contacts = []byte("{}")
|
||||
user.CreateAt = now
|
||||
user.UpdateAt = now
|
||||
|
|
|
@ -19,6 +19,7 @@ type LdapSection struct {
|
|||
CoverAttributes bool
|
||||
TLS bool
|
||||
StartTLS bool
|
||||
DefaultRoles []string
|
||||
}
|
||||
|
||||
type LdapAttributes struct {
|
||||
|
|
Loading…
Reference in New Issue