##// 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 user=apiuser)
232 user=apiuser)
233
233
234 Session().commit()
234 Session().commit()
235
236 PermissionModel().trigger_permission_flush()
237
235 return {
238 return {
236 'msg': 'Created new repo group `%s`' % validated_group_name,
239 'msg': 'Created new repo group `%s`' % validated_group_name,
237 'repo_group': repo_group.get_api_data()
240 'repo_group': repo_group.get_api_data()
@@ -349,13 +349,7 b' class AdminRepoGroupsView(BaseAppView, D'
349 % repo_group_name, category='error')
349 % repo_group_name, category='error')
350 raise HTTPFound(h.route_path('home'))
350 raise HTTPFound(h.route_path('home'))
351
351
352 affected_user_ids = [self._rhodecode_user.user_id]
352 PermissionModel().trigger_permission_flush()
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)
359
353
360 raise HTTPFound(
354 raise HTTPFound(
361 h.route_path('repo_group_home',
355 h.route_path('repo_group_home',
@@ -242,11 +242,7 b' class AdminReposView(BaseAppView, DataGr'
242
242
243 repo_name = form_result.get('repo_name_full')
243 repo_name = form_result.get('repo_name_full')
244
244
245 affected_user_ids = [self._rhodecode_user.user_id]
245 PermissionModel().trigger_permission_flush()
246 if copy_permissions:
247 # permission flush is done in repo creating
248 pass
249 PermissionModel().trigger_permission_flush(affected_user_ids)
250
246
251 raise HTTPFound(
247 raise HTTPFound(
252 h.route_path('repo_creating', repo_name=repo_name,
248 h.route_path('repo_creating', repo_name=repo_name,
@@ -131,7 +131,7 b' class IntegrationTypeBase(object):'
131 :param event:
131 :param event:
132 :return: bool
132 :return: bool
133 """
133 """
134 allowed_events = self.settings['events']
134 allowed_events = self.settings.get('events') or []
135 if event.name not in allowed_events:
135 if event.name not in allowed_events:
136 log.debug('event ignored: %r event %s not in allowed set of events %s',
136 log.debug('event ignored: %r event %s not in allowed set of events %s',
137 event, event.name, allowed_events)
137 event, event.name, allowed_events)
@@ -38,6 +38,7 b' from rhodecode.lib import hooks_base'
38 from rhodecode.lib.utils2 import safe_int, str2bool, aslist
38 from rhodecode.lib.utils2 import safe_int, str2bool, aslist
39 from rhodecode.model.db import (
39 from rhodecode.model.db import (
40 Session, IntegrityError, true, Repository, RepoGroup, User)
40 Session, IntegrityError, true, Repository, RepoGroup, User)
41 from rhodecode.model.permission import PermissionModel
41
42
42
43
43 @async_task(ignore_result=True, base=RequestContextTask)
44 @async_task(ignore_result=True, base=RequestContextTask)
@@ -216,6 +217,9 b' def create_repo(form_data, cur_user):'
216 repo=audit_logger.RepoWrap(repo_name=repo_name, repo_id=repo_id))
217 repo=audit_logger.RepoWrap(repo_name=repo_name, repo_id=repo_id))
217
218
218 Session().commit()
219 Session().commit()
220
221 PermissionModel().trigger_permission_flush()
222
219 except Exception as e:
223 except Exception as e:
220 log.warning('Exception occurred when creating repository, '
224 log.warning('Exception occurred when creating repository, '
221 'doing cleanup...', exc_info=True)
225 'doing cleanup...', exc_info=True)
General Comments 0
You need to be logged in to leave comments. Login now