Exemple #1
0
func aclTxn(view db.Database, specHandle stitch.Stitch) {
	aclRow, err := view.GetACL()
	if err != nil {
		aclRow = view.InsertACL()
	}

	aclRow.Admin = resolveACLs(specHandle.AdminACL)

	var applicationPorts []db.PortRange
	for _, conn := range specHandle.Connections {
		if conn.From == stitch.PublicInternetLabel {
			applicationPorts = append(applicationPorts, db.PortRange{
				MinPort: conn.MinPort,
				MaxPort: conn.MaxPort,
			})
		}
	}
	aclRow.ApplicationPorts = applicationPorts

	view.Commit(aclRow)
}