package adlin
import (
"fmt"
"strings"
)
const (
AssociatedDomainSuffix = "adlin2022.p0m.fr."
DelegatedDomainSuffix = "srs.p0m.fr."
func (student *Student) MyDelegatedDomain() string {
if student.DelegatedDomain != nil {
return *student.DelegatedDomain
} else {
return fmt.Sprintf("%s.%s", strings.Trim(strings.Replace(student.Login, "_", "-", -1), "-_"), DelegatedDomainSuffix)
}
func (student *Student) DefaultAssociatedDomain() string {
return fmt.Sprintf("%s.%s", strings.Trim(strings.Replace(student.Login, "_", "-", -1), "-_"), AssociatedDomainSuffix)
func (student *Student) MyAssociatedDomain() string {
if student.AssociatedDomain != nil {
return *student.AssociatedDomain
return student.DefaultAssociatedDomain()
func (student *Student) GetAssociatedDomains() (ds []string) {
defdn := student.DefaultAssociatedDomain()
ds = append(ds, defdn)
studentDomain := student.MyAssociatedDomain()
if defdn != studentDomain {
ds = append(ds, studentDomain)
return