Allow override of automatically assigned delegated domain
This commit is contained in:
parent
54a3fe9192
commit
c4da666a1e
3 changed files with 29 additions and 4 deletions
|
|
@ -11,15 +11,23 @@ var (
|
|||
)
|
||||
|
||||
func (student *Student) MyDelegatedDomainSuffix() string {
|
||||
if student.DelegatedDomain != nil {
|
||||
for _, ddomain := range DelegatedDomainSuffixes {
|
||||
if strings.HasSuffix(*student.DelegatedDomain, ddomain) {
|
||||
return ddomain
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return DelegatedDomainSuffixes[int(student.Id)%len(DelegatedDomainSuffixes)]
|
||||
}
|
||||
|
||||
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), "-_"), student.MyDelegatedDomainSuffix())
|
||||
}
|
||||
|
||||
return fmt.Sprintf("%s.%s", strings.Trim(strings.Replace(student.Login, "_", "-", -1), "-_"), student.MyDelegatedDomainSuffix())
|
||||
}
|
||||
|
||||
func (student *Student) MyAssociatedDomainSuffix() string {
|
||||
|
|
@ -33,9 +41,9 @@ func (student *Student) DefaultAssociatedDomain() string {
|
|||
func (student *Student) MyAssociatedDomain() string {
|
||||
if student.AssociatedDomain != nil {
|
||||
return *student.AssociatedDomain
|
||||
} else {
|
||||
return student.DefaultAssociatedDomain()
|
||||
}
|
||||
|
||||
return student.DefaultAssociatedDomain()
|
||||
}
|
||||
|
||||
func (student *Student) GetAssociatedDomains() (ds []string) {
|
||||
|
|
|
|||
Reference in a new issue