mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-26 05:55:15 +00:00
Compare commits
2 Commits
dependabot
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4a66984ec4 | ||
|
|
715a8f421a |
@@ -197,6 +197,10 @@ module Spree
|
||||
can [:admin, :index, :destroy], :oidc_setting
|
||||
|
||||
can [:admin, :create], Voucher
|
||||
|
||||
can [:admin, :destroy], EnterpriseRole do |enterprise_role|
|
||||
enterprise_role.enterprise.owner_id == user.id
|
||||
end
|
||||
end
|
||||
|
||||
def add_product_management_abilities(user)
|
||||
|
||||
@@ -885,6 +885,47 @@ RSpec.describe '
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "removing enterprise managers" do
|
||||
let(:existing_user) { create(:user) }
|
||||
|
||||
before do
|
||||
distributor1.users << existing_user
|
||||
login_as logged_in_user
|
||||
visit edit_admin_enterprise_path(distributor1)
|
||||
scroll_to(:bottom)
|
||||
within ".side_menu" do
|
||||
find(:link, "Users").trigger("click")
|
||||
end
|
||||
end
|
||||
|
||||
context "as the enterprise owner" do
|
||||
let(:logged_in_user) { distributor1.owner }
|
||||
|
||||
it 'removes the manager as enterprise owner' do
|
||||
expect(page).to have_content existing_user.email
|
||||
|
||||
within "#manager-#{existing_user.id}" do
|
||||
accept_confirm do
|
||||
page.find("a.icon-trash").click
|
||||
end
|
||||
end
|
||||
|
||||
expect(page).not_to have_content existing_user.email
|
||||
end
|
||||
end
|
||||
|
||||
context "as the enterprise manager" do
|
||||
let(:logged_in_user) { existing_user }
|
||||
|
||||
it "is unable delete any other manager" do
|
||||
expect(page).to have_content existing_user.email
|
||||
within('.edit_enterprise') do
|
||||
expect(page).not_to have_selector('a.icon-trash')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "changing package" do
|
||||
|
||||
12
yarn.lock
12
yarn.lock
@@ -5477,14 +5477,14 @@ picocolors@1.1.1, picocolors@^1.1.1:
|
||||
integrity sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==
|
||||
|
||||
picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.3.1:
|
||||
version "2.3.2"
|
||||
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.2.tgz#5a942915e26b372dc0f0e6753149a16e6b1c5601"
|
||||
integrity sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==
|
||||
version "2.3.1"
|
||||
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42"
|
||||
integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==
|
||||
|
||||
picomatch@^4.0.2, picomatch@^4.0.3:
|
||||
version "4.0.4"
|
||||
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-4.0.4.tgz#fd6f5e00a143086e074dffe4c924b8fb293b0589"
|
||||
integrity sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==
|
||||
version "4.0.3"
|
||||
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-4.0.3.tgz#796c76136d1eead715db1e7bad785dedd695a042"
|
||||
integrity sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==
|
||||
|
||||
pify@^2.3.0:
|
||||
version "2.3.0"
|
||||
|
||||
Reference in New Issue
Block a user