mirror of
https://github.com/h44z/wg-portal
synced 2025-02-26 05:49:14 +00:00
Add config option to make everyone admin (#106)
This commit is contained in:
parent
e4c641f78f
commit
12717987a6
@ -29,6 +29,7 @@ type Config struct {
|
|||||||
SyncFilter string `yaml:"syncFilter" envconfig:"LDAP_SYNC_FILTER"`
|
SyncFilter string `yaml:"syncFilter" envconfig:"LDAP_SYNC_FILTER"`
|
||||||
AdminLdapGroup string `yaml:"adminGroup" envconfig:"LDAP_ADMIN_GROUP"` // Members of this group receive admin rights in WG-Portal
|
AdminLdapGroup string `yaml:"adminGroup" envconfig:"LDAP_ADMIN_GROUP"` // Members of this group receive admin rights in WG-Portal
|
||||||
AdminLdapGroup_ *gldap.DN `yaml:"-"`
|
AdminLdapGroup_ *gldap.DN `yaml:"-"`
|
||||||
|
EveryoneAdmin bool `yaml:"everyoneAdmin" envconfig:"LDAP_EVERYONE_ADMIN"`
|
||||||
LdapCertConn bool `yaml:"ldapCertConn" envconfig:"LDAP_CERT_CONN"`
|
LdapCertConn bool `yaml:"ldapCertConn" envconfig:"LDAP_CERT_CONN"`
|
||||||
LdapTlsCert string `yaml:"ldapTlsCert" envconfig:"LDAPTLS_CERT"`
|
LdapTlsCert string `yaml:"ldapTlsCert" envconfig:"LDAPTLS_CERT"`
|
||||||
LdapTlsKey string `yaml:"ldapTlsKey" envconfig:"LDAPTLS_KEY"`
|
LdapTlsKey string `yaml:"ldapTlsKey" envconfig:"LDAPTLS_KEY"`
|
||||||
|
@ -45,6 +45,9 @@ func (s *Server) SyncLdapWithUserDatabase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s Server) userIsInAdminGroup(ldapData *ldap.RawLdapData) bool {
|
func (s Server) userIsInAdminGroup(ldapData *ldap.RawLdapData) bool {
|
||||||
|
if s.config.LDAP.EveryoneAdmin {
|
||||||
|
return true
|
||||||
|
}
|
||||||
if s.config.LDAP.AdminLdapGroup_ == nil {
|
if s.config.LDAP.AdminLdapGroup_ == nil {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user