Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix authorizations collection to be scped by organization #9

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ def destroy
private

def collection
Decidim::Authorization.where(name: "direct_verifications").includes(:user)
# Decidim::Verifications::Authorizations Query
Decidim::Verifications::Authorizations.new(
organization: current_organization,
name: "direct_verifications",
granted: true
).query
end

def authorization
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
describe "Admin manages imported authorizations", type: :system do
let(:organization) { create(:organization) }
let(:user) { create(:user, :admin, :confirmed, organization: organization) }
let(:out_of_scope_user) { create(:user, :confirmed) }

let!(:authorization) { create(:authorization, :direct_verification) }
let!(:authorization) { create(:authorization, :direct_verification, user: user) }
let!(:out_of_scope_authorization) { create(:authorization, :direct_verification, user: out_of_scope_user) }
let!(:non_direct_authorization) { create(:authorization) }

let(:scope) { "decidim.direct_verifications.verification.admin" }
Expand Down Expand Up @@ -36,6 +38,7 @@
end

expect(page).not_to have_content(non_direct_authorization.name)
expect(page).not_to have_content(out_of_scope_authorization.user.name)
end

it "lets users navigate to stats and new import" do
Expand Down