Commit 281a070
authored
Move network interface authz to the data store (#778)
* Move network interface authz to the data store
- Adds a module-private function for actually inserting the database
record, after performing authz checks. This is used in the
publicly-available method and in tests.
- Adds authz objects to the
`DataStore::instance_create_network_interface` method and does authz
checks inside them.
- Reorders the instance-creation saga. This moves the instance DB record
creation before the NIC creation, since the latter can only be
attached to an existing instance record. This also allows uniform
authz checks inside the `DataStore` method, which wouldn't be possible
if the instance record were not yet in the database. Note that this
also requires a small change to the data the instance-record-creation
saga node serializes. It previously contained the NICs, but these are
no longer available at that time. Instead, the NICs are deserialized
from the saga node that creates them and used to instantiate the
instance runtime object only inside the `sic_instance_ensure` saga
node.
- Moves authz check for listing NICs for an instance into `DataStore`
method
- Moves authz check for fetching a single NIC for an instance into the
`DataStore` method
- Adds the `network_interface_fetch` method, for returning an authz
interface and the database record, after checking read access. This
uses a `*_noauthz` method as well, both of which are analogous to the
other similarly-named methods. Note there's no lookup by ID or path at
this point, since they're not really needed yet.
- Moves the check for deleting an interface into the `DataStore` method.
- Changes how deletion of a previously-deleted NIC works. We used to
return a success, but we now return a not-found error, in line with
the rest of the API.
* Bring NIC create/delete permission in line with other containers1 parent 1954ce2 commit 281a070
File tree
6 files changed
+195
-119
lines changed- nexus/src
- authz
- db
6 files changed
+195
-119
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
516 | 516 | | |
517 | 517 | | |
518 | 518 | | |
| 519 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
167 | 167 | | |
168 | 168 | | |
169 | 169 | | |
| 170 | + | |
170 | 171 | | |
171 | 172 | | |
172 | 173 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1674 | 1674 | | |
1675 | 1675 | | |
1676 | 1676 | | |
| 1677 | + | |
| 1678 | + | |
1677 | 1679 | | |
1678 | 1680 | | |
| 1681 | + | |
| 1682 | + | |
| 1683 | + | |
| 1684 | + | |
| 1685 | + | |
| 1686 | + | |
| 1687 | + | |
| 1688 | + | |
| 1689 | + | |
| 1690 | + | |
| 1691 | + | |
| 1692 | + | |
| 1693 | + | |
| 1694 | + | |
| 1695 | + | |
| 1696 | + | |
| 1697 | + | |
| 1698 | + | |
| 1699 | + | |
1679 | 1700 | | |
1680 | 1701 | | |
1681 | 1702 | | |
| |||
1686 | 1707 | | |
1687 | 1708 | | |
1688 | 1709 | | |
1689 | | - | |
| 1710 | + | |
| 1711 | + | |
| 1712 | + | |
| 1713 | + | |
| 1714 | + | |
1690 | 1715 | | |
1691 | 1716 | | |
1692 | 1717 | | |
| |||
1718 | 1743 | | |
1719 | 1744 | | |
1720 | 1745 | | |
1721 | | - | |
| 1746 | + | |
| 1747 | + | |
| 1748 | + | |
| 1749 | + | |
| 1750 | + | |
| 1751 | + | |
| 1752 | + | |
1722 | 1753 | | |
1723 | | - | |
1724 | | - | |
| 1754 | + | |
| 1755 | + | |
| 1756 | + | |
1725 | 1757 | | |
1726 | | - | |
1727 | | - | |
1728 | | - | |
| 1758 | + | |
1729 | 1759 | | |
1730 | | - | |
1731 | | - | |
1732 | | - | |
| 1760 | + | |
| 1761 | + | |
| 1762 | + | |
| 1763 | + | |
1733 | 1764 | | |
1734 | 1765 | | |
1735 | 1766 | | |
1736 | 1767 | | |
1737 | 1768 | | |
1738 | 1769 | | |
1739 | | - | |
| 1770 | + | |
1740 | 1771 | | |
1741 | 1772 | | |
1742 | | - | |
1743 | | - | |
1744 | | - | |
1745 | | - | |
1746 | | - | |
1747 | | - | |
1748 | | - | |
1749 | | - | |
1750 | | - | |
1751 | | - | |
1752 | | - | |
1753 | | - | |
1754 | | - | |
1755 | | - | |
1756 | | - | |
1757 | | - | |
| 1773 | + | |
| 1774 | + | |
| 1775 | + | |
| 1776 | + | |
| 1777 | + | |
| 1778 | + | |
| 1779 | + | |
| 1780 | + | |
| 1781 | + | |
| 1782 | + | |
| 1783 | + | |
1758 | 1784 | | |
1759 | 1785 | | |
1760 | | - | |
| 1786 | + | |
| 1787 | + | |
| 1788 | + | |
| 1789 | + | |
1761 | 1790 | | |
1762 | | - | |
| 1791 | + | |
| 1792 | + | |
| 1793 | + | |
| 1794 | + | |
| 1795 | + | |
| 1796 | + | |
| 1797 | + | |
| 1798 | + | |
| 1799 | + | |
| 1800 | + | |
| 1801 | + | |
| 1802 | + | |
| 1803 | + | |
| 1804 | + | |
| 1805 | + | |
1763 | 1806 | | |
1764 | | - | |
1765 | | - | |
| 1807 | + | |
| 1808 | + | |
| 1809 | + | |
| 1810 | + | |
| 1811 | + | |
1766 | 1812 | | |
1767 | | - | |
1768 | | - | |
| 1813 | + | |
| 1814 | + | |
| 1815 | + | |
| 1816 | + | |
| 1817 | + | |
1769 | 1818 | | |
1770 | | - | |
1771 | | - | |
1772 | | - | |
| 1819 | + | |
| 1820 | + | |
1773 | 1821 | | |
1774 | 1822 | | |
1775 | 1823 | | |
1776 | 1824 | | |
1777 | 1825 | | |
1778 | 1826 | | |
1779 | | - | |
| 1827 | + | |
1780 | 1828 | | |
1781 | 1829 | | |
1782 | | - | |
| 1830 | + | |
| 1831 | + | |
1783 | 1832 | | |
1784 | 1833 | | |
1785 | 1834 | | |
1786 | 1835 | | |
1787 | 1836 | | |
1788 | | - | |
| 1837 | + | |
| 1838 | + | |
1789 | 1839 | | |
1790 | 1840 | | |
| 1841 | + | |
| 1842 | + | |
1791 | 1843 | | |
1792 | 1844 | | |
1793 | 1845 | | |
1794 | | - | |
| 1846 | + | |
1795 | 1847 | | |
1796 | | - | |
| 1848 | + | |
1797 | 1849 | | |
1798 | 1850 | | |
1799 | 1851 | | |
1800 | 1852 | | |
1801 | 1853 | | |
1802 | 1854 | | |
1803 | 1855 | | |
1804 | | - | |
| 1856 | + | |
| 1857 | + | |
1805 | 1858 | | |
1806 | 1859 | | |
1807 | | - | |
1808 | | - | |
1809 | | - | |
1810 | | - | |
1811 | | - | |
1812 | | - | |
1813 | | - | |
1814 | | - | |
1815 | | - | |
1816 | | - | |
1817 | | - | |
1818 | | - | |
1819 | | - | |
1820 | | - | |
1821 | | - | |
1822 | | - | |
1823 | | - | |
| 1860 | + | |
| 1861 | + | |
| 1862 | + | |
| 1863 | + | |
1824 | 1864 | | |
1825 | 1865 | | |
1826 | 1866 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1134 | 1134 | | |
1135 | 1135 | | |
1136 | 1136 | | |
| 1137 | + | |
1137 | 1138 | | |
1138 | 1139 | | |
1139 | 1140 | | |
| |||
1298 | 1299 | | |
1299 | 1300 | | |
1300 | 1301 | | |
| 1302 | + | |
1301 | 1303 | | |
1302 | 1304 | | |
1303 | 1305 | | |
| |||
1352 | 1354 | | |
1353 | 1355 | | |
1354 | 1356 | | |
1355 | | - | |
| 1357 | + | |
1356 | 1358 | | |
1357 | 1359 | | |
1358 | 1360 | | |
| |||
1380 | 1382 | | |
1381 | 1383 | | |
1382 | 1384 | | |
1383 | | - | |
| 1385 | + | |
1384 | 1386 | | |
1385 | 1387 | | |
1386 | 1388 | | |
| |||
1404 | 1406 | | |
1405 | 1407 | | |
1406 | 1408 | | |
1407 | | - | |
1408 | | - | |
| 1409 | + | |
| 1410 | + | |
| 1411 | + | |
1409 | 1412 | | |
1410 | 1413 | | |
1411 | 1414 | | |
| |||
1429 | 1432 | | |
1430 | 1433 | | |
1431 | 1434 | | |
1432 | | - | |
1433 | | - | |
| 1435 | + | |
| 1436 | + | |
| 1437 | + | |
1434 | 1438 | | |
1435 | 1439 | | |
1436 | 1440 | | |
| |||
1455 | 1459 | | |
1456 | 1460 | | |
1457 | 1461 | | |
1458 | | - | |
1459 | | - | |
| 1462 | + | |
| 1463 | + | |
| 1464 | + | |
1460 | 1465 | | |
1461 | 1466 | | |
1462 | 1467 | | |
| |||
1481 | 1486 | | |
1482 | 1487 | | |
1483 | 1488 | | |
1484 | | - | |
1485 | | - | |
| 1489 | + | |
| 1490 | + | |
| 1491 | + | |
1486 | 1492 | | |
1487 | 1493 | | |
1488 | 1494 | | |
| |||
1501 | 1507 | | |
1502 | 1508 | | |
1503 | 1509 | | |
1504 | | - | |
1505 | | - | |
| 1510 | + | |
| 1511 | + | |
| 1512 | + | |
1506 | 1513 | | |
1507 | 1514 | | |
1508 | 1515 | | |
| |||
1528 | 1535 | | |
1529 | 1536 | | |
1530 | 1537 | | |
1531 | | - | |
1532 | | - | |
| 1538 | + | |
| 1539 | + | |
| 1540 | + | |
1533 | 1541 | | |
1534 | 1542 | | |
1535 | 1543 | | |
| |||
1577 | 1585 | | |
1578 | 1586 | | |
1579 | 1587 | | |
| 1588 | + | |
1580 | 1589 | | |
1581 | 1590 | | |
1582 | 1591 | | |
| |||
1610 | 1619 | | |
1611 | 1620 | | |
1612 | 1621 | | |
1613 | | - | |
| 1622 | + | |
1614 | 1623 | | |
1615 | 1624 | | |
1616 | 1625 | | |
1617 | 1626 | | |
1618 | 1627 | | |
1619 | | - | |
| 1628 | + | |
1620 | 1629 | | |
1621 | 1630 | | |
1622 | 1631 | | |
| |||
0 commit comments