diff --git a/pagure/templates/issue.html b/pagure/templates/issue.html index ad2620d..35d94d2 100644 --- a/pagure/templates/issue.html +++ b/pagure/templates/issue.html @@ -36,7 +36,7 @@

#{{ issueid }} {{ issue.title }} - {% if authenticated and repo_admin %} + {% if authenticated and (repo_admin or g.fas_user.username == issue.user.name) %} - Edit diff --git a/pagure/ui/issues.py b/pagure/ui/issues.py index 1b0c137..164877a 100644 --- a/pagure/ui/issues.py +++ b/pagure/ui/issues.py @@ -546,15 +546,16 @@ def edit_issue(repo, issueid, username=None): if not repo.settings.get('issue_tracker', True): flask.abort(404, 'No issue tracker found for this project') - if not is_repo_admin(repo): - flask.abort( - 403, 'You are not allowed to edit issues for this project') - issue = pagure.lib.search_issues(SESSION, repo, issueid=issueid) if issue is None or issue.project != repo: flask.abort(404, 'Issue not found') + if not (is_repo_admin(repo) + or flask.g.fas_user.username == issue.user.username): + flask.abort( + 403, 'You are not allowed to edit issues for this project') + status = pagure.lib.get_issue_statuses(SESSION) form = pagure.forms.IssueForm(status=status) if form.validate_on_submit():