add .int to user-owned domains, allow internal records to have suffixes like .int
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
1661c0d207
commit
68c45585b4
|
@ -16,7 +16,7 @@ import (
|
||||||
|
|
||||||
const MaxUserRecords = 100
|
const MaxUserRecords = 100
|
||||||
|
|
||||||
var UserOwnedInternalFmtDomains = []string{"%s", "%s.endpoints"}
|
var UserOwnedInternalFmtDomains = []string{"%s", "%s.int", "%s.endpoints", "%s.", "%s.endpoints.", "%s.int."}
|
||||||
|
|
||||||
func ListDNSRecordsContinuation(context *types.RequestContext, req *http.Request, resp http.ResponseWriter) types.ContinuationChain {
|
func ListDNSRecordsContinuation(context *types.RequestContext, req *http.Request, resp http.ResponseWriter) types.ContinuationChain {
|
||||||
return func(success types.Continuation, failure types.Continuation) types.ContinuationChain {
|
return func(success types.Continuation, failure types.Continuation) types.ContinuationChain {
|
||||||
|
@ -163,15 +163,16 @@ func userCanFuckWithDNSRecord(dbConn *sql.DB, user *database.User, record *datab
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if !record.Internal {
|
for _, format := range ownedInternalDomainFormats {
|
||||||
for _, format := range ownedInternalDomainFormats {
|
domain := fmt.Sprintf(format, user.Username)
|
||||||
domain := fmt.Sprintf(format, user.Username)
|
|
||||||
|
|
||||||
isInSubDomain := strings.HasSuffix(record.Name, "."+domain)
|
isInSubDomain := strings.HasSuffix(record.Name, "."+domain)
|
||||||
if domain == record.Name || isInSubDomain {
|
if domain == record.Name || isInSubDomain {
|
||||||
return true
|
return true
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if !record.Internal {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,6 +182,5 @@ func userCanFuckWithDNSRecord(dbConn *sql.DB, user *database.User, record *datab
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
userIsOwnerOfDomain := owner == user.ID
|
return owner == user.ID
|
||||||
return ownedByUser && userIsOwnerOfDomain
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue