replace permissions by core's

pull/6827/head
Jens Ulferts 7 years ago
parent 9b4a09f677
commit e45c2e069c
No known key found for this signature in database
GPG Key ID: 3CAA4B1182CF5308
  1. 2
      app/controllers/rb_impediments_controller.rb
  2. 6
      app/seeders/role_seeder.rb
  3. 2
      app/views/rb_impediments/_impediment.html.erb
  4. 4
      app/views/rb_taskboards/show.html.erb
  5. 2
      app/views/rb_tasks/_task.html.erb
  6. 6
      config/locales/en.yml
  7. 2
      features/common.feature
  8. 2
      features/edit_story.feature
  9. 3
      features/edit_story_tracker_and_status.feature
  10. 2
      features/export_card_configurations.feature
  11. 5
      features/fixed_version_by_issue_hierarchy.feature
  12. 1
      features/foldable_versions.feature
  13. 9
      features/issue_hierarchy_restriction_project_boundaries.feature
  14. 4
      features/product_owner.feature
  15. 4
      features/scrum_master.feature
  16. 3
      features/shared_versions.feature
  17. 5
      features/show_story.feature
  18. 2
      features/team_member.feature
  19. 28
      lib/open_project/backlogs/engine.rb
  20. 2
      spec/views/rb_burndown_charts/show_spec.rb
  21. 2
      spec/views/rb_taskboards/show_spec.rb

@ -75,7 +75,7 @@ class RbImpedimentsController < RbApplicationController
# We block block_ids only when user is not allowed to create or update the # We block block_ids only when user is not allowed to create or update the
# instance passed. # instance passed.
unless instance && ((instance.new_record? && User.current.allowed_to?(:create_impediments, @project)) || User.current.allowed_to?(:update_impediments, @project)) unless instance && ((instance.new_record? && User.current.allowed_to?(:add_work_packages, @project)) || User.current.allowed_to?(:edit_work_packages, @project))
hash.delete(:block_ids) hash.delete(:block_ids)
end end

@ -6,12 +6,6 @@ module BasicData
member[:permissions].concat %i( member[:permissions].concat %i(
view_master_backlog view_master_backlog
view_taskboards view_taskboards
create_stories
update_stories
create_tasks
update_tasks
create_impediments
update_impediments
) )
end end
end end

@ -34,7 +34,7 @@ See doc/COPYRIGHT.rdoc for more details.
++#%> ++#%>
<% prevent_edit = User.current.allowed_to?(:update_impediments, defined?(project) ? project : impediment.project) ? '' : 'prevent_edit'%> <% prevent_edit = User.current.allowed_to?(:edit_work_packages, defined?(project) ? project : impediment.project) ? '' : 'prevent_edit'%>
<div class="model work_package impediment <%= color_contrast_class(impediment) %> <%= prevent_edit %> <%= mark_if_closed(impediment) %><%= color_contrast_class(impediment) %>" id="work_package_<%= impediment.id %>" <%= build_inline_style(impediment) %>> <div class="model work_package impediment <%= color_contrast_class(impediment) %> <%= prevent_edit %> <%= mark_if_closed(impediment) %><%= color_contrast_class(impediment) %>" id="work_package_<%= impediment.id %>" <%= build_inline_style(impediment) %>>
<div class="id"> <div class="id">
<div class="t"><%= work_package_link_or_empty(impediment) %></div> <div class="t"><%= work_package_link_or_empty(impediment) %></div>

@ -69,7 +69,7 @@ See doc/COPYRIGHT.rdoc for more details.
<table id="impediments" class="board" cellspacing="0"> <table id="impediments" class="board" cellspacing="0">
<tr> <tr>
<td><div class="label_sprint_impediments"><%= l(:label_sprint_impediments) %></div></td> <td><div class="label_sprint_impediments"><%= l(:label_sprint_impediments) %></div></td>
<% if User.current.allowed_to?(:create_impediments, @project) %> <% if User.current.allowed_to?(:add_work_packages, @project) %>
<td class ="add_new clickable">+</td> <td class ="add_new clickable">+</td>
<% else %> <% else %>
<td class ="add_new"></td> <td class ="add_new"></td>
@ -113,7 +113,7 @@ See doc/COPYRIGHT.rdoc for more details.
</div> </div>
</div> </div>
</td> </td>
<% if User.current.allowed_to?(:create_tasks, @project) %> <% if User.current.allowed_to?(:add_work_packages, @project) %>
<td class ="add_new clickable">+</td> <td class ="add_new clickable">+</td>
<% else %> <% else %>
<td class ="add_new"></td> <td class ="add_new"></td>

@ -34,7 +34,7 @@ See doc/COPYRIGHT.rdoc for more details.
++#%> ++#%>
<% prevent_edit = User.current.allowed_to?(:update_tasks, defined?(project) ? project : task.project) ? '' : 'prevent_edit'%> <% prevent_edit = User.current.allowed_to?(:edit_work_packages, defined?(project) ? project : task.project) ? '' : 'prevent_edit'%>
<div class="model work_package task <%= color_contrast_class(task) %> <%= prevent_edit %> <%= mark_if_closed(task) %>" id="work_package_<%= task.id %>" <%= build_inline_style(task) %>> <div class="model work_package task <%= color_contrast_class(task) %> <%= prevent_edit %> <%= mark_if_closed(task) %>" id="work_package_<%= task.id %>" <%= build_inline_style(task) %>>
<div class="id"> <div class="id">
<div class="t"><%= work_package_link_or_empty(task) %></div> <div class="t"><%= work_package_link_or_empty(task) %></div>

@ -169,12 +169,6 @@ en:
permission_view_master_backlog: "View master backlog" permission_view_master_backlog: "View master backlog"
permission_view_taskboards: "View taskboards" permission_view_taskboards: "View taskboards"
permission_update_sprints: "Update sprints" permission_update_sprints: "Update sprints"
permission_create_stories: "Create stories"
permission_update_stories: "Update stories"
permission_create_tasks: "Create tasks"
permission_update_tasks: "Update tasks"
permission_create_impediments: "Create impediments"
permission_update_impediments: "Update impediments"
points_accepted: "points accepted" points_accepted: "points accepted"
points_committed: "points committed" points_committed: "points committed"

@ -51,8 +51,6 @@ Feature: Common
And the role "team member" may have the following rights: And the role "team member" may have the following rights:
| view_master_backlog | | view_master_backlog |
| view_taskboards | | view_taskboards |
| create_tasks |
| update_tasks |
| view_work_packages | | view_work_packages |
| edit_work_packages | | edit_work_packages |
| manage_subtasks | | manage_subtasks |

@ -58,8 +58,6 @@ Feature: Edit story on backlogs view
And there is a role "team member" And there is a role "team member"
And the role "team member" may have the following rights: And the role "team member" may have the following rights:
| view_master_backlog | | view_master_backlog |
| create_stories |
| update_stories |
| view_work_packages | | view_work_packages |
| edit_work_packages | | edit_work_packages |
| add_work_packages | | add_work_packages |

@ -60,9 +60,8 @@ Feature: Edit story type and status
And the user "romano" is a "manager" And the user "romano" is a "manager"
And the role "manager" may have the following rights: And the role "manager" may have the following rights:
| view_master_backlog | | view_master_backlog |
| create_stories |
| update_stories |
| view_work_packages | | view_work_packages |
| add_work_packages |
| edit_work_packages | | edit_work_packages |
| manage_subtasks | | manage_subtasks |
And the project has the following sprints: And the project has the following sprints:

@ -58,8 +58,6 @@ Feature: Export sprint stories as PDF on the Backlogs view
And there is a role "team member" And there is a role "team member"
And the role "team member" may have the following rights: And the role "team member" may have the following rights:
| view_master_backlog | | view_master_backlog |
| create_stories |
| update_stories |
| view_work_packages | | view_work_packages |
| edit_work_packages | | edit_work_packages |
| add_work_packages | | add_work_packages |

@ -50,16 +50,11 @@ Feature: The work_package hierarchy defines the allowed versions for each work_p
| view_master_backlog | | view_master_backlog |
| view_taskboards | | view_taskboards |
| update_sprints | | update_sprints |
| update_stories |
| create_impediments |
| update_impediments |
| update_tasks |
| view_wiki_pages | | view_wiki_pages |
| edit_wiki_pages | | edit_wiki_pages |
| view_work_packages | | view_work_packages |
| edit_work_packages | | edit_work_packages |
| manage_subtasks | | manage_subtasks |
| create_tasks |
| add_work_packages | | add_work_packages |
And there are the following issue status: And there are the following issue status:
| name | is_closed | is_default | | name | is_closed | is_default |

@ -46,7 +46,6 @@ Feature: Foldable versions in master backlog
| view_master_backlog | | view_master_backlog |
| view_taskboards | | view_taskboards |
| update_sprints | | update_sprints |
| update_stories |
| view_wiki_pages | | view_wiki_pages |
| edit_wiki_pages | | edit_wiki_pages |
| view_work_packages | | view_work_packages |

@ -49,19 +49,12 @@ Feature: The work_package hierarchy between backlogs stories and backlogs tasks
And the role "scrum master" may have the following rights: And the role "scrum master" may have the following rights:
| view_master_backlog | | view_master_backlog |
| view_taskboards | | view_taskboards |
| update_sprints |
| update_stories |
| create_impediments |
| update_impediments |
| update_tasks |
| view_wiki_pages | | view_wiki_pages |
| edit_wiki_pages | | edit_wiki_pages |
| view_work_packages | | view_work_packages |
| add_work_packages |
| edit_work_packages | | edit_work_packages |
| manage_subtasks | | manage_subtasks |
| create_tasks |
| add_work_packages |
| add_work_packages |
And the backlogs module is initialized And the backlogs module is initialized
And the following types are configured to track stories: And the following types are configured to track stories:
| Story | | Story |

@ -51,12 +51,10 @@ Feature: Product Owner
And there is a role "product owner" And there is a role "product owner"
And the role "product owner" may have the following rights: And the role "product owner" may have the following rights:
| view_master_backlog | | view_master_backlog |
| create_stories |
| update_stories |
| view_work_packages | | view_work_packages |
| add_work_packages |
| edit_work_packages | | edit_work_packages |
| manage_subtasks | | manage_subtasks |
| add_work_packages |
And the type "Story" has the default workflow for the role "product owner" And the type "Story" has the default workflow for the role "product owner"
And the type "Epic" has the default workflow for the role "product owner" And the type "Epic" has the default workflow for the role "product owner"

@ -49,11 +49,7 @@ Feature: Scrum Master
| view_master_backlog | | view_master_backlog |
| view_taskboards | | view_taskboards |
| update_sprints | | update_sprints |
| update_stories |
| create_impediments |
| update_impediments |
| add_work_packages | | add_work_packages |
| update_tasks |
| view_wiki_pages | | view_wiki_pages |
| edit_wiki_pages | | edit_wiki_pages |
| view_work_packages | | view_work_packages |

@ -70,8 +70,7 @@ Feature: Shared Versions
| manage_versions | | manage_versions |
| view_work_packages | | view_work_packages |
| view_master_backlog | | view_master_backlog |
| create_stories | | add_work_packages |
| update_stories |
| edit_work_packages | | edit_work_packages |
| manage_subtasks | | manage_subtasks |
And the user "padme" is a "project admin" And the user "padme" is a "project admin"

@ -46,13 +46,10 @@ Feature: Show story
| view_master_backlog | | view_master_backlog |
| view_taskboards | | view_taskboards |
| update_sprints | | update_sprints |
| update_stories |
| create_impediments |
| update_impediments |
| update_tasks |
| view_wiki_pages | | view_wiki_pages |
| edit_wiki_pages | | edit_wiki_pages |
| view_work_packages | | view_work_packages |
| add_work_packages |
| edit_work_packages | | edit_work_packages |
| manage_subtasks | | manage_subtasks |
And the backlogs module is initialized And the backlogs module is initialized

@ -61,8 +61,6 @@ Feature: Team Member
And the role "team member" may have the following rights: And the role "team member" may have the following rights:
| view_master_backlog | | view_master_backlog |
| view_taskboards | | view_taskboards |
| create_tasks |
| update_tasks |
| view_work_packages | | view_work_packages |
| edit_work_packages | | edit_work_packages |
| manage_subtasks | | manage_subtasks |

@ -59,6 +59,19 @@ module OpenProject::Backlogs
Redmine::AccessControl.permission(:edit_project).actions << 'projects/project_done_statuses' Redmine::AccessControl.permission(:edit_project).actions << 'projects/project_done_statuses'
Redmine::AccessControl.permission(:edit_project).actions << 'projects/rebuild_positions' Redmine::AccessControl.permission(:edit_project).actions << 'projects/rebuild_positions'
Redmine::AccessControl.permission(:add_work_packages).tap do |add|
add.actions << 'rb_stories/create'
add.actions << 'rb_tasks/create'
add.actions << 'rb_impediments/create'
end
Redmine::AccessControl.permission(:edit_work_packages).tap do |edit|
edit.actions << 'rb_stories/update'
edit.actions << 'rb_tasks/update'
edit.actions << 'rb_impediments/update'
end
project_module :backlogs do project_module :backlogs do
# SYNTAX: permission :name_of_permission, { :controller_name => [:action1, :action2] } # SYNTAX: permission :name_of_permission, { :controller_name => [:action1, :action2] }
@ -84,21 +97,6 @@ module OpenProject::Backlogs
# :show_sprints and :list_sprints are implicit in :view_master_backlog permission # :show_sprints and :list_sprints are implicit in :view_master_backlog permission
permission :update_sprints, rb_sprints: [:edit, :update], permission :update_sprints, rb_sprints: [:edit, :update],
rb_wikis: [:edit, :update] rb_wikis: [:edit, :update]
# Story permissions
# :show_stories and :list_stories are implicit in :view_master_backlog permission
permission :create_stories, rb_stories: :create
permission :update_stories, rb_stories: :update
# Task permissions
# :show_tasks and :list_tasks are implicit in :view_sprints
permission :create_tasks, rb_tasks: [:new, :create]
permission :update_tasks, rb_tasks: [:edit, :update]
# Impediment permissions
# :show_impediments and :list_impediments are implicit in :view_sprints
permission :create_impediments, rb_impediments: [:new, :create]
permission :update_impediments, rb_impediments: [:edit, :update]
end end
menu :project_menu, menu :project_menu,

@ -40,7 +40,7 @@ describe 'rb_burndown_charts/show', type: :view do
let(:user2) { FactoryGirl.create(:user) } let(:user2) { FactoryGirl.create(:user) }
let(:role_allowed) { let(:role_allowed) {
FactoryGirl.create(:role, FactoryGirl.create(:role,
permissions: [:create_impediments, :create_tasks, :update_impediments, :update_tasks]) permissions: [:add_work_packages, :manage_subtasks])
} }
let(:role_forbidden) { FactoryGirl.create(:role) } let(:role_forbidden) { FactoryGirl.create(:role) }
# We need to create these as some view helpers access the database # We need to create these as some view helpers access the database

@ -40,7 +40,7 @@ describe 'rb_taskboards/show', type: :view do
let(:user2) { FactoryGirl.create(:user) } let(:user2) { FactoryGirl.create(:user) }
let(:role_allowed) { let(:role_allowed) {
FactoryGirl.create(:role, FactoryGirl.create(:role,
permissions: [:create_impediments, :create_tasks, :update_impediments, :update_tasks]) permissions: [:add_work_packages, :edit_work_packages, :manage_subtasks])
} }
let(:role_forbidden) { FactoryGirl.create(:role) } let(:role_forbidden) { FactoryGirl.create(:role) }
# We need to create these as some view helpers access the database # We need to create these as some view helpers access the database

Loading…
Cancel
Save