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
|
||||
|
||||
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 {
|
||||
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
|
||||
}
|
||||
|
||||
if !record.Internal {
|
||||
for _, format := range ownedInternalDomainFormats {
|
||||
domain := fmt.Sprintf(format, user.Username)
|
||||
for _, format := range ownedInternalDomainFormats {
|
||||
domain := fmt.Sprintf(format, user.Username)
|
||||
|
||||
isInSubDomain := strings.HasSuffix(record.Name, "."+domain)
|
||||
if domain == record.Name || isInSubDomain {
|
||||
return true
|
||||
}
|
||||
isInSubDomain := strings.HasSuffix(record.Name, "."+domain)
|
||||
if domain == record.Name || isInSubDomain {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
if !record.Internal {
|
||||
return false
|
||||
}
|
||||
|
||||
|
@ -181,6 +182,5 @@ func userCanFuckWithDNSRecord(dbConn *sql.DB, user *database.User, record *datab
|
|||
return false
|
||||
}
|
||||
|
||||
userIsOwnerOfDomain := owner == user.ID
|
||||
return ownedByUser && userIsOwnerOfDomain
|
||||
return owner == user.ID
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue