parent
bf638d7077
commit
b3ec4792c5
@ -1,72 +0,0 @@ |
||||
#-- copyright |
||||
# OpenProject Global Roles Plugin |
||||
# |
||||
# Copyright (C) 2010 - 2014 the OpenProject Foundation (OPF) |
||||
# |
||||
# This program is free software; you can redistribute it and/or |
||||
# modify it under the terms of the GNU General Public License |
||||
# version 3. |
||||
# |
||||
# This program is distributed in the hope that it will be useful, |
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
# GNU General Public License for more details. |
||||
# |
||||
# You should have received a copy of the GNU General Public License |
||||
# along with this program; if not, write to the Free Software |
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
||||
#++ |
||||
|
||||
Feature: Global Create Project |
||||
|
||||
Scenario: Create Project is not a member permission |
||||
Given there is a role "Member" |
||||
And I am already admin |
||||
When I go to the edit page of the role "Member" |
||||
Then I should not see "Create project" |
||||
|
||||
Scenario: Create Project is a global permission |
||||
Given there is a global role "Global" |
||||
And I am already admin |
||||
When I go to the edit page of the role "Global" |
||||
Then I should see "Create project" |
||||
|
||||
Scenario: Create Project displayed to user |
||||
Given there is a global role "Global" |
||||
And the global role "Global" may have the following rights: |
||||
| add_project | |
||||
And there is 1 User with: |
||||
| Login | bob | |
||||
| Firstname | Bob | |
||||
| Lastname | Bobbit | |
||||
And the user "bob" has the global role "Global" |
||||
When I am already logged in as "bob" |
||||
And I go to the overall projects page |
||||
Then I should see "Project" within ".toolbar-items" |
||||
|
||||
Scenario: Create Project not displayed to user without global role |
||||
Given there is 1 User with: |
||||
| Login | bob | |
||||
| Firstname | Bob | |
||||
| Lastname | Bobbit | |
||||
When I am already logged in as "bob" |
||||
And I go to the overall projects page |
||||
Then I should not see "Project" within ".toolbar-items" |
||||
|
||||
@javascript |
||||
Scenario: Create Project displayed to user |
||||
Given there is a global role "Global" |
||||
And the global role "Global" may have the following rights: |
||||
| add_project | |
||||
And there is a role "Manager" |
||||
And there is 1 User with: |
||||
| Login | bob | |
||||
| Firstname | Bob | |
||||
| Lastname | Bobbit | |
||||
And the user "bob" has the global role "Global" |
||||
When I am already logged in as "bob" |
||||
And I go to the new page of "Project" |
||||
And I fill in "project_name" with "ProjectName" |
||||
And I press "Create" |
||||
Then I should see "Successful creation." |
||||
And I should be on the overview page of the project called "ProjectName" |
@ -1,79 +0,0 @@ |
||||
#-- copyright |
||||
# OpenProject Global Roles Plugin |
||||
# |
||||
# Copyright (C) 2010 - 2014 the OpenProject Foundation (OPF) |
||||
# |
||||
# This program is free software; you can redistribute it and/or |
||||
# modify it under the terms of the GNU General Public License |
||||
# version 3. |
||||
# |
||||
# This program is distributed in the hope that it will be useful, |
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
# GNU General Public License for more details. |
||||
# |
||||
# You should have received a copy of the GNU General Public License |
||||
# along with this program; if not, write to the Free Software |
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
||||
#++ |
||||
|
||||
Feature: Global Role Assignment |
||||
|
||||
@javascript |
||||
Scenario: Going to the global role assignment page |
||||
Given there is the global permission "global1" of the module "global" |
||||
And there is the global permission "global2" of the module "global" |
||||
And there is a global role "global_role1" |
||||
And there is a global role "global_role2" |
||||
And the global role "global_role1" may have the following rights: |
||||
| global1 | |
||||
And the global role "global_role2" may have the following rights: |
||||
| global2 | |
||||
And there is 1 User with: |
||||
| Login | bob | |
||||
| Firstname | Bob | |
||||
| Lastname | Bobbit | |
||||
And the user "bob" has the global role "global_role1" |
||||
And I am already admin |
||||
When I go to the edit page of the user called "bob" |
||||
And I click on "tab-global_roles" |
||||
Then I should see "global_role1" within "#table_principal_roles" |
||||
And I should not see "global_role1" within "#available_principal_roles" |
||||
And I should see "global_role2" within "#available_principal_roles" |
||||
|
||||
@javascript |
||||
Scenario: Assigning a global role to a user |
||||
Given there is the global permission "global1" of the module "global" |
||||
And there is a global role "global_role" |
||||
And the global role "global_role" may have the following rights: |
||||
| global1 | |
||||
And there is 1 User with: |
||||
| Login | bob | |
||||
| Firstname | Bob | |
||||
| Lastname | Bobbit | |
||||
And I am already admin |
||||
When I go to the edit page of the user called "bob" |
||||
And I click on "tab-global_roles" |
||||
And I select the available global role "global_role" |
||||
And I press "Add" |
||||
Then I should see "global_role" within "#table_principal_roles" |
||||
And I should not see "global_role" within "#available_principal_roles" |
||||
And I should see "There is currently nothing to display" |
||||
|
||||
@javascript |
||||
Scenario: Deleting a global role of a user |
||||
Given there is the global permission "global1" of the module "global" |
||||
And there is a global role "global_role" |
||||
And the global role "global_role" may have the following rights: |
||||
| global1 | |
||||
And there is 1 User with: |
||||
| Login | bob | |
||||
| Firstname | Bob | |
||||
| Lastname | Bobbit | |
||||
And the user "bob" has the global role "global_role" |
||||
And I am already admin |
||||
When I go to the edit page of the user called "bob" |
||||
And I click on "tab-global_roles" |
||||
And I delete the assigned role "global_role" |
||||
Then I should see "Nothing to display" within "#assigned_principal_roles" |
||||
And I should see "global_role" within "#available_principal_roles" |
@ -1,43 +0,0 @@ |
||||
#-- copyright |
||||
# OpenProject Global Roles Plugin |
||||
# |
||||
# Copyright (C) 2010 - 2014 the OpenProject Foundation (OPF) |
||||
# |
||||
# This program is free software; you can redistribute it and/or |
||||
# modify it under the terms of the GNU General Public License |
||||
# version 3. |
||||
# |
||||
# This program is distributed in the hope that it will be useful, |
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
# GNU General Public License for more details. |
||||
# |
||||
# You should have received a copy of the GNU General Public License |
||||
# along with this program; if not, write to the Free Software |
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
||||
#++ |
||||
|
||||
Feature: As an admin |
||||
I want to administrate global roles with permissions |
||||
So that I can modify permission groups |
||||
|
||||
@javascript |
||||
Scenario: Global Role creation |
||||
Given there is the global permission "glob_test" of the module "global_group" |
||||
And I am already admin |
||||
When I go to the new page of "Role" |
||||
Then I should not see block with "#global_permissions" |
||||
When I check "Global Role" |
||||
Then I should see block with "#global_permissions" |
||||
And I should see "Global group" |
||||
And I should see "Glob test" |
||||
And I should not see "Issues can be assigned to this role" |
||||
When I fill in "Name" with "Manager" |
||||
And I click on "Create" |
||||
Then I should see "Successful creation." |
||||
|
||||
Scenario: Global Roles can not be assigned issues to |
||||
Given there is a global role "global_role_x" |
||||
And I am already admin |
||||
When I go to the edit page of the role called "global_role_x" |
||||
Then I should not see "Issues can be assigned to this role" |
@ -1,33 +0,0 @@ |
||||
#-- copyright |
||||
# OpenProject Global Roles Plugin |
||||
# |
||||
# Copyright (C) 2010 - 2014 the OpenProject Foundation (OPF) |
||||
# |
||||
# This program is free software; you can redistribute it and/or |
||||
# modify it under the terms of the GNU General Public License |
||||
# version 3. |
||||
# |
||||
# This program is distributed in the hope that it will be useful, |
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
# GNU General Public License for more details. |
||||
# |
||||
# You should have received a copy of the GNU General Public License |
||||
# along with this program; if not, write to the Free Software |
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
||||
#++ |
||||
|
||||
Feature: Unchanged Member Roles |
||||
|
||||
@javascript |
||||
Scenario: Global Roles should not be displayed as assignable project roles |
||||
Given there is 1 project with the following: |
||||
| Name | projectname | |
||||
| Identifier | projectid | |
||||
And there is a global role "GlobalRole1" |
||||
And there is a role "MemberRole1" |
||||
And I am already admin |
||||
When I go to the members page of the project "projectid" |
||||
And I click "Add member" |
||||
Then I should see "MemberRole1" within "#member_role_ids" |
||||
Then I should not see "GlobalRole1" within "#member_role_ids" |
@ -1,29 +0,0 @@ |
||||
#-- copyright |
||||
# OpenProject Global Roles Plugin |
||||
# |
||||
# Copyright (C) 2010 - 2014 the OpenProject Foundation (OPF) |
||||
# |
||||
# This program is free software; you can redistribute it and/or |
||||
# modify it under the terms of the GNU General Public License |
||||
# version 3. |
||||
# |
||||
# This program is distributed in the hope that it will be useful, |
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
# GNU General Public License for more details. |
||||
# |
||||
# You should have received a copy of the GNU General Public License |
||||
# along with this program; if not, write to the Free Software |
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
||||
#++ |
||||
|
||||
Feature: No Module |
||||
|
||||
Scenario: Global Rights Modules do not exist as Project -> Settings -> Modules |
||||
Given there is the global permission "glob_test" of the module "global" |
||||
And there is 1 project with the following: |
||||
| name | test | |
||||
| identifier | test | |
||||
And I am already admin |
||||
When I go to the members tab of the settings page for the project "test" |
||||
Then I should not see "Global" |
@ -1,93 +0,0 @@ |
||||
#-- copyright |
||||
# OpenProject Global Roles Plugin |
||||
# |
||||
# Copyright (C) 2010 - 2014 the OpenProject Foundation (OPF) |
||||
# |
||||
# This program is free software; you can redistribute it and/or |
||||
# modify it under the terms of the GNU General Public License |
||||
# version 3. |
||||
# |
||||
# This program is distributed in the hope that it will be useful, |
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
# GNU General Public License for more details. |
||||
# |
||||
# You should have received a copy of the GNU General Public License |
||||
# along with this program; if not, write to the Free Software |
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
||||
#++ |
||||
|
||||
Given /^there is the global permission "(.+)?" of the module "(.+)?"$/ do |perm_name, perm_module| |
||||
Redmine::AccessControl.map do |map| |
||||
map.project_module perm_module.to_sym do |mod| |
||||
mod.permission perm_name.to_sym, { dont: :care }, project_module: perm_module.to_sym, global: true |
||||
end |
||||
end |
||||
end |
||||
|
||||
Given /^the global permission "(.+)?" of the module "(.+)?" is defined$/ do |perm_name, perm_module| |
||||
as_admin do |
||||
permissions = Redmine::AccessControl.modules_permissions(perm_module) |
||||
permissions.detect { |p| p.name == perm_name.to_sym && p.global? }.should_not be_nil |
||||
end |
||||
end |
||||
|
||||
Given /^there is a global [rR]ole "([^\"]*)"$/ do |name| |
||||
FactoryBot.create(:global_role, name: name) unless GlobalRole.find_by_name(name) |
||||
end |
||||
|
||||
Given /^the global [rR]ole "([^\"]*)" may have the following [rR]ights:$/ do |role, table| |
||||
r = GlobalRole.find_by_name(role) |
||||
fail "No such role was defined: #{role}" unless r |
||||
as_admin do |
||||
available_perms = Redmine::AccessControl.permissions.collect(&:name) |
||||
r.permissions = [] |
||||
|
||||
table.raw.each do |perm| |
||||
permission = perm.first |
||||
unless permission.blank? |
||||
permission = permission.tr(' ', '_').underscore.to_sym |
||||
if available_perms.include?(:"#{permission}") |
||||
r.add_permission! permission |
||||
end |
||||
end |
||||
end |
||||
|
||||
r.save! |
||||
end |
||||
end |
||||
|
||||
Given /^the [Uu]ser (.+) has the global role (.+)$/ do |user, role| |
||||
user = User.find_by_login(user.delete("\"")) |
||||
role = GlobalRole.find_by_name(role.delete("\"")) |
||||
|
||||
as_admin do |
||||
FactoryBot.create(:principal_role, principal: user, role: role) |
||||
end |
||||
end |
||||
|
||||
When /^I select the available global role (.+)$/ do |role| |
||||
r = GlobalRole.find_by_name(role.delete("\"")) |
||||
fail "No such role was defined: #{role}" unless r |
||||
steps %( |
||||
When I check "principal_role_role_ids_#{r.id}" |
||||
) |
||||
end |
||||
|
||||
When /^I delete the assigned role (.+)$/ do |role| |
||||
g = GlobalRole.find_by_name(role.delete("\"")) |
||||
fail "No such role was defined: #{role}" unless g |
||||
fail 'More than one or no principal has this role' if g.principal_roles.length != 1 |
||||
|
||||
steps %( |
||||
When I follow "Delete" within "#principal_role-#{g.principal_roles[0].id}" |
||||
) |
||||
end |
||||
|
||||
Then /^I should (not )?see block with "(.+)?"$/ do |negative, id| |
||||
unless negative |
||||
expect(page).to have_css("#{id}", visible: true) |
||||
else |
||||
expect(page).to have_css("#{id}", visible: false) |
||||
end |
||||
end |
@ -0,0 +1,105 @@ |
||||
#-- copyright |
||||
# OpenProject is a project management system. |
||||
# Copyright (C) 2012-2018 the OpenProject Foundation (OPF) |
||||
# |
||||
# This program is free software; you can redistribute it and/or |
||||
# modify it under the terms of the GNU General Public License version 3. |
||||
# |
||||
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: |
||||
# Copyright (C) 2006-2017 Jean-Philippe Lang |
||||
# Copyright (C) 2010-2013 the ChiliProject Team |
||||
# |
||||
# This program is free software; you can redistribute it and/or |
||||
# modify it under the terms of the GNU General Public License |
||||
# as published by the Free Software Foundation; either version 2 |
||||
# of the License, or (at your option) any later version. |
||||
# |
||||
# This program is distributed in the hope that it will be useful, |
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
# GNU General Public License for more details. |
||||
# |
||||
# You should have received a copy of the GNU General Public License |
||||
# along with this program; if not, write to the Free Software |
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
||||
# |
||||
# See docs/COPYRIGHT.rdoc for more details. |
||||
#++ |
||||
|
||||
require_relative '../spec_helper' |
||||
|
||||
describe 'Global role: Global Create project', type: :feature, js: true do |
||||
let(:user) { FactoryBot.create(:admin) } |
||||
let(:project) { FactoryBot.create :project } |
||||
|
||||
before do |
||||
login_as(user) |
||||
end |
||||
|
||||
describe 'Create Project is not a member permission' do |
||||
# Given there is a role "Member" |
||||
let!(:role) { FactoryBot.create(:role, name: 'Member') } |
||||
|
||||
# And I am already admin |
||||
# When I go to the edit page of the role "Member" |
||||
# Then I should not see "Create project" |
||||
it 'does not show the global permission' do |
||||
visit edit_role_path(role) |
||||
expect(page).to have_selector('.form--label-with-check-box', text: 'Edit project') |
||||
expect(page).to have_no_selector('.form--label-with-check-box', text: 'Create project') |
||||
end |
||||
end |
||||
|
||||
describe 'Create Project is a global permission' do |
||||
# Given there is a global role "Global" |
||||
let!(:role) { FactoryBot.create(:global_role, name: 'Global') } |
||||
# And I am already admin |
||||
# When I go to the edit page of the role "Global" |
||||
# Then I should see "Create project" |
||||
it 'does show the global permission' do |
||||
visit edit_role_path(role) |
||||
expect(page).to have_no_selector('.form--label-with-check-box', text: 'Edit project') |
||||
expect(page).to have_selector('.form--label-with-check-box', text: 'Create project') |
||||
end |
||||
end |
||||
|
||||
describe 'Create Project displayed to user' do |
||||
# Given there is a global role "Global" |
||||
let!(:role) { FactoryBot.create(:global_role, name: 'Global', permissions: %i[add_project]) } |
||||
# And the global role "Global" may have the following rights: |
||||
# And the user "bob" has the global role "Global" |
||||
let(:user) { FactoryBot.create :user } |
||||
let!(:principal_role) { FactoryBot.create(:principal_role, principal: user, role: role) } |
||||
# When I am already logged in as "bob" |
||||
it 'does show the global permission' do |
||||
# And I go to the overall projects page |
||||
visit projects_path |
||||
# Then I should see "Project" within ".toolbar-items |
||||
expect(page).to have_selector('.button.-alt-highlight', text: 'Project') |
||||
|
||||
# Can add new project |
||||
visit new_project_path |
||||
|
||||
fill_in 'project_name', with: 'New project name' |
||||
click_on 'Create' |
||||
|
||||
expect(page).to have_text 'Successful creation.' |
||||
expect(current_path).to match /projects\/new-project-name/ |
||||
end |
||||
end |
||||
|
||||
describe 'Create Project not displayed to user without global role' do |
||||
# Given there is 1 User with: |
||||
# | Login | bob | |
||||
# | Firstname | Bob | |
||||
# | Lastname | Bobbit | |
||||
# When I am already logged in as "bob" |
||||
let(:user) { FactoryBot.create :user } |
||||
it 'does show the global permission' do |
||||
# And I go to the overall projects page |
||||
visit projects_path |
||||
# Then I should not see "Project" within ".toolbar-items" |
||||
expect(page).to have_no_selector('.button.-alt-highlight', text: 'Project') |
||||
end |
||||
end |
||||
end |
@ -0,0 +1,108 @@ |
||||
#-- copyright |
||||
# OpenProject is a project management system. |
||||
# Copyright (C) 2012-2018 the OpenProject Foundation (OPF) |
||||
# |
||||
# This program is free software; you can redistribute it and/or |
||||
# modify it under the terms of the GNU General Public License version 3. |
||||
# |
||||
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: |
||||
# Copyright (C) 2006-2017 Jean-Philippe Lang |
||||
# Copyright (C) 2010-2013 the ChiliProject Team |
||||
# |
||||
# This program is free software; you can redistribute it and/or |
||||
# modify it under the terms of the GNU General Public License |
||||
# as published by the Free Software Foundation; either version 2 |
||||
# of the License, or (at your option) any later version. |
||||
# |
||||
# This program is distributed in the hope that it will be useful, |
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
# GNU General Public License for more details. |
||||
# |
||||
# You should have received a copy of the GNU General Public License |
||||
# along with this program; if not, write to the Free Software |
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
||||
# |
||||
# See docs/COPYRIGHT.rdoc for more details. |
||||
#++ |
||||
|
||||
require_relative '../spec_helper' |
||||
|
||||
describe 'Global role: Global role assignment', type: :feature, js: true do |
||||
before do |
||||
login_as(current_user) |
||||
end |
||||
|
||||
# @javascript |
||||
describe 'Going to the global role assignment page' do |
||||
# Given there is the global permission "global1" of the module "global" |
||||
# And there is the global permission "global2" of the module "global" |
||||
before do |
||||
mock_global_permissions [['global1', project_module: :global], ['global2', project_module: :global]] |
||||
end |
||||
# And there is a global role "global_role1" |
||||
let!(:global_role1) { FactoryBot.create :global_role, name: 'global_role1', permissions: %i[global1] } |
||||
# And there is a global role "global_role2" |
||||
let!(:global_role2) { FactoryBot.create :global_role, name: 'global_role2', permissions: %i[global2] } |
||||
# And there is 1 User with: |
||||
# | Login | bob | |
||||
# | Firstname | Bob | |
||||
# | Lastname | Bobbit | |
||||
# And the user "bob" has the global role "global_role1" |
||||
let!(:user) { FactoryBot.create :user } |
||||
let!(:principal_role) { FactoryBot.create(:principal_role, principal: user, role: global_role1) } |
||||
# And I am already admin |
||||
let(:current_user) { FactoryBot.create :admin } |
||||
|
||||
it 'allows global roles management' do |
||||
# When I go to the edit page of the user called "bob" |
||||
visit edit_user_path user |
||||
# And I click on "tab-global_roles" |
||||
page.find('#tab-global_roles').click |
||||
# Then I should see "global_role1" within "#table_principal_roles" |
||||
page.within('#table_principal_roles') do |
||||
expect(page).to have_text 'global_role1' |
||||
end |
||||
# And I should not see "global_role1" within "#available_principal_roles" |
||||
# And I should see "global_role2" within "#available_principal_roles" |
||||
page.within('#available_principal_roles') do |
||||
expect(page).to have_no_text 'global_role1' |
||||
expect(page).to have_text 'global_role2' |
||||
end |
||||
|
||||
# And I select the available global role "global_role" |
||||
check 'global_role2' |
||||
# And I press "Add" |
||||
click_on 'Add' |
||||
|
||||
# Then I should see "global_role" within "#table_principal_roles" |
||||
page.within('#available_principal_roles') do |
||||
expect(page).to have_no_text 'global_role1' |
||||
expect(page).to have_no_text 'global_role2' |
||||
end |
||||
# And I should not see "global_role" within "#available_principal_roles" |
||||
# And I should see "There is currently nothing to display" |
||||
page.within('#table_principal_roles') do |
||||
expect(page).to have_text 'global_role1' |
||||
expect(page).to have_text 'global_role2' |
||||
end |
||||
|
||||
# And I delete the assigned role "global_role" |
||||
page.within("#principal_role-#{principal_role.id}") do |
||||
page.find('.buttons a.icon-delete').click |
||||
end |
||||
|
||||
# Then I should see "global_role" within "#table_principal_roles" |
||||
page.within('#available_principal_roles') do |
||||
expect(page).to have_text 'global_role1' |
||||
expect(page).to have_no_text 'global_role2' |
||||
end |
||||
# And I should not see "global_role" within "#available_principal_roles" |
||||
# And I should see "There is currently nothing to display" |
||||
page.within('#table_principal_roles') do |
||||
expect(page).to have_no_text 'global_role1' |
||||
expect(page).to have_text 'global_role2' |
||||
end |
||||
end |
||||
end |
||||
end |
@ -0,0 +1,64 @@ |
||||
#-- copyright |
||||
# OpenProject is a project management system. |
||||
# Copyright (C) 2012-2018 the OpenProject Foundation (OPF) |
||||
# |
||||
# This program is free software; you can redistribute it and/or |
||||
# modify it under the terms of the GNU General Public License version 3. |
||||
# |
||||
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: |
||||
# Copyright (C) 2006-2017 Jean-Philippe Lang |
||||
# Copyright (C) 2010-2013 the ChiliProject Team |
||||
# |
||||
# This program is free software; you can redistribute it and/or |
||||
# modify it under the terms of the GNU General Public License |
||||
# as published by the Free Software Foundation; either version 2 |
||||
# of the License, or (at your option) any later version. |
||||
# |
||||
# This program is distributed in the hope that it will be useful, |
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
# GNU General Public License for more details. |
||||
# |
||||
# You should have received a copy of the GNU General Public License |
||||
# along with this program; if not, write to the Free Software |
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
||||
# |
||||
# See docs/COPYRIGHT.rdoc for more details. |
||||
#++ |
||||
|
||||
require_relative '../spec_helper' |
||||
|
||||
describe 'Global role: Global role CRUD', type: :feature, js: true do |
||||
# Scenario: Global Role creation |
||||
# Given there is the global permission "glob_test" of the module "global_group" |
||||
before do |
||||
mock_global_permissions [['glob_test', project_module: 'global_group']] |
||||
login_as(current_user) |
||||
end |
||||
|
||||
# And I am already admin |
||||
let(:current_user) { FactoryBot.create :admin } |
||||
|
||||
it 'can create global role with that perm' do |
||||
# When I go to the new page of "Role" |
||||
visit new_role_path |
||||
# Then I should not see block with "#global_permissions" |
||||
expect(page).to have_no_selector('#global_permissions', visible: true) |
||||
# When I check "Global Role" |
||||
check 'Global Role' |
||||
# Then I should see block with "#global_permissions" |
||||
expect(page).to have_selector('#global_permissions', visible: true) |
||||
# And I should see "Global group" |
||||
expect(page).to have_text 'GLOBAL GROUP' |
||||
# And I should see "Glob test" |
||||
expect(page).to have_text 'Glob test' |
||||
# And I should not see "Issues can be assigned to this role" |
||||
expect(page).to have_no_text 'Issues can be assigned to this role' |
||||
# When I fill in "Name" with "Manager" |
||||
fill_in 'Name', with: 'Manager' |
||||
# And I click on "Create" |
||||
click_on 'Create' |
||||
# Then I should see "Successful creation." |
||||
expect(page).to have_text 'Successful creation.' |
||||
end |
||||
end |
@ -0,0 +1,63 @@ |
||||
#-- copyright |
||||
# OpenProject is a project management system. |
||||
# Copyright (C) 2012-2018 the OpenProject Foundation (OPF) |
||||
# |
||||
# This program is free software; you can redistribute it and/or |
||||
# modify it under the terms of the GNU General Public License version 3. |
||||
# |
||||
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: |
||||
# Copyright (C) 2006-2017 Jean-Philippe Lang |
||||
# Copyright (C) 2010-2013 the ChiliProject Team |
||||
# |
||||
# This program is free software; you can redistribute it and/or |
||||
# modify it under the terms of the GNU General Public License |
||||
# as published by the Free Software Foundation; either version 2 |
||||
# of the License, or (at your option) any later version. |
||||
# |
||||
# This program is distributed in the hope that it will be useful, |
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
# GNU General Public License for more details. |
||||
# |
||||
# You should have received a copy of the GNU General Public License |
||||
# along with this program; if not, write to the Free Software |
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
||||
# |
||||
# See docs/COPYRIGHT.rdoc for more details. |
||||
#++ |
||||
|
||||
require_relative '../spec_helper' |
||||
|
||||
describe 'Global role: Unchanged Member Roles', type: :feature, js: true do |
||||
let(:admin) { FactoryBot.create(:admin) } |
||||
let(:project) { FactoryBot.create :project } |
||||
let!(:role) { FactoryBot.create(:role, name: 'MemberRole1') } |
||||
let!(:global_role) { FactoryBot.create(:global_role, name: 'GlobalRole1') } |
||||
|
||||
let(:members) { ::Pages::Members.new project.identifier } |
||||
|
||||
before do |
||||
login_as(admin) |
||||
end |
||||
|
||||
scenario 'Global Rights Modules do not exist as Project -> Settings -> Modules' do |
||||
|
||||
# Scenario: Global Roles should not be displayed as assignable project roles |
||||
# Given there is 1 project with the following: |
||||
# | Name | projectname | |
||||
# | Identifier | projectid | |
||||
# And there is a global role "GlobalRole1" |
||||
# And there is a role "MemberRole1" |
||||
# And I am already admin |
||||
# When I go to the members page of the project "projectid" |
||||
visit project_members_path(project) |
||||
# And I click "Add member" |
||||
members.open_new_member! |
||||
|
||||
# Then I should see "MemberRole1" within "#member_role_ids" |
||||
members.expect_role 'MemberRole1' |
||||
|
||||
# Then I should not see "GlobalRole1" within "#member_role_ids" |
||||
members.expect_role 'GlobalRole1', present: false |
||||
end |
||||
end |
@ -0,0 +1,59 @@ |
||||
#-- copyright |
||||
# OpenProject is a project management system. |
||||
# Copyright (C) 2012-2018 the OpenProject Foundation (OPF) |
||||
# |
||||
# This program is free software; you can redistribute it and/or |
||||
# modify it under the terms of the GNU General Public License version 3. |
||||
# |
||||
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: |
||||
# Copyright (C) 2006-2017 Jean-Philippe Lang |
||||
# Copyright (C) 2010-2013 the ChiliProject Team |
||||
# |
||||
# This program is free software; you can redistribute it and/or |
||||
# modify it under the terms of the GNU General Public License |
||||
# as published by the Free Software Foundation; either version 2 |
||||
# of the License, or (at your option) any later version. |
||||
# |
||||
# This program is distributed in the hope that it will be useful, |
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
# GNU General Public License for more details. |
||||
# |
||||
# You should have received a copy of the GNU General Public License |
||||
# along with this program; if not, write to the Free Software |
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
||||
# |
||||
# See docs/COPYRIGHT.rdoc for more details. |
||||
#++ |
||||
|
||||
require_relative '../spec_helper' |
||||
|
||||
describe 'Global role: No module', type: :feature, js: true do |
||||
let(:admin) { FactoryBot.create(:admin) } |
||||
let(:project) { FactoryBot.create :project } |
||||
let!(:role) { FactoryBot.create(:role) } |
||||
|
||||
before do |
||||
login_as(admin) |
||||
end |
||||
|
||||
scenario 'Global Rights Modules do not exist as Project -> Settings -> Modules' do |
||||
# Scenario: |
||||
# Given there is the global permission "glob_test" of the module "global" |
||||
mock_global_permissions [['global_perm1', project_module: :global]] |
||||
|
||||
# And there is 1 project with the following: |
||||
# | name | test | |
||||
# | identifier | test | |
||||
# And I am already admin |
||||
# When I go to the modules tab of the settings page for the project "test" |
||||
# Then I should not see "Global" |
||||
visit settings_project_path(project, tab: 'modules') |
||||
|
||||
expect(page).to have_selector('#tab-content-modules') |
||||
page.within('#tab-content-modules') do |
||||
expect(page).to have_text 'Activity' |
||||
expect(page).to have_no_text 'Foo' |
||||
end |
||||
end |
||||
end |
Loading…
Reference in new issue