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