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