Show More
@@ -31,12 +31,12 b' from pyramid.renderers import render' | |||
|
31 | 31 | |
|
32 | 32 | from rhodecode.apps._base import BaseAppView |
|
33 | 33 | from rhodecode.model.db import ( |
|
34 | or_, joinedload, UserLog, UserFollowing, User, UserApiKeys) | |
|
34 | or_, joinedload, Repository, UserLog, UserFollowing, User, UserApiKeys) | |
|
35 | 35 | from rhodecode.model.meta import Session |
|
36 | 36 | import rhodecode.lib.helpers as h |
|
37 | 37 | from rhodecode.lib.helpers import Page |
|
38 | 38 | from rhodecode.lib.user_log_filter import user_log_filter |
|
39 | from rhodecode.lib.auth import LoginRequired, NotAnonymous, CSRFRequired | |
|
39 | from rhodecode.lib.auth import LoginRequired, NotAnonymous, CSRFRequired, HasRepoPermissionAny | |
|
40 | 40 | from rhodecode.lib.utils2 import safe_int, AttributeDict, md5_safe |
|
41 | 41 | from rhodecode.model.scm import ScmModel |
|
42 | 42 | |
@@ -304,7 +304,10 b' class JournalView(BaseAppView):' | |||
|
304 | 304 | raise HTTPBadRequest() |
|
305 | 305 | |
|
306 | 306 | repo_id = self.request.POST.get('follows_repo_id') |
|
307 | if repo_id: | |
|
307 | repo = Repository.get_or_404(repo_id) | |
|
308 | perm_set = ['repository.read', 'repository.write', 'repository.admin'] | |
|
309 | has_perm = HasRepoPermissionAny(*perm_set)(repo.repo_name, 'RepoWatch check') | |
|
310 | if repo and has_perm: | |
|
308 | 311 | try: |
|
309 | 312 | ScmModel().toggle_following_repo(repo_id, self._rhodecode_user.user_id) |
|
310 | 313 | Session().commit() |
General Comments 0
You need to be logged in to leave comments.
Login now