Initial commit
This commit is contained in:
29
utils/ldap.go
Normal file
29
utils/ldap.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"gt.kalli.st/czar/fsldap/config"
|
||||
)
|
||||
|
||||
func GetMail(user string) string {
|
||||
return fmt.Sprintf("%s@%s", user, config.Domain)
|
||||
}
|
||||
|
||||
func GetLdapName(user string) string {
|
||||
return fmt.Sprintf("%s=%s,%s", config.Uid, user, config.Base)
|
||||
}
|
||||
|
||||
func GetUser(name string) string {
|
||||
endIndex := len(name) - config.BaseLenght
|
||||
user := name[config.UidLenght:endIndex]
|
||||
return user
|
||||
}
|
||||
|
||||
func GetSearchUser(name string) string {
|
||||
startIndex := config.UidLenght + 1
|
||||
endIndex := len(name) - 1
|
||||
user := name[startIndex:endIndex]
|
||||
return user
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user