##// END OF EJS Templates
api: added proper full permission flush on API calls when creating repos and repo groups....
super-admin -
r4697:63f392fc stable
parent child Browse files
Show More
@@ -232,6 +232,9 b' def create_repo_group('
232 232 user=apiuser)
233 233
234 234 Session().commit()
235
236 PermissionModel().trigger_permission_flush()
237
235 238 return {
236 239 'msg': 'Created new repo group `%s`' % validated_group_name,
237 240 'repo_group': repo_group.get_api_data()
@@ -349,13 +349,7 b' class AdminRepoGroupsView(BaseAppView, D'
349 349 % repo_group_name, category='error')
350 350 raise HTTPFound(h.route_path('home'))
351 351
352 affected_user_ids = [self._rhodecode_user.user_id]
353 if copy_permissions:
354 user_group_perms = repo_group.permissions(expand_from_user_groups=True)
355 copy_perms = [perm['user_id'] for perm in user_group_perms]
356 # also include those newly created by copy
357 affected_user_ids.extend(copy_perms)
358 PermissionModel().trigger_permission_flush(affected_user_ids)
352 PermissionModel().trigger_permission_flush()
359 353
360 354 raise HTTPFound(
361 355 h.route_path('repo_group_home',
@@ -242,11 +242,7 b' class AdminReposView(BaseAppView, DataGr'
242 242
243 243 repo_name = form_result.get('repo_name_full')
244 244
245 affected_user_ids = [self._rhodecode_user.user_id]
246 if copy_permissions:
247 # permission flush is done in repo creating
248 pass
249 PermissionModel().trigger_permission_flush(affected_user_ids)
245 PermissionModel().trigger_permission_flush()
250 246
251 247 raise HTTPFound(
252 248 h.route_path('repo_creating', repo_name=repo_name,
@@ -131,7 +131,7 b' class IntegrationTypeBase(object):'
131 131 :param event:
132 132 :return: bool
133 133 """
134 allowed_events = self.settings['events']
134 allowed_events = self.settings.get('events') or []
135 135 if event.name not in allowed_events:
136 136 log.debug('event ignored: %r event %s not in allowed set of events %s',
137 137 event, event.name, allowed_events)
@@ -38,6 +38,7 b' from rhodecode.lib import hooks_base'
38 38 from rhodecode.lib.utils2 import safe_int, str2bool, aslist
39 39 from rhodecode.model.db import (
40 40 Session, IntegrityError, true, Repository, RepoGroup, User)
41 from rhodecode.model.permission import PermissionModel
41 42
42 43
43 44 @async_task(ignore_result=True, base=RequestContextTask)
@@ -216,6 +217,9 b' def create_repo(form_data, cur_user):'
216 217 repo=audit_logger.RepoWrap(repo_name=repo_name, repo_id=repo_id))
217 218
218 219 Session().commit()
220
221 PermissionModel().trigger_permission_flush()
222
219 223 except Exception as e:
220 224 log.warning('Exception occurred when creating repository, '
221 225 'doing cleanup...', exc_info=True)
General Comments 0
You need to be logged in to leave comments. Login now