##// END OF EJS Templates
permissions: flush all when running remap and rescan.
marcink -
r4428:61666194 default
parent child
Show More
@@ -47,6 +47,7 from rhodecode.model.db import RhodeCode
47 from rhodecode.model.forms import (ApplicationSettingsForm,
47 from rhodecode.model.forms import (ApplicationSettingsForm,
48 ApplicationUiSettingsForm, ApplicationVisualisationForm,
48 ApplicationUiSettingsForm, ApplicationVisualisationForm,
49 LabsSettingsForm, IssueTrackerPatternsForm)
49 LabsSettingsForm, IssueTrackerPatternsForm)
50 from rhodecode.model.permission import PermissionModel
50 from rhodecode.model.repo_group import RepoGroupModel
51 from rhodecode.model.repo_group import RepoGroupModel
51
52
52 from rhodecode.model.scm import ScmModel
53 from rhodecode.model.scm import ScmModel
@@ -253,8 +254,7 class AdminSettingsView(BaseAppView):
253 c.active = 'mapping'
254 c.active = 'mapping'
254 rm_obsolete = self.request.POST.get('destroy', False)
255 rm_obsolete = self.request.POST.get('destroy', False)
255 invalidate_cache = self.request.POST.get('invalidate', False)
256 invalidate_cache = self.request.POST.get('invalidate', False)
256 log.debug(
257 log.debug('rescanning repo location with destroy obsolete=%s', rm_obsolete)
257 'rescanning repo location with destroy obsolete=%s', rm_obsolete)
258
258
259 if invalidate_cache:
259 if invalidate_cache:
260 log.debug('invalidating all repositories cache')
260 log.debug('invalidating all repositories cache')
@@ -263,6 +263,8 class AdminSettingsView(BaseAppView):
263
263
264 filesystem_repos = ScmModel().repo_scan()
264 filesystem_repos = ScmModel().repo_scan()
265 added, removed = repo2db_mapper(filesystem_repos, rm_obsolete)
265 added, removed = repo2db_mapper(filesystem_repos, rm_obsolete)
266 PermissionModel().trigger_permission_flush()
267
266 _repr = lambda l: ', '.join(map(safe_unicode, l)) or '-'
268 _repr = lambda l: ', '.join(map(safe_unicode, l)) or '-'
267 h.flash(_('Repositories successfully '
269 h.flash(_('Repositories successfully '
268 'rescanned added: %s ; removed: %s') %
270 'rescanned added: %s ; removed: %s') %
@@ -577,7 +577,8 class PermissionModel(BaseModel):
577 user_group_write_permissions[p.users_group_id] = p
577 user_group_write_permissions[p.users_group_id] = p
578 return user_group_write_permissions
578 return user_group_write_permissions
579
579
580 def trigger_permission_flush(self, affected_user_ids):
580 def trigger_permission_flush(self, affected_user_ids=None):
581 affected_user_ids or User.get_all_user_ids()
581 events.trigger(events.UserPermissionsChange(affected_user_ids))
582 events.trigger(events.UserPermissionsChange(affected_user_ids))
582
583
583 def flush_user_permission_caches(self, changes, affected_user_ids=None):
584 def flush_user_permission_caches(self, changes, affected_user_ids=None):
General Comments 0
You need to be logged in to leave comments. Login now