Added ability to local_writer to merge/update PullRequest

This commit is contained in:
Vokhmin Alexey V 2014-06-17 23:48:22 +04:00
parent 3c670c369a
commit 16fd0a106b
2 changed files with 4 additions and 4 deletions

View File

@ -154,8 +154,8 @@ class Ability
can [:read, :commits, :files], PullRequest, to_project: {owner_type: 'Group', owner_id: user_group_ids}
can([:read, :commits, :files], PullRequest, read_relations_for('pull_requests', 'to_projects')) {|pull| can? :read, pull.to_project}
can :create, PullRequest
can(:update, PullRequest) {|pull| pull.user_id == user.id or local_admin?(pull.to_project)}
can(:merge, PullRequest) {|pull| local_admin?(pull.to_project)}
can(:update, PullRequest) {|pull| pull.user_id == user.id or local_writer?(pull.to_project)}
can(:merge, PullRequest) {|pull| local_writer?(pull.to_project)}
can([:create, :new_line], Comment) {|comment| can? :read, comment.project}
can([:update, :destroy], Comment) {|comment| comment.user == user or comment.project.owner == user or local_admin?(comment.project)}

View File

@ -151,7 +151,7 @@ shared_examples_for 'user without pull request update rights' do
pull.issue.body.should_not =='updating'
end
it 'should be able to perform merge action' do
it 'should not be able to perform merge action' do
@pull.check
put :merge, @update_params
response.should_not be_success
@ -239,7 +239,7 @@ describe Projects::PullRequestsController do
it_should_behave_like 'pull request user with project guest rights'
it_should_behave_like 'pull request user with project reader rights'
it_should_behave_like 'user without pull request update rights'
it_should_behave_like 'user with pull request update rights'
it_should_behave_like 'pull request when project with issues turned off'
end