Merge branch 'main' of github.com:didi/nightingale
This commit is contained in:
commit
dcee4677ed
|
@ -93,6 +93,8 @@ AuthFilter = "(&(uid=%s))"
|
||||||
CoverAttributes = true
|
CoverAttributes = true
|
||||||
TLS = false
|
TLS = false
|
||||||
StartTLS = true
|
StartTLS = true
|
||||||
|
# ldap user default roles
|
||||||
|
DefaultRoles = ["Standard"]
|
||||||
|
|
||||||
[LDAP.Attributes]
|
[LDAP.Attributes]
|
||||||
Nickname = "cn"
|
Nickname = "cn"
|
||||||
|
|
|
@ -259,10 +259,14 @@ func LdapLogin(username, pass string) (*User, error) {
|
||||||
|
|
||||||
now := time.Now().Unix()
|
now := time.Now().Unix()
|
||||||
|
|
||||||
|
if len(config.C.LDAP.DefaultRoles) == 0 {
|
||||||
|
config.C.LDAP.DefaultRoles = []string{"Standard"}
|
||||||
|
}
|
||||||
|
|
||||||
user.Password = "******"
|
user.Password = "******"
|
||||||
user.Portrait = ""
|
user.Portrait = ""
|
||||||
user.Roles = "Standard"
|
user.Roles = strings.Join(config.C.LDAP.DefaultRoles, " ")
|
||||||
user.RolesLst = []string{"Standard"}
|
user.RolesLst = config.C.LDAP.DefaultRoles
|
||||||
user.Contacts = []byte("{}")
|
user.Contacts = []byte("{}")
|
||||||
user.CreateAt = now
|
user.CreateAt = now
|
||||||
user.UpdateAt = now
|
user.UpdateAt = now
|
||||||
|
|
|
@ -19,6 +19,7 @@ type LdapSection struct {
|
||||||
CoverAttributes bool
|
CoverAttributes bool
|
||||||
TLS bool
|
TLS bool
|
||||||
StartTLS bool
|
StartTLS bool
|
||||||
|
DefaultRoles []string
|
||||||
}
|
}
|
||||||
|
|
||||||
type LdapAttributes struct {
|
type LdapAttributes struct {
|
||||||
|
|
|
@ -238,5 +238,13 @@ func configRoute(r *gin.Engine, version string) {
|
||||||
{
|
{
|
||||||
service.Any("/prometheus/*url", prometheusProxy)
|
service.Any("/prometheus/*url", prometheusProxy)
|
||||||
service.POST("/users", userAddPost)
|
service.POST("/users", userAddPost)
|
||||||
|
|
||||||
|
service.GET("/targets", targetGets)
|
||||||
|
service.DELETE("/targets", targetDel)
|
||||||
|
service.GET("/targets/tags", targetGetTags)
|
||||||
|
service.POST("/targets/tags", targetBindTags)
|
||||||
|
service.DELETE("/targets/tags", targetUnbindTags)
|
||||||
|
service.PUT("/targets/note", targetUpdateNote)
|
||||||
|
service.PUT("/targets/bgid", targetUpdateBgid)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue