Show More
@@ -174,7 +174,21 b' def _usermatch(ui, user, usersorgroups):' | |||||
174 | return True |
|
174 | return True | |
175 |
|
175 | |||
176 | for ug in usersorgroups.replace(',', ' ').split(): |
|
176 | for ug in usersorgroups.replace(',', ' ').split(): | |
177 | if user == ug or ug.startswith('@') and user in _getusers(ui, ug[1:]): |
|
177 | ||
|
178 | if ug.startswith('!'): | |||
|
179 | # Test for excluded user or group. Format: | |||
|
180 | # if ug is a user name: !username | |||
|
181 | # if ug is a group name: !@groupname | |||
|
182 | ug = ug[1:] | |||
|
183 | if not ug.startswith('@') and user != ug \ | |||
|
184 | or ug.startswith('@') and user not in _getusers(ui, ug[1:]): | |||
|
185 | return True | |||
|
186 | ||||
|
187 | # Test for user or group. Format: | |||
|
188 | # if ug is a user name: username | |||
|
189 | # if ug is a group name: @groupname | |||
|
190 | elif user == ug \ | |||
|
191 | or ug.startswith('@') and user in _getusers(ui, ug[1:]): | |||
178 | return True |
|
192 | return True | |
179 |
|
193 | |||
180 | return False |
|
194 | return False |
@@ -1919,3 +1919,155 b' Branch acl conflicting deny' | |||||
1919 | no rollback information available |
|
1919 | no rollback information available | |
1920 | 2:fb35475503ef |
|
1920 | 2:fb35475503ef | |
1921 |
|
1921 | |||
|
1922 | User 'astro' must not be denied | |||
|
1923 | ||||
|
1924 | $ init_config | |||
|
1925 | $ echo "[acl.deny.branches]" >> $config | |||
|
1926 | $ echo "default = !astro" >> $config | |||
|
1927 | $ do_push astro | |||
|
1928 | Pushing as user astro | |||
|
1929 | hgrc = """ | |||
|
1930 | [acl] | |||
|
1931 | sources = push | |||
|
1932 | [extensions] | |||
|
1933 | [acl.deny.branches] | |||
|
1934 | default = !astro | |||
|
1935 | """ | |||
|
1936 | pushing to ../b | |||
|
1937 | query 1; heads | |||
|
1938 | searching for changes | |||
|
1939 | all remote heads known locally | |||
|
1940 | 4 changesets found | |||
|
1941 | list of changesets: | |||
|
1942 | ef1ea85a6374b77d6da9dcda9541f498f2d17df7 | |||
|
1943 | f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd | |||
|
1944 | 911600dab2ae7a9baff75958b84fe606851ce955 | |||
|
1945 | e8fc755d4d8217ee5b0c2bb41558c40d43b92c01 | |||
|
1946 | adding changesets | |||
|
1947 | bundling: 1/4 changesets (25.00%) | |||
|
1948 | bundling: 2/4 changesets (50.00%) | |||
|
1949 | bundling: 3/4 changesets (75.00%) | |||
|
1950 | bundling: 4/4 changesets (100.00%) | |||
|
1951 | bundling: 1/4 manifests (25.00%) | |||
|
1952 | bundling: 2/4 manifests (50.00%) | |||
|
1953 | bundling: 3/4 manifests (75.00%) | |||
|
1954 | bundling: 4/4 manifests (100.00%) | |||
|
1955 | bundling: abc.txt 1/4 files (25.00%) | |||
|
1956 | bundling: foo/Bar/file.txt 2/4 files (50.00%) | |||
|
1957 | bundling: foo/file.txt 3/4 files (75.00%) | |||
|
1958 | bundling: quux/file.py 4/4 files (100.00%) | |||
|
1959 | changesets: 1 chunks | |||
|
1960 | add changeset ef1ea85a6374 | |||
|
1961 | changesets: 2 chunks | |||
|
1962 | add changeset f9cafe1212c8 | |||
|
1963 | changesets: 3 chunks | |||
|
1964 | add changeset 911600dab2ae | |||
|
1965 | changesets: 4 chunks | |||
|
1966 | add changeset e8fc755d4d82 | |||
|
1967 | adding manifests | |||
|
1968 | manifests: 1/4 chunks (25.00%) | |||
|
1969 | manifests: 2/4 chunks (50.00%) | |||
|
1970 | manifests: 3/4 chunks (75.00%) | |||
|
1971 | manifests: 4/4 chunks (100.00%) | |||
|
1972 | adding file changes | |||
|
1973 | adding abc.txt revisions | |||
|
1974 | files: 1/4 chunks (25.00%) | |||
|
1975 | adding foo/Bar/file.txt revisions | |||
|
1976 | files: 2/4 chunks (50.00%) | |||
|
1977 | adding foo/file.txt revisions | |||
|
1978 | files: 3/4 chunks (75.00%) | |||
|
1979 | adding quux/file.py revisions | |||
|
1980 | files: 4/4 chunks (100.00%) | |||
|
1981 | added 4 changesets with 4 changes to 4 files (+1 heads) | |||
|
1982 | calling hook pretxnchangegroup.acl: hgext.acl.hook | |||
|
1983 | acl: checking access for user "astro" | |||
|
1984 | acl: acl.allow.branches not enabled | |||
|
1985 | acl: acl.deny.branches enabled, 0 entries for user astro | |||
|
1986 | acl: acl.allow not enabled | |||
|
1987 | acl: acl.deny not enabled | |||
|
1988 | acl: branch access granted: "ef1ea85a6374" on branch "default" | |||
|
1989 | acl: path access granted: "ef1ea85a6374" | |||
|
1990 | acl: branch access granted: "f9cafe1212c8" on branch "default" | |||
|
1991 | acl: path access granted: "f9cafe1212c8" | |||
|
1992 | acl: branch access granted: "911600dab2ae" on branch "default" | |||
|
1993 | acl: path access granted: "911600dab2ae" | |||
|
1994 | acl: branch access granted: "e8fc755d4d82" on branch "foobar" | |||
|
1995 | acl: path access granted: "e8fc755d4d82" | |||
|
1996 | updating the branch cache | |||
|
1997 | checking for updated bookmarks | |||
|
1998 | repository tip rolled back to revision 2 (undo push) | |||
|
1999 | 2:fb35475503ef | |||
|
2000 | ||||
|
2001 | ||||
|
2002 | Non-astro users must be denied | |||
|
2003 | ||||
|
2004 | $ do_push george | |||
|
2005 | Pushing as user george | |||
|
2006 | hgrc = """ | |||
|
2007 | [acl] | |||
|
2008 | sources = push | |||
|
2009 | [extensions] | |||
|
2010 | [acl.deny.branches] | |||
|
2011 | default = !astro | |||
|
2012 | """ | |||
|
2013 | pushing to ../b | |||
|
2014 | query 1; heads | |||
|
2015 | searching for changes | |||
|
2016 | all remote heads known locally | |||
|
2017 | invalidating branch cache (tip differs) | |||
|
2018 | 4 changesets found | |||
|
2019 | list of changesets: | |||
|
2020 | ef1ea85a6374b77d6da9dcda9541f498f2d17df7 | |||
|
2021 | f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd | |||
|
2022 | 911600dab2ae7a9baff75958b84fe606851ce955 | |||
|
2023 | e8fc755d4d8217ee5b0c2bb41558c40d43b92c01 | |||
|
2024 | adding changesets | |||
|
2025 | bundling: 1/4 changesets (25.00%) | |||
|
2026 | bundling: 2/4 changesets (50.00%) | |||
|
2027 | bundling: 3/4 changesets (75.00%) | |||
|
2028 | bundling: 4/4 changesets (100.00%) | |||
|
2029 | bundling: 1/4 manifests (25.00%) | |||
|
2030 | bundling: 2/4 manifests (50.00%) | |||
|
2031 | bundling: 3/4 manifests (75.00%) | |||
|
2032 | bundling: 4/4 manifests (100.00%) | |||
|
2033 | bundling: abc.txt 1/4 files (25.00%) | |||
|
2034 | bundling: foo/Bar/file.txt 2/4 files (50.00%) | |||
|
2035 | bundling: foo/file.txt 3/4 files (75.00%) | |||
|
2036 | bundling: quux/file.py 4/4 files (100.00%) | |||
|
2037 | changesets: 1 chunks | |||
|
2038 | add changeset ef1ea85a6374 | |||
|
2039 | changesets: 2 chunks | |||
|
2040 | add changeset f9cafe1212c8 | |||
|
2041 | changesets: 3 chunks | |||
|
2042 | add changeset 911600dab2ae | |||
|
2043 | changesets: 4 chunks | |||
|
2044 | add changeset e8fc755d4d82 | |||
|
2045 | adding manifests | |||
|
2046 | manifests: 1/4 chunks (25.00%) | |||
|
2047 | manifests: 2/4 chunks (50.00%) | |||
|
2048 | manifests: 3/4 chunks (75.00%) | |||
|
2049 | manifests: 4/4 chunks (100.00%) | |||
|
2050 | adding file changes | |||
|
2051 | adding abc.txt revisions | |||
|
2052 | files: 1/4 chunks (25.00%) | |||
|
2053 | adding foo/Bar/file.txt revisions | |||
|
2054 | files: 2/4 chunks (50.00%) | |||
|
2055 | adding foo/file.txt revisions | |||
|
2056 | files: 3/4 chunks (75.00%) | |||
|
2057 | adding quux/file.py revisions | |||
|
2058 | files: 4/4 chunks (100.00%) | |||
|
2059 | added 4 changesets with 4 changes to 4 files (+1 heads) | |||
|
2060 | calling hook pretxnchangegroup.acl: hgext.acl.hook | |||
|
2061 | acl: checking access for user "george" | |||
|
2062 | acl: acl.allow.branches not enabled | |||
|
2063 | acl: acl.deny.branches enabled, 1 entries for user george | |||
|
2064 | acl: acl.allow not enabled | |||
|
2065 | acl: acl.deny not enabled | |||
|
2066 | error: pretxnchangegroup.acl hook failed: acl: user "george" denied on branch "default" (changeset "ef1ea85a6374") | |||
|
2067 | transaction abort! | |||
|
2068 | rollback completed | |||
|
2069 | abort: acl: user "george" denied on branch "default" (changeset "ef1ea85a6374") | |||
|
2070 | no rollback information available | |||
|
2071 | 2:fb35475503ef | |||
|
2072 | ||||
|
2073 |
General Comments 0
You need to be logged in to leave comments.
Login now