Show More
@@ -35,7 +35,7 b' from rhodecode.lib.datelib import (' | |||
|
35 | 35 | date_to_timestamp_plus_offset, utcdate_fromtimestamp, makedate, |
|
36 | 36 | date_astimestamp) |
|
37 | 37 | from rhodecode.lib.utils import safe_unicode, safe_str |
|
38 | from rhodecode.lib.vcs import connection | |
|
38 | from rhodecode.lib.vcs import connection, exceptions | |
|
39 | 39 | from rhodecode.lib.vcs.backends.base import ( |
|
40 | 40 | BaseRepository, CollectionGenerator, Config, MergeResponse, |
|
41 | 41 | MergeFailureReason, Reference, BasePathPermissionChecker) |
@@ -894,28 +894,31 b' class MercurialRepository(BaseRepository' | |||
|
894 | 894 | def get_path_permissions(self, username): |
|
895 | 895 | hgacl_file = self.path + '/.hg/hgacl' |
|
896 | 896 | if os.path.exists(hgacl_file): |
|
897 | hgacl = ConfigParser.RawConfigParser() | |
|
898 | hgacl.read(hgacl_file) | |
|
899 | def read_patterns(suffix): | |
|
900 | svalue = None | |
|
901 |
|
|
|
902 | svalue = hgacl.get('narrowhgacl', username + suffix) | |
|
903 | except ConfigParser.NoOptionError: | |
|
897 | try: | |
|
898 | hgacl = ConfigParser.RawConfigParser() | |
|
899 | hgacl.read(hgacl_file) | |
|
900 | def read_patterns(suffix): | |
|
901 | svalue = None | |
|
904 | 902 | try: |
|
905 |
svalue = hgacl.get('narrowhgacl', |
|
|
903 | svalue = hgacl.get('narrowhgacl', username + suffix) | |
|
906 | 904 | except ConfigParser.NoOptionError: |
|
907 |
|
|
|
908 | if not svalue: | |
|
909 | return None | |
|
910 | result = ['/'] | |
|
911 |
f |
|
|
912 |
|
|
|
913 | if '*' not in pattern and '?' not in pattern: | |
|
914 |
|
|
|
915 | return result | |
|
916 | includes = read_patterns('.includes') | |
|
917 | excludes = read_patterns('.excludes') | |
|
918 | return BasePathPermissionChecker.create_from_patterns(includes, excludes) | |
|
905 | try: | |
|
906 | svalue = hgacl.get('narrowhgacl', 'default' + suffix) | |
|
907 | except ConfigParser.NoOptionError: | |
|
908 | pass | |
|
909 | if not svalue: | |
|
910 | return None | |
|
911 | result = ['/'] | |
|
912 | for pattern in svalue.split(): | |
|
913 | result.append(pattern) | |
|
914 | if '*' not in pattern and '?' not in pattern: | |
|
915 | result.append(pattern + '/*') | |
|
916 | return result | |
|
917 | includes = read_patterns('.includes') | |
|
918 | excludes = read_patterns('.excludes') | |
|
919 | return BasePathPermissionChecker.create_from_patterns(includes, excludes) | |
|
920 | except BaseException as e: | |
|
921 | raise exceptions.RepositoryRequirementError('Cannot read ACL settings for {}: {}'.format(self.name, e)) | |
|
919 | 922 | else: |
|
920 | 923 | return None |
|
921 | 924 |
General Comments 0
You need to be logged in to leave comments.
Login now