Show More
@@ -91,7 +91,7 b' class PasswordGenerator(object):' | |||
|
91 | 91 | def gen_password(self, length, type_=None): |
|
92 | 92 | if type_ is None: |
|
93 | 93 | type_ = self.ALPHABETS_FULL |
|
94 |
self.passwd = ''.join([random.choice(type_) for _ in |
|
|
94 | self.passwd = ''.join([random.choice(type_) for _ in range(length)]) | |
|
95 | 95 | return self.passwd |
|
96 | 96 | |
|
97 | 97 | |
@@ -948,13 +948,13 b' class AuthUser(object):' | |||
|
948 | 948 | perms = self.get_perms(user=self, cache=False) |
|
949 | 949 | |
|
950 | 950 | perms['repositories'] = { |
|
951 |
k: v for k, v in perms['repositories']. |
|
|
951 | k: v for k, v in perms['repositories'].items() | |
|
952 | 952 | if v != 'repository.none'} |
|
953 | 953 | perms['repositories_groups'] = { |
|
954 |
k: v for k, v in perms['repositories_groups']. |
|
|
954 | k: v for k, v in perms['repositories_groups'].items() | |
|
955 | 955 | if v != 'group.none'} |
|
956 | 956 | perms['user_groups'] = { |
|
957 |
k: v for k, v in perms['user_groups']. |
|
|
957 | k: v for k, v in perms['user_groups'].items() | |
|
958 | 958 | if v != 'usergroup.none'} |
|
959 | 959 | return perms |
|
960 | 960 | |
@@ -1111,7 +1111,7 b' class AuthUser(object):' | |||
|
1111 | 1111 | Returns list of repositories you're an admin of |
|
1112 | 1112 | """ |
|
1113 | 1113 | return [ |
|
1114 |
x[0] for x in self.permissions['repositories']. |
|
|
1114 | x[0] for x in self.permissions['repositories'].items() | |
|
1115 | 1115 | if x[1] == 'repository.admin'] |
|
1116 | 1116 | |
|
1117 | 1117 | @property |
@@ -1120,7 +1120,7 b' class AuthUser(object):' | |||
|
1120 | 1120 | Returns list of repository groups you're an admin of |
|
1121 | 1121 | """ |
|
1122 | 1122 | return [ |
|
1123 |
x[0] for x in self.permissions['repositories_groups']. |
|
|
1123 | x[0] for x in self.permissions['repositories_groups'].items() | |
|
1124 | 1124 | if x[1] == 'group.admin'] |
|
1125 | 1125 | |
|
1126 | 1126 | @property |
@@ -1129,7 +1129,7 b' class AuthUser(object):' | |||
|
1129 | 1129 | Returns list of user groups you're an admin of |
|
1130 | 1130 | """ |
|
1131 | 1131 | return [ |
|
1132 |
x[0] for x in self.permissions['user_groups']. |
|
|
1132 | x[0] for x in self.permissions['user_groups'].items() | |
|
1133 | 1133 | if x[1] == 'usergroup.admin'] |
|
1134 | 1134 | |
|
1135 | 1135 | def repo_acl_ids(self, perms=None, name_filter=None, cache=False): |
@@ -1143,10 +1143,10 b' class AuthUser(object):' | |||
|
1143 | 1143 | perms = [ |
|
1144 | 1144 | 'repository.read', 'repository.write', 'repository.admin'] |
|
1145 | 1145 | |
|
1146 | def _cached_repo_acl(user_id, perm_def, name_filter): | |
|
1146 | def _cached_repo_acl(user_id, perm_def, _name_filter): | |
|
1147 | 1147 | qry = Repository.query() |
|
1148 | if name_filter: | |
|
1149 | ilike_expression = u'%{}%'.format(safe_unicode(name_filter)) | |
|
1148 | if _name_filter: | |
|
1149 | ilike_expression = u'%{}%'.format(safe_unicode(_name_filter)) | |
|
1150 | 1150 | qry = qry.filter( |
|
1151 | 1151 | Repository.repo_name.ilike(ilike_expression)) |
|
1152 | 1152 | |
@@ -1169,10 +1169,10 b' class AuthUser(object):' | |||
|
1169 | 1169 | perms = [ |
|
1170 | 1170 | 'group.read', 'group.write', 'group.admin'] |
|
1171 | 1171 | |
|
1172 | def _cached_repo_group_acl(user_id, perm_def, name_filter): | |
|
1172 | def _cached_repo_group_acl(user_id, perm_def, _name_filter): | |
|
1173 | 1173 | qry = RepoGroup.query() |
|
1174 | if name_filter: | |
|
1175 | ilike_expression = u'%{}%'.format(safe_unicode(name_filter)) | |
|
1174 | if _name_filter: | |
|
1175 | ilike_expression = u'%{}%'.format(safe_unicode(_name_filter)) | |
|
1176 | 1176 | qry = qry.filter( |
|
1177 | 1177 | RepoGroup.group_name.ilike(ilike_expression)) |
|
1178 | 1178 |
General Comments 0
You need to be logged in to leave comments.
Login now