Show More
@@ -1304,7 +1304,7 b' class AuthUser(object):' | |||||
1304 | # since we use heavy caching sometimes it happens that we get |
|
1304 | # since we use heavy caching sometimes it happens that we get | |
1305 | # deleted objects here, we just skip them |
|
1305 | # deleted objects here, we just skip them | |
1306 | pass |
|
1306 | pass | |
1307 |
return _set or |
|
1307 | return _set or {ip for ip in ['0.0.0.0/0', '::/0']} | |
1308 |
|
1308 | |||
1309 |
|
1309 | |||
1310 | def set_available_permissions(settings): |
|
1310 | def set_available_permissions(settings): | |
@@ -1636,7 +1636,7 b' class HasRepoPermissionAllDecorator(Perm' | |||||
1636 | repo_name = self._get_repo_name() |
|
1636 | repo_name = self._get_repo_name() | |
1637 |
|
1637 | |||
1638 | try: |
|
1638 | try: | |
1639 |
user_perms = |
|
1639 | user_perms = {perms['repositories'][repo_name]} | |
1640 | except KeyError: |
|
1640 | except KeyError: | |
1641 | log.debug('cannot locate repo with name: `%s` in permissions defs', |
|
1641 | log.debug('cannot locate repo with name: `%s` in permissions defs', | |
1642 | repo_name) |
|
1642 | repo_name) | |
@@ -1663,7 +1663,7 b' class HasRepoPermissionAnyDecorator(Perm' | |||||
1663 | repo_name = self._get_repo_name() |
|
1663 | repo_name = self._get_repo_name() | |
1664 |
|
1664 | |||
1665 | try: |
|
1665 | try: | |
1666 |
user_perms = |
|
1666 | user_perms = {perms['repositories'][repo_name]} | |
1667 | except KeyError: |
|
1667 | except KeyError: | |
1668 | log.debug( |
|
1668 | log.debug( | |
1669 | 'cannot locate repo with name: `%s` in permissions defs', |
|
1669 | 'cannot locate repo with name: `%s` in permissions defs', | |
@@ -1691,7 +1691,7 b' class HasRepoGroupPermissionAllDecorator' | |||||
1691 | perms = user.permissions |
|
1691 | perms = user.permissions | |
1692 | group_name = self._get_repo_group_name() |
|
1692 | group_name = self._get_repo_group_name() | |
1693 | try: |
|
1693 | try: | |
1694 |
user_perms = |
|
1694 | user_perms = {perms['repositories_groups'][group_name]} | |
1695 | except KeyError: |
|
1695 | except KeyError: | |
1696 | log.debug( |
|
1696 | log.debug( | |
1697 | 'cannot locate repo group with name: `%s` in permissions defs', |
|
1697 | 'cannot locate repo group with name: `%s` in permissions defs', | |
@@ -1720,7 +1720,7 b' class HasRepoGroupPermissionAnyDecorator' | |||||
1720 | group_name = self._get_repo_group_name() |
|
1720 | group_name = self._get_repo_group_name() | |
1721 |
|
1721 | |||
1722 | try: |
|
1722 | try: | |
1723 |
user_perms = |
|
1723 | user_perms = {perms['repositories_groups'][group_name]} | |
1724 | except KeyError: |
|
1724 | except KeyError: | |
1725 | log.debug( |
|
1725 | log.debug( | |
1726 | 'cannot locate repo group with name: `%s` in permissions defs', |
|
1726 | 'cannot locate repo group with name: `%s` in permissions defs', | |
@@ -1747,7 +1747,7 b' class HasUserGroupPermissionAllDecorator' | |||||
1747 | perms = user.permissions |
|
1747 | perms = user.permissions | |
1748 | group_name = self._get_user_group_name() |
|
1748 | group_name = self._get_user_group_name() | |
1749 | try: |
|
1749 | try: | |
1750 |
user_perms = |
|
1750 | user_perms = {perms['user_groups'][group_name]} | |
1751 | except KeyError: |
|
1751 | except KeyError: | |
1752 | return False |
|
1752 | return False | |
1753 |
|
1753 | |||
@@ -1769,7 +1769,7 b' class HasUserGroupPermissionAnyDecorator' | |||||
1769 | perms = user.permissions |
|
1769 | perms = user.permissions | |
1770 | group_name = self._get_user_group_name() |
|
1770 | group_name = self._get_user_group_name() | |
1771 | try: |
|
1771 | try: | |
1772 |
user_perms = |
|
1772 | user_perms = {perms['user_groups'][group_name]} | |
1773 | except KeyError: |
|
1773 | except KeyError: | |
1774 | return False |
|
1774 | return False | |
1775 |
|
1775 | |||
@@ -1882,7 +1882,7 b' class HasRepoPermissionAll(PermsFunction' | |||||
1882 | self.repo_name = self._get_repo_name() |
|
1882 | self.repo_name = self._get_repo_name() | |
1883 | perms = user.permissions |
|
1883 | perms = user.permissions | |
1884 | try: |
|
1884 | try: | |
1885 |
user_perms = |
|
1885 | user_perms = {perms['repositories'][self.repo_name]} | |
1886 | except KeyError: |
|
1886 | except KeyError: | |
1887 | return False |
|
1887 | return False | |
1888 | if self.required_perms.issubset(user_perms): |
|
1888 | if self.required_perms.issubset(user_perms): | |
@@ -1905,7 +1905,7 b' class HasRepoPermissionAny(PermsFunction' | |||||
1905 | self.repo_name = self._get_repo_name() |
|
1905 | self.repo_name = self._get_repo_name() | |
1906 | perms = user.permissions |
|
1906 | perms = user.permissions | |
1907 | try: |
|
1907 | try: | |
1908 |
user_perms = |
|
1908 | user_perms = {perms['repositories'][self.repo_name]} | |
1909 | except KeyError: |
|
1909 | except KeyError: | |
1910 | return False |
|
1910 | return False | |
1911 | if self.required_perms.intersection(user_perms): |
|
1911 | if self.required_perms.intersection(user_perms): | |
@@ -1922,8 +1922,7 b' class HasRepoGroupPermissionAny(PermsFun' | |||||
1922 | def check_permissions(self, user): |
|
1922 | def check_permissions(self, user): | |
1923 | perms = user.permissions |
|
1923 | perms = user.permissions | |
1924 | try: |
|
1924 | try: | |
1925 | user_perms = set( |
|
1925 | user_perms = {perms['repositories_groups'][self.repo_group_name]} | |
1926 | [perms['repositories_groups'][self.repo_group_name]]) |
|
|||
1927 | except KeyError: |
|
1926 | except KeyError: | |
1928 | return False |
|
1927 | return False | |
1929 | if self.required_perms.intersection(user_perms): |
|
1928 | if self.required_perms.intersection(user_perms): | |
@@ -1940,8 +1939,7 b' class HasRepoGroupPermissionAll(PermsFun' | |||||
1940 | def check_permissions(self, user): |
|
1939 | def check_permissions(self, user): | |
1941 | perms = user.permissions |
|
1940 | perms = user.permissions | |
1942 | try: |
|
1941 | try: | |
1943 | user_perms = set( |
|
1942 | user_perms = {perms['repositories_groups'][self.repo_group_name]} | |
1944 | [perms['repositories_groups'][self.repo_group_name]]) |
|
|||
1945 | except KeyError: |
|
1943 | except KeyError: | |
1946 | return False |
|
1944 | return False | |
1947 | if self.required_perms.issubset(user_perms): |
|
1945 | if self.required_perms.issubset(user_perms): | |
@@ -1958,7 +1956,7 b' class HasUserGroupPermissionAny(PermsFun' | |||||
1958 | def check_permissions(self, user): |
|
1956 | def check_permissions(self, user): | |
1959 | perms = user.permissions |
|
1957 | perms = user.permissions | |
1960 | try: |
|
1958 | try: | |
1961 |
user_perms = |
|
1959 | user_perms = {perms['user_groups'][self.user_group_name]} | |
1962 | except KeyError: |
|
1960 | except KeyError: | |
1963 | return False |
|
1961 | return False | |
1964 | if self.required_perms.intersection(user_perms): |
|
1962 | if self.required_perms.intersection(user_perms): | |
@@ -1975,7 +1973,7 b' class HasUserGroupPermissionAll(PermsFun' | |||||
1975 | def check_permissions(self, user): |
|
1973 | def check_permissions(self, user): | |
1976 | perms = user.permissions |
|
1974 | perms = user.permissions | |
1977 | try: |
|
1975 | try: | |
1978 |
user_perms = |
|
1976 | user_perms = {perms['user_groups'][self.user_group_name]} | |
1979 | except KeyError: |
|
1977 | except KeyError: | |
1980 | return False |
|
1978 | return False | |
1981 | if self.required_perms.issubset(user_perms): |
|
1979 | if self.required_perms.issubset(user_perms): | |
@@ -2011,7 +2009,7 b' class HasPermissionAnyMiddleware(object)' | |||||
2011 | perms = user.permissions_with_scope({'repo_name': repo_name}) |
|
2009 | perms = user.permissions_with_scope({'repo_name': repo_name}) | |
2012 |
|
2010 | |||
2013 | try: |
|
2011 | try: | |
2014 |
user_perms = |
|
2012 | user_perms = {perms['repositories'][repo_name]} | |
2015 | except Exception: |
|
2013 | except Exception: | |
2016 | log.exception('Error while accessing user permissions') |
|
2014 | log.exception('Error while accessing user permissions') | |
2017 | return False |
|
2015 | return False | |
@@ -2094,7 +2092,7 b' class HasRepoPermissionAllApi(_BaseApiPe' | |||||
2094 | def check_permissions(self, perm_defs, repo_name=None, group_name=None, |
|
2092 | def check_permissions(self, perm_defs, repo_name=None, group_name=None, | |
2095 | user_group_name=None): |
|
2093 | user_group_name=None): | |
2096 | try: |
|
2094 | try: | |
2097 |
_user_perms = |
|
2095 | _user_perms = {perm_defs['repositories'][repo_name]} | |
2098 | except KeyError: |
|
2096 | except KeyError: | |
2099 | log.warning(traceback.format_exc()) |
|
2097 | log.warning(traceback.format_exc()) | |
2100 | return False |
|
2098 | return False | |
@@ -2107,7 +2105,7 b' class HasRepoPermissionAnyApi(_BaseApiPe' | |||||
2107 | def check_permissions(self, perm_defs, repo_name=None, group_name=None, |
|
2105 | def check_permissions(self, perm_defs, repo_name=None, group_name=None, | |
2108 | user_group_name=None): |
|
2106 | user_group_name=None): | |
2109 | try: |
|
2107 | try: | |
2110 |
_user_perms = |
|
2108 | _user_perms = {perm_defs['repositories'][repo_name]} | |
2111 | except KeyError: |
|
2109 | except KeyError: | |
2112 | log.warning(traceback.format_exc()) |
|
2110 | log.warning(traceback.format_exc()) | |
2113 | return False |
|
2111 | return False | |
@@ -2120,7 +2118,7 b' class HasRepoGroupPermissionAnyApi(_Base' | |||||
2120 | def check_permissions(self, perm_defs, repo_name=None, group_name=None, |
|
2118 | def check_permissions(self, perm_defs, repo_name=None, group_name=None, | |
2121 | user_group_name=None): |
|
2119 | user_group_name=None): | |
2122 | try: |
|
2120 | try: | |
2123 |
_user_perms = |
|
2121 | _user_perms = {perm_defs['repositories_groups'][group_name]} | |
2124 | except KeyError: |
|
2122 | except KeyError: | |
2125 | log.warning(traceback.format_exc()) |
|
2123 | log.warning(traceback.format_exc()) | |
2126 | return False |
|
2124 | return False | |
@@ -2133,7 +2131,7 b' class HasRepoGroupPermissionAllApi(_Base' | |||||
2133 | def check_permissions(self, perm_defs, repo_name=None, group_name=None, |
|
2131 | def check_permissions(self, perm_defs, repo_name=None, group_name=None, | |
2134 | user_group_name=None): |
|
2132 | user_group_name=None): | |
2135 | try: |
|
2133 | try: | |
2136 |
_user_perms = |
|
2134 | _user_perms = {perm_defs['repositories_groups'][group_name]} | |
2137 | except KeyError: |
|
2135 | except KeyError: | |
2138 | log.warning(traceback.format_exc()) |
|
2136 | log.warning(traceback.format_exc()) | |
2139 | return False |
|
2137 | return False | |
@@ -2146,7 +2144,7 b' class HasUserGroupPermissionAnyApi(_Base' | |||||
2146 | def check_permissions(self, perm_defs, repo_name=None, group_name=None, |
|
2144 | def check_permissions(self, perm_defs, repo_name=None, group_name=None, | |
2147 | user_group_name=None): |
|
2145 | user_group_name=None): | |
2148 | try: |
|
2146 | try: | |
2149 |
_user_perms = |
|
2147 | _user_perms = {perm_defs['user_groups'][user_group_name]} | |
2150 | except KeyError: |
|
2148 | except KeyError: | |
2151 | log.warning(traceback.format_exc()) |
|
2149 | log.warning(traceback.format_exc()) | |
2152 | return False |
|
2150 | return False |
General Comments 0
You need to be logged in to leave comments.
Login now