Disallow removing SOA record
This commit is contained in:
parent
4a19149b51
commit
35fbb1625e
|
@ -74,7 +74,7 @@
|
|||
<b-icon icon="check" />
|
||||
Save those modifications
|
||||
</b-button>
|
||||
<b-button type="button" size="sm" variant="outline-danger" class="mx-1" @click="deleteObject()">
|
||||
<b-button v-if="type !== 'svcs.Origin'" type="button" size="sm" variant="outline-danger" class="mx-1" @click="deleteObject()">
|
||||
<b-icon icon="trash" />
|
||||
Delete
|
||||
</b-button>
|
||||
|
|
|
@ -78,6 +78,10 @@ func (z *Zone) EraseService(subdomain string, origin string, id []byte, s *Servi
|
|||
for k, svc := range services {
|
||||
if bytes.Equal(svc.Id, id) {
|
||||
if s == nil {
|
||||
// Disallow removing SOA
|
||||
if subdomain == "" && svc.Type == "svcs.Origin" {
|
||||
return errors.New("You cannot delete this service. It is mandatory.")
|
||||
}
|
||||
z.Services[subdomain] = append(z.Services[subdomain][:k], z.Services[subdomain][k+1:]...)
|
||||
} else {
|
||||
s.Comment = s.GenComment(origin)
|
||||
|
|
Loading…
Reference in New Issue