Files
@ ffd45b185016
Branch filter:
Location: kallithea/rhodecode/controllers/api/api.py - annotation
ffd45b185016
94.9 KiB
text/x-python
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
This imports changes between changesets 21af6c4eab3d and 6177597791c2 in
RhodeCode's original repository, including only changes to Python files and HTML.
RhodeCode clearly licensed its changes to these files under GPLv3
in their /LICENSE file, which states the following:
The Python code and integrated HTML are licensed under the GPLv3 license.
(See:
https://code.rhodecode.com/rhodecode/files/v2.2.5/LICENSE
or
http://web.archive.org/web/20140512193334/https://code.rhodecode.com/rhodecode/files/f3b123159901f15426d18e3dc395e8369f70ebe0/LICENSE
for an online copy of that LICENSE file)
Conservancy reviewed these changes and confirmed that they can be licensed as
a whole to the Kallithea project under GPLv3-only.
While some of the contents committed herein are clearly licensed
GPLv3-or-later, on the whole we must assume the are GPLv3-only, since the
statement above from RhodeCode indicates that they intend GPLv3-only as their
license, per GPLv3ยง14 and other relevant sections of GPLv3.
This imports changes between changesets 21af6c4eab3d and 6177597791c2 in
RhodeCode's original repository, including only changes to Python files and HTML.
RhodeCode clearly licensed its changes to these files under GPLv3
in their /LICENSE file, which states the following:
The Python code and integrated HTML are licensed under the GPLv3 license.
(See:
https://code.rhodecode.com/rhodecode/files/v2.2.5/LICENSE
or
http://web.archive.org/web/20140512193334/https://code.rhodecode.com/rhodecode/files/f3b123159901f15426d18e3dc395e8369f70ebe0/LICENSE
for an online copy of that LICENSE file)
Conservancy reviewed these changes and confirmed that they can be licensed as
a whole to the Kallithea project under GPLv3-only.
While some of the contents committed herein are clearly licensed
GPLv3-or-later, on the whole we must assume the are GPLv3-only, since the
statement above from RhodeCode indicates that they intend GPLv3-only as their
license, per GPLv3ยง14 and other relevant sections of GPLv3.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 | 89efedac4e6c ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 89efedac4e6c 89efedac4e6c 89efedac4e6c 89efedac4e6c 89efedac4e6c 89efedac4e6c 89efedac4e6c ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 89efedac4e6c 2feb58495f34 256e729a94cd 256e729a94cd ffd45b185016 256e729a94cd c78f6bf52e9c ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 4565e655ea2a ffd45b185016 ffd45b185016 48d4fcf04a29 ffd45b185016 ffd45b185016 3338a0994472 2ccb32ddcfd7 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 7cde75eac0fe ffd45b185016 ffd45b185016 48d4fcf04a29 92a4f7c496a5 256e729a94cd c78f6bf52e9c e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 473794943022 473794943022 473794943022 473794943022 473794943022 473794943022 473794943022 473794943022 ffd45b185016 473794943022 473794943022 473794943022 473794943022 473794943022 473794943022 473794943022 c9f5a397c0dc 473794943022 473794943022 473794943022 ffd45b185016 473794943022 473794943022 473794943022 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 ffd45b185016 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 ffd45b185016 473794943022 5f1850e4712a 473794943022 ffd45b185016 473794943022 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 473794943022 473794943022 ffd45b185016 473794943022 473794943022 473794943022 ffd45b185016 473794943022 e42e1d4e1c47 473794943022 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 473794943022 473794943022 473794943022 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 92a4f7c496a5 c78f6bf52e9c c78f6bf52e9c 3338a0994472 ffd45b185016 ffd45b185016 3338a0994472 ffd45b185016 3338a0994472 ffd45b185016 ffd45b185016 3338a0994472 3338a0994472 ffd45b185016 3338a0994472 c78f6bf52e9c c78f6bf52e9c 92a4f7c496a5 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 473794943022 c78f6bf52e9c ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 3338a0994472 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 c78f6bf52e9c c78f6bf52e9c 473794943022 8898a79ac628 c78f6bf52e9c 473794943022 473794943022 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 c78f6bf52e9c 473794943022 473794943022 473794943022 473794943022 c78f6bf52e9c 92a4f7c496a5 4565e655ea2a 4565e655ea2a ffd45b185016 4565e655ea2a ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 4565e655ea2a ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 4565e655ea2a 4565e655ea2a 4565e655ea2a 4565e655ea2a 4565e655ea2a 4565e655ea2a 4565e655ea2a 4565e655ea2a 4565e655ea2a 4565e655ea2a e21cb7b1a4a5 e21cb7b1a4a5 e21cb7b1a4a5 d6029dacbcc4 d6029dacbcc4 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 d6029dacbcc4 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 d6029dacbcc4 d6029dacbcc4 c9f5a397c0dc d6029dacbcc4 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 d6029dacbcc4 d6029dacbcc4 12ca667b69b6 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 d6029dacbcc4 d6029dacbcc4 d6029dacbcc4 d6029dacbcc4 d6029dacbcc4 d6029dacbcc4 c9f5a397c0dc 08e8115585bd 08e8115585bd e21cb7b1a4a5 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 e21cb7b1a4a5 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 e21cb7b1a4a5 e21cb7b1a4a5 3563c47e52fd 3563c47e52fd 3563c47e52fd 3563c47e52fd 3563c47e52fd ffd45b185016 ffd45b185016 28571535dd61 3563c47e52fd 28571535dd61 3563c47e52fd 3563c47e52fd ffd45b185016 28571535dd61 3563c47e52fd 3563c47e52fd 08e8115585bd e21cb7b1a4a5 08e8115585bd 08e8115585bd 08e8115585bd 08e8115585bd 08e8115585bd 2feb58495f34 2feb58495f34 2feb58495f34 2feb58495f34 2feb58495f34 ffd45b185016 2feb58495f34 2feb58495f34 2feb58495f34 e21cb7b1a4a5 08e8115585bd 2feb58495f34 2feb58495f34 2feb58495f34 2feb58495f34 2feb58495f34 2feb58495f34 ffd45b185016 ffd45b185016 ffd45b185016 2feb58495f34 2feb58495f34 2feb58495f34 e21cb7b1a4a5 2feb58495f34 08e8115585bd 08e8115585bd 08e8115585bd 08e8115585bd 2feb58495f34 2feb58495f34 08e8115585bd 2feb58495f34 08e8115585bd 2feb58495f34 2feb58495f34 2feb58495f34 2feb58495f34 2feb58495f34 ffd45b185016 2feb58495f34 2feb58495f34 2feb58495f34 2feb58495f34 08e8115585bd 08e8115585bd 08e8115585bd 08e8115585bd 08e8115585bd 4565e655ea2a 7cde75eac0fe 7cde75eac0fe ffd45b185016 7cde75eac0fe ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 7cde75eac0fe ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 7cde75eac0fe c9f5a397c0dc c9f5a397c0dc ffd45b185016 ffd45b185016 7cde75eac0fe 7cde75eac0fe 7cde75eac0fe 7cde75eac0fe ffd45b185016 7cde75eac0fe 7cde75eac0fe 7cde75eac0fe 7cde75eac0fe 7cde75eac0fe 7cde75eac0fe ffd45b185016 7cde75eac0fe 7cde75eac0fe 7cde75eac0fe 7cde75eac0fe 7cde75eac0fe 7cde75eac0fe 7cde75eac0fe 7cde75eac0fe 7cde75eac0fe 7cde75eac0fe 7cde75eac0fe 7cde75eac0fe 7cde75eac0fe 4565e655ea2a ffd45b185016 703070153bc1 703070153bc1 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 703070153bc1 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 703070153bc1 ffd45b185016 ffd45b185016 703070153bc1 703070153bc1 703070153bc1 ffd45b185016 703070153bc1 703070153bc1 703070153bc1 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 a0a8f38e8fb8 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 8898a79ac628 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 8898a79ac628 c9f5a397c0dc ffd45b185016 ffd45b185016 28571535dd61 a0a8f38e8fb8 28571535dd61 a0a8f38e8fb8 28571535dd61 28571535dd61 a0a8f38e8fb8 c78f6bf52e9c 473794943022 473794943022 473794943022 473794943022 631caf880b87 631caf880b87 631caf880b87 ffd45b185016 ffd45b185016 ffd45b185016 631caf880b87 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 631caf880b87 631caf880b87 631caf880b87 ffd45b185016 ffd45b185016 ffd45b185016 a732bbc40c7e 473794943022 2ccb32ddcfd7 2ccb32ddcfd7 92a4f7c496a5 ffd45b185016 ffd45b185016 473794943022 ffd45b185016 ffd45b185016 256e729a94cd ffd45b185016 ffd45b185016 3338a0994472 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 256e729a94cd 307ec693bdf2 473794943022 ffd45b185016 473794943022 473794943022 ffd45b185016 9ddbfaeefb73 ffd45b185016 ffd45b185016 9ddbfaeefb73 9ddbfaeefb73 256e729a94cd b902baeaa494 473794943022 473794943022 473794943022 473794943022 473794943022 473794943022 473794943022 ffd45b185016 ffd45b185016 0771f0f5ab28 473794943022 0771f0f5ab28 473794943022 473794943022 0771f0f5ab28 256e729a94cd 92a4f7c496a5 ffd45b185016 8898a79ac628 92a4f7c496a5 473794943022 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 bdc0ad168006 ffd45b185016 ffd45b185016 bdc0ad168006 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 bdc0ad168006 473794943022 473794943022 473794943022 ffd45b185016 001c7e2ae986 001c7e2ae986 bdc0ad168006 473794943022 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 001c7e2ae986 001c7e2ae986 473794943022 bdc0ad168006 374693af2849 473794943022 bdc0ad168006 a732bbc40c7e a732bbc40c7e a732bbc40c7e bdc0ad168006 bdc0ad168006 ffd45b185016 b902baeaa494 b902baeaa494 b902baeaa494 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 b902baeaa494 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 b902baeaa494 473794943022 b902baeaa494 b902baeaa494 b902baeaa494 473794943022 b902baeaa494 473794943022 473794943022 b902baeaa494 b902baeaa494 ffd45b185016 b902baeaa494 ffd45b185016 ffd45b185016 bdc0ad168006 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 8898a79ac628 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 8898a79ac628 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 c78f6bf52e9c ffd45b185016 473794943022 8898a79ac628 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 3338a0994472 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 3338a0994472 2ccb32ddcfd7 3338a0994472 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 3338a0994472 3338a0994472 ffd45b185016 ffd45b185016 ffd45b185016 256e729a94cd ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 3338a0994472 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 256e729a94cd 2ccb32ddcfd7 fa6ba6727475 ffd45b185016 307ec693bdf2 256e729a94cd 7e3d89d9d3a2 7e3d89d9d3a2 7e3d89d9d3a2 7e3d89d9d3a2 473794943022 ffd45b185016 ffd45b185016 ffd45b185016 473794943022 473794943022 5f1850e4712a ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 473794943022 256e729a94cd 92a4f7c496a5 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 3338a0994472 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 3338a0994472 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 473794943022 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 3338a0994472 473794943022 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 3338a0994472 2ccb32ddcfd7 ffd45b185016 0f87c784756e 5f1850e4712a ffd45b185016 ffd45b185016 0f87c784756e 473794943022 0f87c784756e 0f87c784756e 0f87c784756e 0f87c784756e 0f87c784756e 8898a79ac628 92a4f7c496a5 473794943022 5f1850e4712a ffd45b185016 473794943022 473794943022 0f87c784756e ffd45b185016 ffd45b185016 0f87c784756e ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 0f87c784756e ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 0f87c784756e 473794943022 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 0f87c784756e 0f87c784756e ffd45b185016 5f1850e4712a ffd45b185016 ffd45b185016 0f87c784756e 473794943022 0f87c784756e 0f87c784756e 0f87c784756e 473794943022 5f1850e4712a ffd45b185016 ffd45b185016 473794943022 8898a79ac628 ffd45b185016 14dffcfebb02 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 8898a79ac628 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 8898a79ac628 473794943022 3338a0994472 c9f5a397c0dc 28571535dd61 ffd45b185016 ffd45b185016 ffd45b185016 28571535dd61 8898a79ac628 a50901f2108d 8898a79ac628 8898a79ac628 8898a79ac628 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 473794943022 473794943022 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 3338a0994472 a50901f2108d a50901f2108d a50901f2108d 473794943022 473794943022 a50901f2108d 473794943022 8898a79ac628 c9f5a397c0dc 92a4f7c496a5 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 2ccb32ddcfd7 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 2ccb32ddcfd7 28571535dd61 ffd45b185016 28571535dd61 28571535dd61 28571535dd61 8898a79ac628 28571535dd61 473794943022 2ccb32ddcfd7 2ccb32ddcfd7 ffd45b185016 473794943022 ffd45b185016 203af05539e0 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 203af05539e0 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 203af05539e0 ffd45b185016 203af05539e0 ffd45b185016 203af05539e0 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 203af05539e0 473794943022 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 203af05539e0 473794943022 203af05539e0 203af05539e0 203af05539e0 203af05539e0 203af05539e0 203af05539e0 203af05539e0 203af05539e0 ffd45b185016 ffd45b185016 473794943022 473794943022 473794943022 473794943022 473794943022 203af05539e0 92a4f7c496a5 28571535dd61 ffd45b185016 ffd45b185016 ffd45b185016 ebd76deee70d ebd76deee70d ffd45b185016 ffd45b185016 3338a0994472 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 3338a0994472 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 631caf880b87 ffd45b185016 34d009e5147a ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 3338a0994472 ffd45b185016 28571535dd61 28571535dd61 28571535dd61 28571535dd61 28571535dd61 28571535dd61 28571535dd61 28571535dd61 473794943022 473794943022 473794943022 473794943022 473794943022 ebd76deee70d ebd76deee70d ebd76deee70d ebd76deee70d ebd76deee70d ebd76deee70d ebd76deee70d ebd76deee70d ebd76deee70d ebd76deee70d ebd76deee70d ebd76deee70d 473794943022 473794943022 473794943022 ffd45b185016 3338a0994472 2ccb32ddcfd7 ffd45b185016 473794943022 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 473794943022 ffd45b185016 473794943022 ffd45b185016 473794943022 ffd45b185016 ffd45b185016 ebd76deee70d ffd45b185016 ebd76deee70d ffd45b185016 631caf880b87 473794943022 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 0771f0f5ab28 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 0771f0f5ab28 3338a0994472 92a4f7c496a5 ffd45b185016 ffd45b185016 473794943022 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 ffd45b185016 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 e1a0fdaecf63 28571535dd61 ffd45b185016 ffd45b185016 8be70a4d72c7 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 8be70a4d72c7 8be70a4d72c7 8be70a4d72c7 8be70a4d72c7 8be70a4d72c7 8be70a4d72c7 8be70a4d72c7 8be70a4d72c7 28571535dd61 28571535dd61 28571535dd61 28571535dd61 28571535dd61 28571535dd61 28571535dd61 28571535dd61 28571535dd61 28571535dd61 28571535dd61 28571535dd61 ffd45b185016 28571535dd61 28571535dd61 28571535dd61 28571535dd61 28571535dd61 28571535dd61 8be70a4d72c7 8be70a4d72c7 8be70a4d72c7 8be70a4d72c7 8be70a4d72c7 8be70a4d72c7 8be70a4d72c7 8be70a4d72c7 8be70a4d72c7 8be70a4d72c7 8be70a4d72c7 8be70a4d72c7 8be70a4d72c7 8be70a4d72c7 8be70a4d72c7 8be70a4d72c7 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 8be70a4d72c7 8be70a4d72c7 8be70a4d72c7 ffd45b185016 ffd45b185016 ffd45b185016 8be70a4d72c7 8be70a4d72c7 8be70a4d72c7 8be70a4d72c7 8be70a4d72c7 8be70a4d72c7 8be70a4d72c7 3338a0994472 ffd45b185016 ffd45b185016 7dfcdf4c7dd2 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 7dfcdf4c7dd2 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 7dfcdf4c7dd2 473794943022 473794943022 ffd45b185016 28571535dd61 ffd45b185016 ffd45b185016 ffd45b185016 28571535dd61 7dfcdf4c7dd2 b44979649915 b44979649915 b44979649915 b44979649915 31f8c9d76a26 b44979649915 31f8c9d76a26 b44979649915 b44979649915 ffd45b185016 ffd45b185016 b44979649915 b44979649915 b44979649915 473794943022 7dfcdf4c7dd2 b44979649915 473794943022 7dfcdf4c7dd2 7dfcdf4c7dd2 7dfcdf4c7dd2 473794943022 ffd45b185016 473794943022 7dfcdf4c7dd2 3563c47e52fd 473794943022 2ccb32ddcfd7 87f0800abc7b ffd45b185016 ffd45b185016 3338a0994472 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 473794943022 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 2ccb32ddcfd7 473794943022 473794943022 473794943022 2ccb32ddcfd7 2ccb32ddcfd7 2ccb32ddcfd7 87f0800abc7b 87f0800abc7b 473794943022 631caf880b87 473794943022 473794943022 473794943022 473794943022 631caf880b87 2ccb32ddcfd7 92a4f7c496a5 631caf880b87 473794943022 473794943022 631caf880b87 631caf880b87 631caf880b87 3563c47e52fd 473794943022 87f0800abc7b ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 87f0800abc7b ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 631caf880b87 87f0800abc7b 473794943022 473794943022 87f0800abc7b 473794943022 473794943022 87f0800abc7b 473794943022 473794943022 473794943022 473794943022 87f0800abc7b 87f0800abc7b 87f0800abc7b 87f0800abc7b 473794943022 473794943022 87f0800abc7b 87f0800abc7b 87f0800abc7b ffd45b185016 ffd45b185016 87f0800abc7b 5f1850e4712a ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 87f0800abc7b ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 631caf880b87 473794943022 473794943022 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 631caf880b87 631caf880b87 ffd45b185016 ffd45b185016 87f0800abc7b 473794943022 631caf880b87 5f1850e4712a 473794943022 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 473794943022 473794943022 473794943022 473794943022 473794943022 473794943022 5f1850e4712a 473794943022 ffd45b185016 631caf880b87 631caf880b87 473794943022 3563c47e52fd ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 473794943022 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 473794943022 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 473794943022 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 473794943022 473794943022 ffd45b185016 473794943022 473794943022 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 473794943022 473794943022 473794943022 631caf880b87 631caf880b87 631caf880b87 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 5f1850e4712a ffd45b185016 ffd45b185016 631caf880b87 631caf880b87 dc4644865e8b ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 dc4644865e8b 1cb0a1f82fb4 1cb0a1f82fb4 dc4644865e8b ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 dc4644865e8b dc4644865e8b dc4644865e8b dc4644865e8b dc4644865e8b 1cb0a1f82fb4 dc4644865e8b 1cb0a1f82fb4 dc4644865e8b dc4644865e8b dc4644865e8b dc4644865e8b dc4644865e8b 1cb0a1f82fb4 dc4644865e8b dc4644865e8b dc4644865e8b 1cb0a1f82fb4 dc4644865e8b dc4644865e8b dc4644865e8b dc4644865e8b ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 | # -*- coding: utf-8 -*-
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
rhodecode.controllers.api
~~~~~~~~~~~~~~~~~~~~~~~~~
API controller for RhodeCode
:created_on: Aug 20, 2011
:author: marcink
:copyright: (c) 2013 RhodeCode GmbH.
:license: GPLv3, see LICENSE for more details.
"""
import time
import traceback
import logging
from sqlalchemy import or_
from rhodecode.controllers.api import JSONRPCController, JSONRPCError
from rhodecode.lib.auth import (
PasswordGenerator, AuthUser, HasPermissionAllDecorator,
HasPermissionAnyDecorator, HasPermissionAnyApi, HasRepoPermissionAnyApi,
HasRepoGroupPermissionAnyApi, HasUserGroupPermissionAny)
from rhodecode.lib.utils import map_groups, repo2db_mapper
from rhodecode.lib.utils2 import (
str2bool, time_to_datetime, safe_int, Optional, OAttr)
from rhodecode.model.meta import Session
from rhodecode.model.repo_group import RepoGroupModel
from rhodecode.model.scm import ScmModel, UserGroupList
from rhodecode.model.repo import RepoModel
from rhodecode.model.user import UserModel
from rhodecode.model.user_group import UserGroupModel
from rhodecode.model.gist import GistModel
from rhodecode.model.db import (
Repository, RhodeCodeSetting, UserIpMap, Permission, User, Gist,
RepoGroup)
from rhodecode.lib.compat import json
from rhodecode.lib.exceptions import (
DefaultUserException, UserGroupsAssignedException)
log = logging.getLogger(__name__)
def store_update(updates, attr, name):
"""
Stores param in updates dict if it's not instance of Optional
allows easy updates of passed in params
"""
if not isinstance(attr, Optional):
updates[name] = attr
def get_user_or_error(userid):
"""
Get user by id or name or return JsonRPCError if not found
:param userid:
"""
user = UserModel().get_user(userid)
if user is None:
raise JSONRPCError("user `%s` does not exist" % (userid,))
return user
def get_repo_or_error(repoid):
"""
Get repo by id or name or return JsonRPCError if not found
:param repoid:
"""
repo = RepoModel().get_repo(repoid)
if repo is None:
raise JSONRPCError('repository `%s` does not exist' % (repoid,))
return repo
def get_repo_group_or_error(repogroupid):
"""
Get repo group by id or name or return JsonRPCError if not found
:param repogroupid:
"""
repo_group = RepoGroupModel()._get_repo_group(repogroupid)
if repo_group is None:
raise JSONRPCError(
'repository group `%s` does not exist' % (repogroupid,))
return repo_group
def get_user_group_or_error(usergroupid):
"""
Get user group by id or name or return JsonRPCError if not found
:param usergroupid:
"""
user_group = UserGroupModel().get_group(usergroupid)
if user_group is None:
raise JSONRPCError('user group `%s` does not exist' % (usergroupid,))
return user_group
def get_perm_or_error(permid, prefix=None):
"""
Get permission by id or name or return JsonRPCError if not found
:param permid:
"""
perm = Permission.get_by_key(permid)
if perm is None:
raise JSONRPCError('permission `%s` does not exist' % (permid,))
if prefix:
if not perm.permission_name.startswith(prefix):
raise JSONRPCError('permission `%s` is invalid, '
'should start with %s' % (permid, prefix))
return perm
def get_gist_or_error(gistid):
"""
Get gist by id or gist_access_id or return JsonRPCError if not found
:param gistid:
"""
gist = GistModel().get_gist(gistid)
if gist is None:
raise JSONRPCError('gist `%s` does not exist' % (gistid,))
return gist
class ApiController(JSONRPCController):
"""
API Controller
Each method takes USER as first argument. This is then, based on given
API_KEY propagated as instance of user object who's making the call.
example function::
def func(apiuser,arg1, arg2,...):
pass
Each function should also **raise** JSONRPCError for any
errors that happens.
"""
@HasPermissionAllDecorator('hg.admin')
def test(self, apiuser, args):
return args
@HasPermissionAllDecorator('hg.admin')
def pull(self, apiuser, repoid):
"""
Triggers a pull from remote location on given repo. Can be used to
automatically keep remote repos up to date. This command can be executed
only using api_key belonging to user with admin rights
:param apiuser: filled automatically from apikey
:type apiuser: AuthUser
:param repoid: repository name or repository id
:type repoid: str or int
OUTPUT::
id : <id_given_in_input>
result : {
"msg": "Pulled from `<repository name>`"
"repository": "<repository name>"
}
error : null
ERROR OUTPUT::
id : <id_given_in_input>
result : null
error : {
"Unable to pull changes from `<reponame>`"
}
"""
repo = get_repo_or_error(repoid)
try:
ScmModel().pull_changes(repo.repo_name,
self.rhodecode_user.username)
return dict(
msg='Pulled from `%s`' % repo.repo_name,
repository=repo.repo_name
)
except Exception:
log.error(traceback.format_exc())
raise JSONRPCError(
'Unable to pull changes from `%s`' % repo.repo_name
)
@HasPermissionAllDecorator('hg.admin')
def rescan_repos(self, apiuser, remove_obsolete=Optional(False)):
"""
Triggers rescan repositories action. If remove_obsolete is set
than also delete repos that are in database but not in the filesystem.
aka "clean zombies". This command can be executed only using api_key
belonging to user with admin rights.
:param apiuser: filled automatically from apikey
:type apiuser: AuthUser
:param remove_obsolete: deletes repositories from
database that are not found on the filesystem
:type remove_obsolete: Optional(bool)
OUTPUT::
id : <id_given_in_input>
result : {
'added': [<added repository name>,...]
'removed': [<removed repository name>,...]
}
error : null
ERROR OUTPUT::
id : <id_given_in_input>
result : null
error : {
'Error occurred during rescan repositories action'
}
"""
try:
rm_obsolete = Optional.extract(remove_obsolete)
added, removed = repo2db_mapper(ScmModel().repo_scan(),
remove_obsolete=rm_obsolete)
return {'added': added, 'removed': removed}
except Exception:
log.error(traceback.format_exc())
raise JSONRPCError(
'Error occurred during rescan repositories action'
)
def invalidate_cache(self, apiuser, repoid):
"""
Invalidate cache for repository.
This command can be executed only using api_key belonging to user with admin
rights or regular user that have write or admin or write access to repository.
:param apiuser: filled automatically from apikey
:type apiuser: AuthUser
:param repoid: repository name or repository id
:type repoid: str or int
OUTPUT::
id : <id_given_in_input>
result : {
'msg': Cache for repository `<repository name>` was invalidated,
'repository': <repository name>
}
error : null
ERROR OUTPUT::
id : <id_given_in_input>
result : null
error : {
'Error occurred during cache invalidation action'
}
"""
repo = get_repo_or_error(repoid)
if not HasPermissionAnyApi('hg.admin')(user=apiuser):
# check if we have admin permission for this repo !
if not HasRepoPermissionAnyApi('repository.admin',
'repository.write')(
user=apiuser, repo_name=repo.repo_name):
raise JSONRPCError('repository `%s` does not exist' % (repoid,))
try:
ScmModel().mark_for_invalidation(repo.repo_name)
return dict(
msg='Cache for repository `%s` was invalidated' % (repoid,),
repository=repo.repo_name
)
except Exception:
log.error(traceback.format_exc())
raise JSONRPCError(
'Error occurred during cache invalidation action'
)
# permission check inside
def lock(self, apiuser, repoid, locked=Optional(None),
userid=Optional(OAttr('apiuser'))):
"""
Set locking state on given repository by given user. If userid param
is skipped, then it is set to id of user whos calling this method.
If locked param is skipped then function shows current lock state of
given repo. This command can be executed only using api_key belonging
to user with admin rights or regular user that have admin or write
access to repository.
:param apiuser: filled automatically from apikey
:type apiuser: AuthUser
:param repoid: repository name or repository id
:type repoid: str or int
:param locked: lock state to be set
:type locked: Optional(bool)
:param userid: set lock as user
:type userid: Optional(str or int)
OUTPUT::
id : <id_given_in_input>
result : {
'repo': '<reponame>',
'locked': <bool: lock state>,
'locked_since': <int: lock timestamp>,
'locked_by': <username of person who made the lock>,
'lock_state_changed': <bool: True if lock state has been changed in this request>,
'msg': 'Repo `<reponame>` locked by `<username>` on <timestamp>.'
or
'msg': 'Repo `<repository name>` not locked.'
or
'msg': 'User `<user name>` set lock state for repo `<repository name>` to `<new lock state>`'
}
error : null
ERROR OUTPUT::
id : <id_given_in_input>
result : null
error : {
'Error occurred locking repository `<reponame>`
}
"""
repo = get_repo_or_error(repoid)
if HasPermissionAnyApi('hg.admin')(user=apiuser):
pass
elif HasRepoPermissionAnyApi('repository.admin',
'repository.write')(user=apiuser,
repo_name=repo.repo_name):
# make sure normal user does not pass someone else userid,
# he is not allowed to do that
if not isinstance(userid, Optional) and userid != apiuser.user_id:
raise JSONRPCError(
'userid is not the same as your user'
)
else:
raise JSONRPCError('repository `%s` does not exist' % (repoid,))
if isinstance(userid, Optional):
userid = apiuser.user_id
user = get_user_or_error(userid)
if isinstance(locked, Optional):
lockobj = Repository.getlock(repo)
if lockobj[0] is None:
_d = {
'repo': repo.repo_name,
'locked': False,
'locked_since': None,
'locked_by': None,
'lock_state_changed': False,
'msg': 'Repo `%s` not locked.' % repo.repo_name
}
return _d
else:
userid, time_ = lockobj
lock_user = get_user_or_error(userid)
_d = {
'repo': repo.repo_name,
'locked': True,
'locked_since': time_,
'locked_by': lock_user.username,
'lock_state_changed': False,
'msg': ('Repo `%s` locked by `%s` on `%s`.'
% (repo.repo_name, lock_user.username,
json.dumps(time_to_datetime(time_))))
}
return _d
# force locked state through a flag
else:
locked = str2bool(locked)
try:
if locked:
lock_time = time.time()
Repository.lock(repo, user.user_id, lock_time)
else:
lock_time = None
Repository.unlock(repo)
_d = {
'repo': repo.repo_name,
'locked': locked,
'locked_since': lock_time,
'locked_by': user.username,
'lock_state_changed': True,
'msg': ('User `%s` set lock state for repo `%s` to `%s`'
% (user.username, repo.repo_name, locked))
}
return _d
except Exception:
log.error(traceback.format_exc())
raise JSONRPCError(
'Error occurred locking repository `%s`' % repo.repo_name
)
def get_locks(self, apiuser, userid=Optional(OAttr('apiuser'))):
"""
Get all repositories with locks for given userid, if
this command is runned by non-admin account userid is set to user
who is calling this method, thus returning locks for himself.
:param apiuser: filled automatically from apikey
:type apiuser: AuthUser
:param userid: User to get locks for
:type userid: Optional(str or int)
OUTPUT::
id : <id_given_in_input>
result : {
[repo_object, repo_object,...]
}
error : null
"""
if not HasPermissionAnyApi('hg.admin')(user=apiuser):
# make sure normal user does not pass someone else userid,
# he is not allowed to do that
if not isinstance(userid, Optional) and userid != apiuser.user_id:
raise JSONRPCError(
'userid is not the same as your user'
)
ret = []
if isinstance(userid, Optional):
user = None
else:
user = get_user_or_error(userid)
# show all locks
for r in Repository.getAll():
userid, time_ = r.locked
if time_:
_api_data = r.get_api_data()
# if we use userfilter just show the locks for this user
if user:
if safe_int(userid) == user.user_id:
ret.append(_api_data)
else:
ret.append(_api_data)
return ret
@HasPermissionAllDecorator('hg.admin')
def get_ip(self, apiuser, userid=Optional(OAttr('apiuser'))):
"""
Shows IP address as seen from RhodeCode server, together with all
defined IP addresses for given user. If userid is not passed data is
returned for user who's calling this function.
This command can be executed only using api_key belonging to user with
admin rights.
:param apiuser: filled automatically from apikey
:type apiuser: AuthUser
:param userid: username to show ips for
:type userid: Optional(str or int)
OUTPUT::
id : <id_given_in_input>
result : {
"server_ip_addr": "<ip_from_clien>",
"user_ips": [
{
"ip_addr": "<ip_with_mask>",
"ip_range": ["<start_ip>", "<end_ip>"],
},
...
]
}
"""
if isinstance(userid, Optional):
userid = apiuser.user_id
user = get_user_or_error(userid)
ips = UserIpMap.query().filter(UserIpMap.user == user).all()
return dict(
server_ip_addr=self.ip_addr,
user_ips=ips
)
# alias for old
show_ip = get_ip
@HasPermissionAllDecorator('hg.admin')
def get_server_info(self, apiuser):
"""
return server info, including RhodeCode version and installed packages
:param apiuser: filled automatically from apikey
:type apiuser: AuthUser
OUTPUT::
id : <id_given_in_input>
result : {
'modules': [<module name>,...]
'py_version': <python version>,
'platform': <platform type>,
'rhodecode_version': <rhodecode version>
}
error : null
"""
return RhodeCodeSetting.get_server_info()
def get_user(self, apiuser, userid=Optional(OAttr('apiuser'))):
"""
Get's an user by username or user_id, Returns empty result if user is
not found. If userid param is skipped it is set to id of user who is
calling this method. This command can be executed only using api_key
belonging to user with admin rights, or regular users that cannot
specify different userid than theirs
:param apiuser: filled automatically from apikey
:type apiuser: AuthUser
:param userid: user to get data for
:type userid: Optional(str or int)
OUTPUT::
id : <id_given_in_input>
result: None if user does not exist or
{
"user_id" : "<user_id>",
"api_key" : "<api_key>",
"api_keys": "[<list of all api keys including additional ones>]"
"username" : "<username>",
"firstname": "<firstname>",
"lastname" : "<lastname>",
"email" : "<email>",
"emails": "[<list of all emails including additional ones>]",
"ip_addresses": "[<ip_addresse_for_user>,...]",
"active" : "<bool: user active>",
"admin" :ย "<bool: user is admin>",
"extern_name" : "<extern_name>",
"extern_type" : "<extern type>
"last_login": "<last_login>",
"permissions": {
"global": ["hg.create.repository",
"repository.read",
"hg.register.manual_activate"],
"repositories": {"repo1": "repository.none"},
"repositories_groups": {"Group1": "group.read"}
},
}
error: null
"""
if not HasPermissionAnyApi('hg.admin')(user=apiuser):
# make sure normal user does not pass someone else userid,
# he is not allowed to do that
if not isinstance(userid, Optional) and userid != apiuser.user_id:
raise JSONRPCError(
'userid is not the same as your user'
)
if isinstance(userid, Optional):
userid = apiuser.user_id
user = get_user_or_error(userid)
data = user.get_api_data()
data['permissions'] = AuthUser(user_id=user.user_id).permissions
return data
@HasPermissionAllDecorator('hg.admin')
def get_users(self, apiuser):
"""
Lists all existing users. This command can be executed only using api_key
belonging to user with admin rights.
:param apiuser: filled automatically from apikey
:type apiuser: AuthUser
OUTPUT::
id : <id_given_in_input>
result: [<user_object>, ...]
error: null
"""
result = []
users_list = User.query().order_by(User.username) \
.filter(User.username != User.DEFAULT_USER) \
.all()
for user in users_list:
result.append(user.get_api_data())
return result
@HasPermissionAllDecorator('hg.admin')
def create_user(self, apiuser, username, email, password=Optional(''),
firstname=Optional(''), lastname=Optional(''),
active=Optional(True), admin=Optional(False),
extern_name=Optional('rhodecode'),
extern_type=Optional('rhodecode')):
"""
Creates new user. Returns new user object. This command can
be executed only using api_key belonging to user with admin rights.
:param apiuser: filled automatically from apikey
:type apiuser: AuthUser
:param username: new username
:type username: str or int
:param email: email
:type email: str
:param password: password
:type password: Optional(str)
:param firstname: firstname
:type firstname: Optional(str)
:param lastname: lastname
:type lastname: Optional(str)
:param active: active
:type active: Optional(bool)
:param admin: admin
:type admin: Optional(bool)
:param extern_name: name of extern
:type extern_name: Optional(str)
:param extern_type: extern_type
:type extern_type: Optional(str)
OUTPUT::
id : <id_given_in_input>
result: {
"msg" : "created new user `<username>`",
"user": <user_obj>
}
error: null
ERROR OUTPUT::
id : <id_given_in_input>
result : null
error : {
"user `<username>` already exist"
or
"email `<email>` already exist"
or
"failed to create user `<username>`"
}
"""
if UserModel().get_by_username(username):
raise JSONRPCError("user `%s` already exist" % (username,))
if UserModel().get_by_email(email, case_insensitive=True):
raise JSONRPCError("email `%s` already exist" % (email,))
if Optional.extract(extern_name):
# generate temporary password if user is external
password = PasswordGenerator().gen_password(length=8)
try:
user = UserModel().create_or_update(
username=Optional.extract(username),
password=Optional.extract(password),
email=Optional.extract(email),
firstname=Optional.extract(firstname),
lastname=Optional.extract(lastname),
active=Optional.extract(active),
admin=Optional.extract(admin),
extern_type=Optional.extract(extern_type),
extern_name=Optional.extract(extern_name)
)
Session().commit()
return dict(
msg='created new user `%s`' % username,
user=user.get_api_data()
)
except Exception:
log.error(traceback.format_exc())
raise JSONRPCError('failed to create user `%s`' % (username,))
@HasPermissionAllDecorator('hg.admin')
def update_user(self, apiuser, userid, username=Optional(None),
email=Optional(None),password=Optional(None),
firstname=Optional(None), lastname=Optional(None),
active=Optional(None), admin=Optional(None),
extern_type=Optional(None), extern_name=Optional(None),):
"""
updates given user if such user exists. This command can
be executed only using api_key belonging to user with admin rights.
:param apiuser: filled automatically from apikey
:type apiuser: AuthUser
:param userid: userid to update
:type userid: str or int
:param username: new username
:type username: str or int
:param email: email
:type email: str
:param password: password
:type password: Optional(str)
:param firstname: firstname
:type firstname: Optional(str)
:param lastname: lastname
:type lastname: Optional(str)
:param active: active
:type active: Optional(bool)
:param admin: admin
:type admin: Optional(bool)
:param extern_name:
:type extern_name: Optional(str)
:param extern_type:
:type extern_type: Optional(str)
OUTPUT::
id : <id_given_in_input>
result: {
"msg" : "updated user ID:<userid> <username>",
"user": <user_object>,
}
error: null
ERROR OUTPUT::
id : <id_given_in_input>
result : null
error : {
"failed to update user `<username>`"
}
"""
user = get_user_or_error(userid)
# only non optional arguments will be stored in updates
updates = {}
try:
store_update(updates, username, 'username')
store_update(updates, password, 'password')
store_update(updates, email, 'email')
store_update(updates, firstname, 'name')
store_update(updates, lastname, 'lastname')
store_update(updates, active, 'active')
store_update(updates, admin, 'admin')
store_update(updates, extern_name, 'extern_name')
store_update(updates, extern_type, 'extern_type')
user = UserModel().update_user(user, **updates)
Session().commit()
return dict(
msg='updated user ID:%s %s' % (user.user_id, user.username),
user=user.get_api_data()
)
except DefaultUserException:
log.error(traceback.format_exc())
raise JSONRPCError('editing default user is forbidden')
except Exception:
log.error(traceback.format_exc())
raise JSONRPCError('failed to update user `%s`' % (userid,))
@HasPermissionAllDecorator('hg.admin')
def delete_user(self, apiuser, userid):
"""
deletes givenuser if such user exists. This command can
be executed only using api_key belonging to user with admin rights.
:param apiuser: filled automatically from apikey
:type apiuser: AuthUser
:param userid: user to delete
:type userid: str or int
OUTPUT::
id : <id_given_in_input>
result: {
"msg" : "deleted user ID:<userid> <username>",
"user": null
}
error: null
ERROR OUTPUT::
id : <id_given_in_input>
result : null
error : {
"failed to delete user ID:<userid> <username>"
}
"""
user = get_user_or_error(userid)
try:
UserModel().delete(userid)
Session().commit()
return dict(
msg='deleted user ID:%s %s' % (user.user_id, user.username),
user=None
)
except Exception:
log.error(traceback.format_exc())
raise JSONRPCError('failed to delete user ID:%s %s'
% (user.user_id, user.username))
# permission check inside
def get_user_group(self, apiuser, usergroupid):
"""
Gets an existing user group. This command can be executed only using api_key
belonging to user with admin rights or user who has at least
read access to user group.
:param apiuser: filled automatically from apikey
:type apiuser: AuthUser
:param usergroupid: id of user_group to edit
:type usergroupid: str or int
OUTPUT::
id : <id_given_in_input>
result : None if group not exist
{
"users_group_id" : "<id>",
"group_name" : "<groupname>",
"active": "<bool>",
"members" : [<user_obj>,...]
}
error : null
"""
user_group = get_user_group_or_error(usergroupid)
if not HasPermissionAnyApi('hg.admin')(user=apiuser):
# check if we have at least read permission for this user group !
_perms = ('usergroup.read', 'usergroup.write', 'usergroup.admin',)
if not HasUserGroupPermissionAny(*_perms)(
user=apiuser, user_group_name=user_group.users_group_name):
raise JSONRPCError('user group `%s` does not exist' % (usergroupid,))
data = user_group.get_api_data()
return data
# permission check inside
def get_user_groups(self, apiuser):
"""
Lists all existing user groups. This command can be executed only using
api_key belonging to user with admin rights or user who has at least
read access to user group.
:param apiuser: filled automatically from apikey
:type apiuser: AuthUser
OUTPUT::
id : <id_given_in_input>
result : [<user_group_obj>,...]
error : null
"""
result = []
_perms = ('usergroup.read', 'usergroup.write', 'usergroup.admin',)
extras = {'user': apiuser}
for user_group in UserGroupList(UserGroupModel().get_all(),
perm_set=_perms, extra_kwargs=extras):
result.append(user_group.get_api_data())
return result
@HasPermissionAnyDecorator('hg.admin', 'hg.usergroup.create.true')
def create_user_group(self, apiuser, group_name, description=Optional(''),
owner=Optional(OAttr('apiuser')), active=Optional(True)):
"""
Creates new user group. This command can be executed only using api_key
belonging to user with admin rights or an user who has create user group
permission
:param apiuser: filled automatically from apikey
:type apiuser: AuthUser
:param group_name: name of new user group
:type group_name: str
:param description: group description
:type description: str
:param owner: owner of group. If not passed apiuser is the owner
:type owner: Optional(str or int)
:param active: group is active
:type active: Optional(bool)
OUTPUT::
id : <id_given_in_input>
result: {
"msg": "created new user group `<groupname>`",
"user_group": <user_group_object>
}
error: null
ERROR OUTPUT::
id : <id_given_in_input>
result : null
error : {
"user group `<group name>` already exist"
or
"failed to create group `<group name>`"
}
"""
if UserGroupModel().get_by_name(group_name):
raise JSONRPCError("user group `%s` already exist" % (group_name,))
try:
if isinstance(owner, Optional):
owner = apiuser.user_id
owner = get_user_or_error(owner)
active = Optional.extract(active)
description = Optional.extract(description)
ug = UserGroupModel().create(name=group_name, description=description,
owner=owner, active=active)
Session().commit()
return dict(
msg='created new user group `%s`' % group_name,
user_group=ug.get_api_data()
)
except Exception:
log.error(traceback.format_exc())
raise JSONRPCError('failed to create group `%s`' % (group_name,))
# permission check inside
def update_user_group(self, apiuser, usergroupid, group_name=Optional(''),
description=Optional(''), owner=Optional(None),
active=Optional(True)):
"""
Updates given usergroup. This command can be executed only using api_key
belonging to user with admin rights or an admin of given user group
:param apiuser: filled automatically from apikey
:type apiuser: AuthUser
:param usergroupid: id of user group to update
:type usergroupid: str or int
:param group_name: name of new user group
:type group_name: str
:param description: group description
:type description: str
:param owner: owner of group.
:type owner: Optional(str or int)
:param active: group is active
:type active: Optional(bool)
OUTPUT::
id : <id_given_in_input>
result : {
"msg": 'updated user group ID:<user group id> <user group name>',
"user_group": <user_group_object>
}
error : null
ERROR OUTPUT::
id : <id_given_in_input>
result : null
error : {
"failed to update user group `<user group name>`"
}
"""
user_group = get_user_group_or_error(usergroupid)
if not HasPermissionAnyApi('hg.admin')(user=apiuser):
# check if we have admin permission for this user group !
_perms = ('usergroup.admin',)
if not HasUserGroupPermissionAny(*_perms)(
user=apiuser, user_group_name=user_group.users_group_name):
raise JSONRPCError('user group `%s` does not exist' % (usergroupid,))
if not isinstance(owner, Optional):
owner = get_user_or_error(owner)
updates = {}
store_update(updates, group_name, 'users_group_name')
store_update(updates, description, 'user_group_description')
store_update(updates, owner, 'user')
store_update(updates, active, 'users_group_active')
try:
UserGroupModel().update(user_group, updates)
Session().commit()
return dict(
msg='updated user group ID:%s %s' % (user_group.users_group_id,
user_group.users_group_name),
user_group=user_group.get_api_data()
)
except Exception:
log.error(traceback.format_exc())
raise JSONRPCError('failed to update user group `%s`' % (usergroupid,))
# permission check inside
def delete_user_group(self, apiuser, usergroupid):
"""
Delete given user group by user group id or name.
This command can be executed only using api_key
belonging to user with admin rights or an admin of given user group
:param apiuser: filled automatically from apikey
:type apiuser: AuthUser
:param usergroupid:
:type usergroupid: int
OUTPUT::
id : <id_given_in_input>
result : {
"msg": "deleted user group ID:<user_group_id> <user_group_name>"
}
error : null
ERROR OUTPUT::
id : <id_given_in_input>
result : null
error : {
"failed to delete user group ID:<user_group_id> <user_group_name>"
or
"RepoGroup assigned to <repo_groups_list>"
}
"""
user_group = get_user_group_or_error(usergroupid)
if not HasPermissionAnyApi('hg.admin')(user=apiuser):
# check if we have admin permission for this user group !
_perms = ('usergroup.admin',)
if not HasUserGroupPermissionAny(*_perms)(
user=apiuser, user_group_name=user_group.users_group_name):
raise JSONRPCError('user group `%s` does not exist' % (usergroupid,))
try:
UserGroupModel().delete(user_group)
Session().commit()
return dict(
msg='deleted user group ID:%s %s' %
(user_group.users_group_id, user_group.users_group_name),
user_group=None
)
except UserGroupsAssignedException, e:
log.error(traceback.format_exc())
raise JSONRPCError(str(e))
except Exception:
log.error(traceback.format_exc())
raise JSONRPCError('failed to delete user group ID:%s %s' %
(user_group.users_group_id,
user_group.users_group_name)
)
# permission check inside
def add_user_to_user_group(self, apiuser, usergroupid, userid):
"""
Adds a user to a user group. If user exists in that group success will be
`false`. This command can be executed only using api_key
belonging to user with admin rights or an admin of given user group
:param apiuser: filled automatically from apikey
:type apiuser: AuthUser
:param usergroupid:
:type usergroupid: int
:param userid:
:type userid: int
OUTPUT::
id : <id_given_in_input>
result : {
"success": True|False # depends on if member is in group
"msg": "added member `<username>` to user group `<groupname>` |
User is already in that group"
}
error : null
ERROR OUTPUT::
id : <id_given_in_input>
result : null
error : {
"failed to add member to user group `<user_group_name>`"
}
"""
user = get_user_or_error(userid)
user_group = get_user_group_or_error(usergroupid)
if not HasPermissionAnyApi('hg.admin')(user=apiuser):
# check if we have admin permission for this user group !
_perms = ('usergroup.admin',)
if not HasUserGroupPermissionAny(*_perms)(
user=apiuser, user_group_name=user_group.users_group_name):
raise JSONRPCError('user group `%s` does not exist' % (usergroupid,))
try:
ugm = UserGroupModel().add_user_to_group(user_group, user)
success = True if ugm != True else False
msg = 'added member `%s` to user group `%s`' % (
user.username, user_group.users_group_name
)
msg = msg if success else 'User is already in that group'
Session().commit()
return dict(
success=success,
msg=msg
)
except Exception:
log.error(traceback.format_exc())
raise JSONRPCError(
'failed to add member to user group `%s`' % (
user_group.users_group_name,
)
)
# permission check inside
def remove_user_from_user_group(self, apiuser, usergroupid, userid):
"""
Removes a user from a user group. If user is not in given group success will
be `false`. This command can be executed only
using api_key belonging to user with admin rights or an admin of given user group
:param apiuser: filled automatically from apikey
:type apiuser: AuthUser
:param usergroupid:
:param userid:
OUTPUT::
id : <id_given_in_input>
result: {
"success": True|False, # depends on if member is in group
"msg": "removed member <username> from user group <groupname> |
User wasn't in group"
}
error: null
"""
user = get_user_or_error(userid)
user_group = get_user_group_or_error(usergroupid)
if not HasPermissionAnyApi('hg.admin')(user=apiuser):
# check if we have admin permission for this user group !
_perms = ('usergroup.admin',)
if not HasUserGroupPermissionAny(*_perms)(
user=apiuser, user_group_name=user_group.users_group_name):
raise JSONRPCError('user group `%s` does not exist' % (usergroupid,))
try:
success = UserGroupModel().remove_user_from_group(user_group, user)
msg = 'removed member `%s` from user group `%s`' % (
user.username, user_group.users_group_name
)
msg = msg if success else "User wasn't in group"
Session().commit()
return dict(success=success, msg=msg)
except Exception:
log.error(traceback.format_exc())
raise JSONRPCError(
'failed to remove member from user group `%s`' % (
user_group.users_group_name,
)
)
# permission check inside
def get_repo(self, apiuser, repoid):
"""
Gets an existing repository by it's name or repository_id. Members will return
either users_group or user associated to that repository. This command can be
executed only using api_key belonging to user with admin
rights or regular user that have at least read access to repository.
:param apiuser: filled automatically from apikey
:type apiuser: AuthUser
:param repoid: repository name or repository id
:type repoid: str or int
OUTPUT::
id : <id_given_in_input>
result : {
{
"repo_id" : "<repo_id>",
"repo_name" : "<reponame>"
"repo_type" : "<repo_type>",
"clone_uri" : "<clone_uri>",
"enable_downloads": "<bool>",
"enable_locking": "<bool>",
"enable_statistics": "<bool>",
"private": "<bool>",
"created_on" : "<date_time_created>",
"description" : "<description>",
"landing_rev": "<landing_rev>",
"last_changeset": {
"author": "<full_author>",
"date": "<date_time_of_commit>",
"message": "<commit_message>",
"raw_id": "<raw_id>",
"revision": "<numeric_revision>",
"short_id": "<short_id>"
}
"owner": "<repo_owner>",
"fork_of": "<name_of_fork_parent>",
"members" : [
{
"name": "<username>",
"type" : "user",
"permission" : "repository.(read|write|admin)"
},
โฆ
{
"name": "<usergroup name>",
"type" : "user_group",
"permission" : "usergroup.(read|write|admin)"
},
โฆ
]
"followers": [<user_obj>, ...]
]
}
}
error : null
"""
repo = get_repo_or_error(repoid)
if not HasPermissionAnyApi('hg.admin')(user=apiuser):
# check if we have admin permission for this repo !
perms = ('repository.admin', 'repository.write', 'repository.read')
if not HasRepoPermissionAnyApi(*perms)(user=apiuser, repo_name=repo.repo_name):
raise JSONRPCError('repository `%s` does not exist' % (repoid,))
members = []
followers = []
for user in repo.repo_to_perm:
perm = user.permission.permission_name
user = user.user
user_data = {
'name': user.username,
'type': "user",
'permission': perm
}
members.append(user_data)
for user_group in repo.users_group_to_perm:
perm = user_group.permission.permission_name
user_group = user_group.users_group
user_group_data = {
'name': user_group.users_group_name,
'type': "user_group",
'permission': perm
}
members.append(user_group_data)
for user in repo.followers:
followers.append(user.user.get_api_data())
data = repo.get_api_data()
data['members'] = members
data['followers'] = followers
return data
# permission check inside
def get_repos(self, apiuser):
"""
Lists all existing repositories. This command can be executed only using
api_key belonging to user with admin rights or regular user that have
admin, write or read access to repository.
:param apiuser: filled automatically from apikey
:type apiuser: AuthUser
OUTPUT::
id : <id_given_in_input>
result: [
{
"repo_id" : "<repo_id>",
"repo_name" : "<reponame>"
"repo_type" : "<repo_type>",
"clone_uri" : "<clone_uri>",
"private": : "<bool>",
"created_on" : "<datetimecreated>",
"description" : "<description>",
"landing_rev": "<landing_rev>",
"owner": "<repo_owner>",
"fork_of": "<name_of_fork_parent>",
"enable_downloads": "<bool>",
"enable_locking": "<bool>",
"enable_statistics": "<bool>",
},
โฆ
]
error: null
"""
result = []
if not HasPermissionAnyApi('hg.admin')(user=apiuser):
repos = RepoModel().get_all_user_repos(user=apiuser)
else:
repos = RepoModel().get_all()
for repo in repos:
result.append(repo.get_api_data())
return result
# permission check inside
def get_repo_nodes(self, apiuser, repoid, revision, root_path,
ret_type=Optional('all')):
"""
returns a list of nodes and it's children in a flat list for a given path
at given revision. It's possible to specify ret_type to show only `files` or
`dirs`. This command can be executed only using api_key belonging to
user with admin rights or regular user that have at least read access to repository.
:param apiuser: filled automatically from apikey
:type apiuser: AuthUser
:param repoid: repository name or repository id
:type repoid: str or int
:param revision: revision for which listing should be done
:type revision: str
:param root_path: path from which start displaying
:type root_path: str
:param ret_type: return type 'all|files|dirs' nodes
:type ret_type: Optional(str)
OUTPUT::
id : <id_given_in_input>
result: [
{
"name" : "<name>"
"type" : "<type>",
},
โฆ
]
error: null
"""
repo = get_repo_or_error(repoid)
if not HasPermissionAnyApi('hg.admin')(user=apiuser):
# check if we have admin permission for this repo !
perms = ('repository.admin', 'repository.write', 'repository.read')
if not HasRepoPermissionAnyApi(*perms)(user=apiuser, repo_name=repo.repo_name):
raise JSONRPCError('repository `%s` does not exist' % (repoid,))
ret_type = Optional.extract(ret_type)
_map = {}
try:
_d, _f = ScmModel().get_nodes(repo, revision, root_path,
flat=False)
_map = {
'all': _d + _f,
'files': _f,
'dirs': _d,
}
return _map[ret_type]
except KeyError:
raise JSONRPCError('ret_type must be one of %s'
% (','.join(_map.keys())))
except Exception:
log.error(traceback.format_exc())
raise JSONRPCError(
'failed to get repo: `%s` nodes' % repo.repo_name
)
@HasPermissionAnyDecorator('hg.admin', 'hg.create.repository')
def create_repo(self, apiuser, repo_name, owner=Optional(OAttr('apiuser')),
repo_type=Optional('hg'), description=Optional(''),
private=Optional(False), clone_uri=Optional(None),
landing_rev=Optional('rev:tip'),
enable_statistics=Optional(False),
enable_locking=Optional(False),
enable_downloads=Optional(False),
copy_permissions=Optional(False)):
"""
Creates a repository. If repository name contains "/", all needed repository
groups will be created. For example "foo/bar/baz" will create groups
"foo", "bar" (with "foo" as parent), and create "baz" repository with
"bar" as group. This command can be executed only using api_key
belonging to user with admin rights or regular user that have create
repository permission. Regular users cannot specify owner parameter
:param apiuser: filled automatically from apikey
:type apiuser: AuthUser
:param repo_name: repository name
:type repo_name: str
:param owner: user_id or username
:type owner: Optional(str)
:param repo_type: 'hg' or 'git'
:type repo_type: Optional(str)
:param description: repository description
:type description: Optional(str)
:param private:
:type private: bool
:param clone_uri:
:type clone_uri: str
:param landing_rev: <rev_type>:<rev>
:type landing_rev: str
:param enable_locking:
:type enable_locking: bool
:param enable_downloads:
:type enable_downloads: bool
:param enable_statistics:
:type enable_statistics: bool
:param copy_permissions: Copy permission from group that repository is
beeing created.
:type copy_permissions: bool
OUTPUT::
id : <id_given_in_input>
result: {
"msg": "Created new repository `<reponame>`",
"success": true,
"task": "<celery task id or None if done sync>"
}
error: null
ERROR OUTPUT::
id : <id_given_in_input>
result : null
error : {
'failed to create repository `<repo_name>`
}
"""
if not HasPermissionAnyApi('hg.admin')(user=apiuser):
if not isinstance(owner, Optional):
#forbid setting owner for non-admins
raise JSONRPCError(
'Only RhodeCode admin can specify `owner` param'
)
if isinstance(owner, Optional):
owner = apiuser.user_id
owner = get_user_or_error(owner)
if RepoModel().get_by_repo_name(repo_name):
raise JSONRPCError("repo `%s` already exist" % repo_name)
defs = RhodeCodeSetting.get_default_repo_settings(strip_prefix=True)
if isinstance(private, Optional):
private = defs.get('repo_private') or Optional.extract(private)
if isinstance(repo_type, Optional):
repo_type = defs.get('repo_type')
if isinstance(enable_statistics, Optional):
enable_statistics = defs.get('repo_enable_statistics')
if isinstance(enable_locking, Optional):
enable_locking = defs.get('repo_enable_locking')
if isinstance(enable_downloads, Optional):
enable_downloads = defs.get('repo_enable_downloads')
clone_uri = Optional.extract(clone_uri)
description = Optional.extract(description)
landing_rev = Optional.extract(landing_rev)
copy_permissions = Optional.extract(copy_permissions)
try:
repo_name_cleaned = repo_name.split('/')[-1]
# create structure of groups and return the last group
repo_group = map_groups(repo_name)
data = dict(
repo_name=repo_name_cleaned,
repo_name_full=repo_name,
repo_type=repo_type,
repo_description=description,
owner=owner,
repo_private=private,
clone_uri=clone_uri,
repo_group=repo_group,
repo_landing_rev=landing_rev,
enable_statistics=enable_statistics,
enable_locking=enable_locking,
enable_downloads=enable_downloads,
repo_copy_permissions=copy_permissions,
)
task = RepoModel().create(form_data=data, cur_user=owner)
from celery.result import BaseAsyncResult
task_id = None
if isinstance(task, BaseAsyncResult):
task_id = task.task_id
# no commit, it's done in RepoModel, or async via celery
return dict(
msg="Created new repository `%s`" % (repo_name,),
success=True, # cannot return the repo data here since fork
# cann be done async
task=task_id
)
except Exception:
log.error(traceback.format_exc())
raise JSONRPCError(
'failed to create repository `%s`' % (repo_name,))
# permission check inside
def update_repo(self, apiuser, repoid, name=Optional(None),
owner=Optional(OAttr('apiuser')),
group=Optional(None),
description=Optional(''), private=Optional(False),
clone_uri=Optional(None), landing_rev=Optional('rev:tip'),
enable_statistics=Optional(False),
enable_locking=Optional(False),
enable_downloads=Optional(False)):
"""
Updates repo
:param apiuser: filled automatically from apikey
:type apiuser: AuthUser
:param repoid: repository name or repository id
:type repoid: str or int
:param name:
:param owner:
:param group:
:param description:
:param private:
:param clone_uri:
:param landing_rev:
:param enable_statistics:
:param enable_locking:
:param enable_downloads:
"""
repo = get_repo_or_error(repoid)
if not HasPermissionAnyApi('hg.admin')(user=apiuser):
# check if we have admin permission for this repo !
if not HasRepoPermissionAnyApi('repository.admin')(user=apiuser,
repo_name=repo.repo_name):
raise JSONRPCError('repository `%s` does not exist' % (repoid,))
updates = {
# update function requires this.
'repo_name': repo.repo_name
}
repo_group = group
if not isinstance(repo_group, Optional):
repo_group = get_repo_group_or_error(repo_group)
repo_group = repo_group.group_id
try:
store_update(updates, name, 'repo_name')
store_update(updates, repo_group, 'repo_group')
store_update(updates, owner, 'user')
store_update(updates, description, 'repo_description')
store_update(updates, private, 'repo_private')
store_update(updates, clone_uri, 'clone_uri')
store_update(updates, landing_rev, 'repo_landing_rev')
store_update(updates, enable_statistics, 'repo_enable_statistics')
store_update(updates, enable_locking, 'repo_enable_locking')
store_update(updates, enable_downloads, 'repo_enable_downloads')
RepoModel().update(repo, **updates)
Session().commit()
return dict(
msg='updated repo ID:%s %s' % (repo.repo_id, repo.repo_name),
repository=repo.get_api_data()
)
except Exception:
log.error(traceback.format_exc())
raise JSONRPCError('failed to update repo `%s`' % repoid)
@HasPermissionAnyDecorator('hg.admin', 'hg.fork.repository')
def fork_repo(self, apiuser, repoid, fork_name,
owner=Optional(OAttr('apiuser')),
description=Optional(''), copy_permissions=Optional(False),
private=Optional(False), landing_rev=Optional('rev:tip')):
"""
Creates a fork of given repo. In case of using celery this will
immidiatelly return success message, while fork is going to be created
asynchronous. This command can be executed only using api_key belonging to
user with admin rights or regular user that have fork permission, and at least
read access to forking repository. Regular users cannot specify owner parameter.
:param apiuser: filled automatically from apikey
:type apiuser: AuthUser
:param repoid: repository name or repository id
:type repoid: str or int
:param fork_name:
:param owner:
:param description:
:param copy_permissions:
:param private:
:param landing_rev:
INPUT::
id : <id_for_response>
api_key : "<api_key>"
args: {
"repoid" : "<reponame or repo_id>",
"fork_name": "<forkname>",
"owner": "<username or user_id = Optional(=apiuser)>",
"description": "<description>",
"copy_permissions": "<bool>",
"private": "<bool>",
"landing_rev": "<landing_rev>"
}
OUTPUT::
id : <id_given_in_input>
result: {
"msg": "Created fork of `<reponame>` as `<forkname>`",
"success": true,
"task": "<celery task id or None if done sync>"
}
error: null
"""
repo = get_repo_or_error(repoid)
repo_name = repo.repo_name
_repo = RepoModel().get_by_repo_name(fork_name)
if _repo:
type_ = 'fork' if _repo.fork else 'repo'
raise JSONRPCError("%s `%s` already exist" % (type_, fork_name))
if HasPermissionAnyApi('hg.admin')(user=apiuser):
pass
elif HasRepoPermissionAnyApi('repository.admin',
'repository.write',
'repository.read')(user=apiuser,
repo_name=repo.repo_name):
if not isinstance(owner, Optional):
#forbid setting owner for non-admins
raise JSONRPCError(
'Only RhodeCode admin can specify `owner` param'
)
else:
raise JSONRPCError('repository `%s` does not exist' % (repoid,))
if isinstance(owner, Optional):
owner = apiuser.user_id
owner = get_user_or_error(owner)
try:
# create structure of groups and return the last group
group = map_groups(fork_name)
form_data = dict(
repo_name=fork_name,
repo_name_full=fork_name,
repo_group=group,
repo_type=repo.repo_type,
description=Optional.extract(description),
private=Optional.extract(private),
copy_permissions=Optional.extract(copy_permissions),
landing_rev=Optional.extract(landing_rev),
update_after_clone=False,
fork_parent_id=repo.repo_id,
)
task = RepoModel().create_fork(form_data, cur_user=owner)
# no commit, it's done in RepoModel, or async via celery
from celery.result import BaseAsyncResult
task_id = None
if isinstance(task, BaseAsyncResult):
task_id = task.task_id
return dict(
msg='Created fork of `%s` as `%s`' % (repo.repo_name,
fork_name),
success=True, # cannot return the repo data here since fork
# cann be done async
task=task_id
)
except Exception:
log.error(traceback.format_exc())
raise JSONRPCError(
'failed to fork repository `%s` as `%s`' % (repo_name,
fork_name)
)
# permission check inside
def delete_repo(self, apiuser, repoid, forks=Optional('')):
"""
Deletes a repository. This command can be executed only using api_key belonging
to user with admin rights or regular user that have admin access to repository.
When `forks` param is set it's possible to detach or delete forks of deleting
repository
:param apiuser: filled automatically from apikey
:type apiuser: AuthUser
:param repoid: repository name or repository id
:type repoid: str or int
:param forks: `detach` or `delete`, what do do with attached forks for repo
:type forks: Optional(str)
OUTPUT::
id : <id_given_in_input>
result: {
"msg": "Deleted repository `<reponame>`",
"success": true
}
error: null
"""
repo = get_repo_or_error(repoid)
if not HasPermissionAnyApi('hg.admin')(user=apiuser):
# check if we have admin permission for this repo !
if not HasRepoPermissionAnyApi('repository.admin')(user=apiuser,
repo_name=repo.repo_name):
raise JSONRPCError('repository `%s` does not exist' % (repoid,))
try:
handle_forks = Optional.extract(forks)
_forks_msg = ''
_forks = [f for f in repo.forks]
if handle_forks == 'detach':
_forks_msg = ' ' + 'Detached %s forks' % len(_forks)
elif handle_forks == 'delete':
_forks_msg = ' ' + 'Deleted %s forks' % len(_forks)
elif _forks:
raise JSONRPCError(
'Cannot delete `%s` it still contains attached forks' %
(repo.repo_name,)
)
RepoModel().delete(repo, forks=forks)
Session().commit()
return dict(
msg='Deleted repository `%s`%s' % (repo.repo_name, _forks_msg),
success=True
)
except Exception:
log.error(traceback.format_exc())
raise JSONRPCError(
'failed to delete repository `%s`' % (repo.repo_name,)
)
@HasPermissionAllDecorator('hg.admin')
def grant_user_permission(self, apiuser, repoid, userid, perm):
"""
Grant permission for user on given repository, or update existing one
if found. This command can be executed only using api_key belonging to user
with admin rights.
:param apiuser: filled automatically from apikey
:type apiuser: AuthUser
:param repoid: repository name or repository id
:type repoid: str or int
:param userid:
:param perm: (repository.(none|read|write|admin))
:type perm: str
OUTPUT::
id : <id_given_in_input>
result: {
"msg" : "Granted perm: `<perm>` for user: `<username>` in repo: `<reponame>`",
"success": true
}
error: null
"""
repo = get_repo_or_error(repoid)
user = get_user_or_error(userid)
perm = get_perm_or_error(perm)
try:
RepoModel().grant_user_permission(repo=repo, user=user, perm=perm)
Session().commit()
return dict(
msg='Granted perm: `%s` for user: `%s` in repo: `%s`' % (
perm.permission_name, user.username, repo.repo_name
),
success=True
)
except Exception:
log.error(traceback.format_exc())
raise JSONRPCError(
'failed to edit permission for user: `%s` in repo: `%s`' % (
userid, repoid
)
)
@HasPermissionAllDecorator('hg.admin')
def revoke_user_permission(self, apiuser, repoid, userid):
"""
Revoke permission for user on given repository. This command can be executed
only using api_key belonging to user with admin rights.
:param apiuser: filled automatically from apikey
:type apiuser: AuthUser
:param repoid: repository name or repository id
:type repoid: str or int
:param userid:
OUTPUT::
id : <id_given_in_input>
result: {
"msg" : "Revoked perm for user: `<username>` in repo: `<reponame>`",
"success": true
}
error: null
"""
repo = get_repo_or_error(repoid)
user = get_user_or_error(userid)
try:
RepoModel().revoke_user_permission(repo=repo, user=user)
Session().commit()
return dict(
msg='Revoked perm for user: `%s` in repo: `%s`' % (
user.username, repo.repo_name
),
success=True
)
except Exception:
log.error(traceback.format_exc())
raise JSONRPCError(
'failed to edit permission for user: `%s` in repo: `%s`' % (
userid, repoid
)
)
# permission check inside
def grant_user_group_permission(self, apiuser, repoid, usergroupid, perm):
"""
Grant permission for user group on given repository, or update
existing one if found. This command can be executed only using
api_key belonging to user with admin rights.
:param apiuser: filled automatically from apikey
:type apiuser: AuthUser
:param repoid: repository name or repository id
:type repoid: str or int
:param usergroupid: id of usergroup
:type usergroupid: str or int
:param perm: (repository.(none|read|write|admin))
:type perm: str
OUTPUT::
id : <id_given_in_input>
result : {
"msg" : "Granted perm: `<perm>` for group: `<usersgroupname>` in repo: `<reponame>`",
"success": true
}
error : null
ERROR OUTPUT::
id : <id_given_in_input>
result : null
error : {
"failed to edit permission for user group: `<usergroup>` in repo `<repo>`'
}
"""
repo = get_repo_or_error(repoid)
perm = get_perm_or_error(perm)
user_group = get_user_group_or_error(usergroupid)
if not HasPermissionAnyApi('hg.admin')(user=apiuser):
# check if we have admin permission for this repo !
_perms = ('repository.admin',)
if not HasRepoPermissionAnyApi(*_perms)(
user=apiuser, repo_name=repo.repo_name):
raise JSONRPCError('repository `%s` does not exist' % (repoid,))
# check if we have at least read permission for this user group !
_perms = ('usergroup.read', 'usergroup.write', 'usergroup.admin',)
if not HasUserGroupPermissionAny(*_perms)(
user=apiuser, user_group_name=user_group.users_group_name):
raise JSONRPCError('user group `%s` does not exist' % (usergroupid,))
try:
RepoModel().grant_user_group_permission(
repo=repo, group_name=user_group, perm=perm)
Session().commit()
return dict(
msg='Granted perm: `%s` for user group: `%s` in '
'repo: `%s`' % (
perm.permission_name, user_group.users_group_name,
repo.repo_name
),
success=True
)
except Exception:
log.error(traceback.format_exc())
raise JSONRPCError(
'failed to edit permission for user group: `%s` in '
'repo: `%s`' % (
usergroupid, repo.repo_name
)
)
# permission check inside
def revoke_user_group_permission(self, apiuser, repoid, usergroupid):
"""
Revoke permission for user group on given repository. This command can be
executed only using api_key belonging to user with admin rights.
:param apiuser: filled automatically from apikey
:type apiuser: AuthUser
:param repoid: repository name or repository id
:type repoid: str or int
:param usergroupid:
OUTPUT::
id : <id_given_in_input>
result: {
"msg" : "Revoked perm for group: `<usersgroupname>` in repo: `<reponame>`",
"success": true
}
error: null
"""
repo = get_repo_or_error(repoid)
user_group = get_user_group_or_error(usergroupid)
if not HasPermissionAnyApi('hg.admin')(user=apiuser):
# check if we have admin permission for this repo !
_perms = ('repository.admin',)
if not HasRepoPermissionAnyApi(*_perms)(
user=apiuser, repo_name=repo.repo_name):
raise JSONRPCError('repository `%s` does not exist' % (repoid,))
# check if we have at least read permission for this user group !
_perms = ('usergroup.read', 'usergroup.write', 'usergroup.admin',)
if not HasUserGroupPermissionAny(*_perms)(
user=apiuser, user_group_name=user_group.users_group_name):
raise JSONRPCError('user group `%s` does not exist' % (usergroupid,))
try:
RepoModel().revoke_user_group_permission(
repo=repo, group_name=user_group)
Session().commit()
return dict(
msg='Revoked perm for user group: `%s` in repo: `%s`' % (
user_group.users_group_name, repo.repo_name
),
success=True
)
except Exception:
log.error(traceback.format_exc())
raise JSONRPCError(
'failed to edit permission for user group: `%s` in '
'repo: `%s`' % (
user_group.users_group_name, repo.repo_name
)
)
@HasPermissionAllDecorator('hg.admin')
def get_repo_group(self, apiuser, repogroupid):
"""
Returns given repo group together with permissions, and repositories
inside the group
:param apiuser: filled automatically from apikey
:type apiuser: AuthUser
:param repogroupid: id/name of repository group
:type repogroupid: str or int
"""
repo_group = get_repo_group_or_error(repogroupid)
members = []
for user in repo_group.repo_group_to_perm:
perm = user.permission.permission_name
user = user.user
user_data = {
'name': user.username,
'type': "user",
'permission': perm
}
members.append(user_data)
for user_group in repo_group.users_group_to_perm:
perm = user_group.permission.permission_name
user_group = user_group.users_group
user_group_data = {
'name': user_group.users_group_name,
'type': "user_group",
'permission': perm
}
members.append(user_group_data)
data = repo_group.get_api_data()
data["members"] = members
return data
@HasPermissionAllDecorator('hg.admin')
def get_repo_groups(self, apiuser):
"""
Returns all repository groups
:param apiuser: filled automatically from apikey
:type apiuser: AuthUser
"""
result = []
for repo_group in RepoGroupModel().get_all():
result.append(repo_group.get_api_data())
return result
@HasPermissionAllDecorator('hg.admin')
def create_repo_group(self, apiuser, group_name, description=Optional(''),
owner=Optional(OAttr('apiuser')),
parent=Optional(None),
copy_permissions=Optional(False)):
"""
Creates a repository group. This command can be executed only using
api_key belonging to user with admin rights.
:param apiuser: filled automatically from apikey
:type apiuser: AuthUser
:param group_name:
:type group_name:
:param description:
:type description:
:param owner:
:type owner:
:param parent:
:type parent:
:param copy_permissions:
:type copy_permissions:
OUTPUT::
id : <id_given_in_input>
result : {
"msg": "created new repo group `<repo_group_name>`"
"repo_group": <repogroup_object>
}
error : null
ERROR OUTPUT::
id : <id_given_in_input>
result : null
error : {
failed to create repo group `<repogroupid>`
}
"""
if RepoGroup.get_by_group_name(group_name):
raise JSONRPCError("repo group `%s` already exist" % (group_name,))
if isinstance(owner, Optional):
owner = apiuser.user_id
group_description = Optional.extract(description)
parent_group = Optional.extract(parent)
if not isinstance(parent, Optional):
parent_group = get_repo_group_or_error(parent_group)
copy_permissions = Optional.extract(copy_permissions)
try:
repo_group = RepoGroupModel().create(
group_name=group_name,
group_description=group_description,
owner=owner,
parent=parent_group,
copy_permissions=copy_permissions
)
Session().commit()
return dict(
msg='created new repo group `%s`' % group_name,
repo_group=repo_group.get_api_data()
)
except Exception:
log.error(traceback.format_exc())
raise JSONRPCError('failed to create repo group `%s`' % (group_name,))
@HasPermissionAllDecorator('hg.admin')
def update_repo_group(self, apiuser, repogroupid, group_name=Optional(''),
description=Optional(''),
owner=Optional(OAttr('apiuser')),
parent=Optional(None), enable_locking=Optional(False)):
repo_group = get_repo_group_or_error(repogroupid)
updates = {}
try:
store_update(updates, group_name, 'group_name')
store_update(updates, description, 'group_description')
store_update(updates, owner, 'owner')
store_update(updates, parent, 'parent_group')
store_update(updates, enable_locking, 'enable_locking')
repo_group = RepoGroupModel().update(repo_group, updates)
Session().commit()
return dict(
msg='updated repository group ID:%s %s' % (repo_group.group_id,
repo_group.group_name),
repo_group=repo_group.get_api_data()
)
except Exception:
log.error(traceback.format_exc())
raise JSONRPCError('failed to update repository group `%s`'
% (repogroupid,))
@HasPermissionAllDecorator('hg.admin')
def delete_repo_group(self, apiuser, repogroupid):
"""
:param apiuser: filled automatically from apikey
:type apiuser: AuthUser
:param repogroupid: name or id of repository group
:type repogroupid: str or int
OUTPUT::
id : <id_given_in_input>
result : {
'msg': 'deleted repo group ID:<repogroupid> <repogroupname>
'repo_group': null
}
error : null
ERROR OUTPUT::
id : <id_given_in_input>
result : null
error : {
"failed to delete repo group ID:<repogroupid> <repogroupname>"
}
"""
repo_group = get_repo_group_or_error(repogroupid)
try:
RepoGroupModel().delete(repo_group)
Session().commit()
return dict(
msg='deleted repo group ID:%s %s' %
(repo_group.group_id, repo_group.group_name),
repo_group=None
)
except Exception:
log.error(traceback.format_exc())
raise JSONRPCError('failed to delete repo group ID:%s %s' %
(repo_group.group_id, repo_group.group_name)
)
# permission check inside
def grant_user_permission_to_repo_group(self, apiuser, repogroupid, userid,
perm, apply_to_children=Optional('none')):
"""
Grant permission for user on given repository group, or update existing
one if found. This command can be executed only using api_key belonging
to user with admin rights, or user who has admin right to given repository
group.
:param apiuser: filled automatically from apikey
:type apiuser: AuthUser
:param repogroupid: name or id of repository group
:type repogroupid: str or int
:param userid:
:param perm: (group.(none|read|write|admin))
:type perm: str
:param apply_to_children: 'none', 'repos', 'groups', 'all'
:type apply_to_children: str
OUTPUT::
id : <id_given_in_input>
result: {
"msg" : "Granted perm: `<perm>` (recursive:<apply_to_children>) for user: `<username>` in repo group: `<repo_group_name>`",
"success": true
}
error: null
ERROR OUTPUT::
id : <id_given_in_input>
result : null
error : {
"failed to edit permission for user: `<userid>` in repo group: `<repo_group_name>`"
}
"""
repo_group = get_repo_group_or_error(repogroupid)
if not HasPermissionAnyApi('hg.admin')(user=apiuser):
# check if we have admin permission for this repo group !
if not HasRepoGroupPermissionAnyApi('group.admin')(user=apiuser,
group_name=repo_group.group_name):
raise JSONRPCError('repository group `%s` does not exist' % (repogroupid,))
user = get_user_or_error(userid)
perm = get_perm_or_error(perm, prefix='group.')
apply_to_children = Optional.extract(apply_to_children)
try:
RepoGroupModel().add_permission(repo_group=repo_group,
obj=user,
obj_type="user",
perm=perm,
recursive=apply_to_children)
Session().commit()
return dict(
msg='Granted perm: `%s` (recursive:%s) for user: `%s` in repo group: `%s`' % (
perm.permission_name, apply_to_children, user.username, repo_group.name
),
success=True
)
except Exception:
log.error(traceback.format_exc())
raise JSONRPCError(
'failed to edit permission for user: `%s` in repo group: `%s`' % (
userid, repo_group.name))
# permission check inside
def revoke_user_permission_from_repo_group(self, apiuser, repogroupid, userid,
apply_to_children=Optional('none')):
"""
Revoke permission for user on given repository group. This command can
be executed only using api_key belonging to user with admin rights, or
user who has admin right to given repository group.
:param apiuser: filled automatically from apikey
:type apiuser: AuthUser
:param repogroupid: name or id of repository group
:type repogroupid: str or int
:param userid:
:type userid:
:param apply_to_children: 'none', 'repos', 'groups', 'all'
:type apply_to_children: str
OUTPUT::
id : <id_given_in_input>
result: {
"msg" : "Revoked perm (recursive:<apply_to_children>) for user: `<username>` in repo group: `<repo_group_name>`",
"success": true
}
error: null
ERROR OUTPUT::
id : <id_given_in_input>
result : null
error : {
"failed to edit permission for user: `<userid>` in repo group: `<repo_group_name>`"
}
"""
repo_group = get_repo_group_or_error(repogroupid)
if not HasPermissionAnyApi('hg.admin')(user=apiuser):
# check if we have admin permission for this repo group !
if not HasRepoGroupPermissionAnyApi('group.admin')(user=apiuser,
group_name=repo_group.group_name):
raise JSONRPCError('repository group `%s` does not exist' % (repogroupid,))
user = get_user_or_error(userid)
apply_to_children = Optional.extract(apply_to_children)
try:
RepoGroupModel().delete_permission(repo_group=repo_group,
obj=user,
obj_type="user",
recursive=apply_to_children)
Session().commit()
return dict(
msg='Revoked perm (recursive:%s) for user: `%s` in repo group: `%s`' % (
apply_to_children, user.username, repo_group.name
),
success=True
)
except Exception:
log.error(traceback.format_exc())
raise JSONRPCError(
'failed to edit permission for user: `%s` in repo group: `%s`' % (
userid, repo_group.name))
# permission check inside
def grant_user_group_permission_to_repo_group(
self, apiuser, repogroupid, usergroupid, perm,
apply_to_children=Optional('none'),):
"""
Grant permission for user group on given repository group, or update
existing one if found. This command can be executed only using
api_key belonging to user with admin rights, or user who has admin
right to given repository group.
:param apiuser: filled automatically from apikey
:type apiuser: AuthUser
:param repogroupid: name or id of repository group
:type repogroupid: str or int
:param usergroupid: id of usergroup
:type usergroupid: str or int
:param perm: (group.(none|read|write|admin))
:type perm: str
:param apply_to_children: 'none', 'repos', 'groups', 'all'
:type apply_to_children: str
OUTPUT::
id : <id_given_in_input>
result : {
"msg" : "Granted perm: `<perm>` (recursive:<apply_to_children>) for user group: `<usersgroupname>` in repo group: `<repo_group_name>`",
"success": true
}
error : null
ERROR OUTPUT::
id : <id_given_in_input>
result : null
error : {
"failed to edit permission for user group: `<usergroup>` in repo group: `<repo_group_name>`"
}
"""
repo_group = get_repo_group_or_error(repogroupid)
perm = get_perm_or_error(perm, prefix='group.')
user_group = get_user_group_or_error(usergroupid)
if not HasPermissionAnyApi('hg.admin')(user=apiuser):
# check if we have admin permission for this repo group !
_perms = ('group.admin',)
if not HasRepoGroupPermissionAnyApi(*_perms)(
user=apiuser, group_name=repo_group.group_name):
raise JSONRPCError(
'repository group `%s` does not exist' % (repogroupid,))
# check if we have at least read permission for this user group !
_perms = ('usergroup.read', 'usergroup.write', 'usergroup.admin',)
if not HasUserGroupPermissionAny(*_perms)(
user=apiuser, user_group_name=user_group.users_group_name):
raise JSONRPCError(
'user group `%s` does not exist' % (usergroupid,))
apply_to_children = Optional.extract(apply_to_children)
try:
RepoGroupModel().add_permission(repo_group=repo_group,
obj=user_group,
obj_type="user_group",
perm=perm,
recursive=apply_to_children)
Session().commit()
return dict(
msg='Granted perm: `%s` (recursive:%s) for user group: `%s` in repo group: `%s`' % (
perm.permission_name, apply_to_children,
user_group.users_group_name, repo_group.name
),
success=True
)
except Exception:
log.error(traceback.format_exc())
raise JSONRPCError(
'failed to edit permission for user group: `%s` in '
'repo group: `%s`' % (
usergroupid, repo_group.name
)
)
# permission check inside
def revoke_user_group_permission_from_repo_group(
self, apiuser, repogroupid, usergroupid,
apply_to_children=Optional('none')):
"""
Revoke permission for user group on given repository. This command can be
executed only using api_key belonging to user with admin rights, or
user who has admin right to given repository group.
:param apiuser: filled automatically from apikey
:type apiuser: AuthUser
:param repogroupid: name or id of repository group
:type repogroupid: str or int
:param usergroupid:
:param apply_to_children: 'none', 'repos', 'groups', 'all'
:type apply_to_children: str
OUTPUT::
id : <id_given_in_input>
result: {
"msg" : "Revoked perm (recursive:<apply_to_children>) for user group: `<usersgroupname>` in repo group: `<repo_group_name>`",
"success": true
}
error: null
ERROR OUTPUT::
id : <id_given_in_input>
result : null
error : {
"failed to edit permission for user group: `<usergroup>` in repo group: `<repo_group_name>`"
}
"""
repo_group = get_repo_group_or_error(repogroupid)
user_group = get_user_group_or_error(usergroupid)
if not HasPermissionAnyApi('hg.admin')(user=apiuser):
# check if we have admin permission for this repo group !
_perms = ('group.admin',)
if not HasRepoGroupPermissionAnyApi(*_perms)(
user=apiuser, group_name=repo_group.group_name):
raise JSONRPCError(
'repository group `%s` does not exist' % (repogroupid,))
# check if we have at least read permission for this user group !
_perms = ('usergroup.read', 'usergroup.write', 'usergroup.admin',)
if not HasUserGroupPermissionAny(*_perms)(
user=apiuser, user_group_name=user_group.users_group_name):
raise JSONRPCError(
'user group `%s` does not exist' % (usergroupid,))
apply_to_children = Optional.extract(apply_to_children)
try:
RepoGroupModel().delete_permission(repo_group=repo_group,
obj=user_group,
obj_type="user_group",
recursive=apply_to_children)
Session().commit()
return dict(
msg='Revoked perm (recursive:%s) for user group: `%s` in repo group: `%s`' % (
apply_to_children, user_group.users_group_name, repo_group.name
),
success=True
)
except Exception:
log.error(traceback.format_exc())
raise JSONRPCError(
'failed to edit permission for user group: `%s` in repo group: `%s`' % (
user_group.users_group_name, repo_group.name
)
)
def get_gist(self, apiuser, gistid):
"""
Get given gist by id
:param apiuser: filled automatically from apikey
:type apiuser: AuthUser
:param gistid: id of private or public gist
:type gistid: str
"""
gist = get_gist_or_error(gistid)
if not HasPermissionAnyApi('hg.admin')(user=apiuser):
if gist.gist_owner != apiuser.user_id:
raise JSONRPCError('gist `%s` does not exist' % (gistid,))
return gist.get_api_data()
def get_gists(self, apiuser, userid=Optional(OAttr('apiuser'))):
"""
Get all gists for given user. If userid is empty returned gists
are for user who called the api
:param apiuser: filled automatically from apikey
:type apiuser: AuthUser
:param userid: user to get gists for
:type userid: Optional(str or int)
"""
if not HasPermissionAnyApi('hg.admin')(user=apiuser):
# make sure normal user does not pass someone else userid,
# he is not allowed to do that
if not isinstance(userid, Optional) and userid != apiuser.user_id:
raise JSONRPCError(
'userid is not the same as your user'
)
if isinstance(userid, Optional):
user_id = apiuser.user_id
else:
user_id = get_user_or_error(userid).user_id
gists = []
_gists = Gist().query()\
.filter(or_(Gist.gist_expires == -1, Gist.gist_expires >= time.time()))\
.filter(Gist.gist_owner == user_id)\
.order_by(Gist.created_on.desc())
for gist in _gists:
gists.append(gist.get_api_data())
return gists
def create_gist(self, apiuser, files, owner=Optional(OAttr('apiuser')),
gist_type=Optional(Gist.GIST_PUBLIC), lifetime=Optional(-1),
description=Optional('')):
"""
Creates new Gist
:param apiuser: filled automatically from apikey
:type apiuser: AuthUser
:param files: files to be added to gist
{'filename': {'content':'...', 'lexer': null},
'filename2': {'content':'...', 'lexer': null}}
:type files: dict
:param owner: gist owner, defaults to api method caller
:type owner: Optional(str or int)
:param gist_type: type of gist 'public' or 'private'
:type gist_type: Optional(str)
:param lifetime: time in minutes of gist lifetime
:type lifetime: Optional(int)
:param description: gist description
:type description: Optional(str)
OUTPUT::
id : <id_given_in_input>
result : {
"msg": "created new gist",
"gist": {}
}
error : null
ERROR OUTPUT::
id : <id_given_in_input>
result : null
error : {
"failed to create gist"
}
"""
try:
if isinstance(owner, Optional):
owner = apiuser.user_id
owner = get_user_or_error(owner)
description = Optional.extract(description)
gist_type = Optional.extract(gist_type)
lifetime = Optional.extract(lifetime)
gist = GistModel().create(description=description,
owner=owner,
gist_mapping=files,
gist_type=gist_type,
lifetime=lifetime)
Session().commit()
return dict(
msg='created new gist',
gist=gist.get_api_data()
)
except Exception:
log.error(traceback.format_exc())
raise JSONRPCError('failed to create gist')
# def update_gist(self, apiuser, gistid, files, owner=Optional(OAttr('apiuser')),
# gist_type=Optional(Gist.GIST_PUBLIC),
# gist_lifetime=Optional(-1), gist_description=Optional('')):
# gist = get_gist_or_error(gistid)
# updates = {}
# permission check inside
def delete_gist(self, apiuser, gistid):
"""
Deletes existing gist
:param apiuser: filled automatically from apikey
:type apiuser: AuthUser
:param gistid: id of gist to delete
:type gistid: str
OUTPUT::
id : <id_given_in_input>
result : {
"deleted gist ID: <gist_id>",
"gist": null
}
error : null
ERROR OUTPUT::
id : <id_given_in_input>
result : null
error : {
"failed to delete gist ID:<gist_id>"
}
"""
gist = get_gist_or_error(gistid)
if not HasPermissionAnyApi('hg.admin')(user=apiuser):
if gist.gist_owner != apiuser.user_id:
raise JSONRPCError('gist `%s` does not exist' % (gistid,))
try:
GistModel().delete(gist)
Session().commit()
return dict(
msg='deleted gist ID:%s' % (gist.gist_access_id,),
gist=None
)
except Exception:
log.error(traceback.format_exc())
raise JSONRPCError('failed to delete gist ID:%s'
% (gist.gist_access_id,))
|