Self-hosted project management for devs and their clients: tickets, time tracking, docs and meetings, with an AI assistant that cites its sources. AGPL-3.0.
Ruby agplai-assistantdockerdsgvogdprhotwireissue-trackerjira-alternativeknowledge-basellmmcp-servermeeting-notesopen-sourceproject-managementredmine-alternativeruby-on-railsself-hostedticketingtime-tracking
Bind ids from requests to the organisation where nothing else did
Guido Boykeeb7a48ab5111
diff --git a/.github/workflows/guards.yml b/.github/workflows/guards.ymlindex 9830cdf..a21f22b 100644--- a/.github/workflows/guards.yml+++ b/.github/workflows/guards.yml@@ -179,6 +179,7 @@ jobs:spec/jobs/meetings/ticket_suggestion_job_spec.rbspec/jobs/email_delivery_job_access_gate_spec.rbspec/jobs/tenant_propagation_spec.rb+ spec/jobs/import_users_from_codebase_job_spec.rbspec/jobs/embedding_processing_job_spec.rbspec/locales/spec/lib/lalabase/admin_extensions_spec.rb@@ -225,6 +226,7 @@ jobs:spec/models/ticket_spec.rbspec/models/ticket_relation_tenant_boundary_spec.rbspec/models/view_configuration_pinned_columns_spec.rb+ spec/models/view_configuration_kanban_spec.rbspec/models/time_session_spec.rbspec/models/time_sessions/list_period_spec.rbspec/models/time_sessions/list_filters_spec.rbdiff --git a/app/jobs/import_users_from_codebase_job.rb b/app/jobs/import_users_from_codebase_job.rbindex 6a034a8..7300ee8 100644--- a/app/jobs/import_users_from_codebase_job.rb+++ b/app/jobs/import_users_from_codebase_job.rb@@ -32,7 +32,7 @@ class ImportUsersFromCodebaseJob < ApplicationJobwhen /\Amap:(.+)\z/existing_user_id = Regexp.last_match(1)- result = map_to_existing_user(user_data, existing_user_id)+ result = map_to_existing_user(user_data, existing_user_id, organisation)results[result[:status]] += 1when 'skip'@@ -109,8 +109,11 @@ class ImportUsersFromCodebaseJob < ApplicationJob{ status: :failed, error: e.message }end- def map_to_existing_user(user_data, existing_user_id)- existing_user = User.find(existing_user_id)+ # The id comes from the request; the preview only offers members. User carries no+ # tenant, so without the organisation here any account of the instance could become+ # the author of imported tickets, posts and time entries.+ def map_to_existing_user(user_data, existing_user_id, organisation)+ existing_user = organisation.users.find(existing_user_id)CodebaseImportMapping.create!(codebase_id: user_data[:id],diff --git a/app/models/post.rb b/app/models/post.rbindex 812d981..716fb5c 100644--- a/app/models/post.rb+++ b/app/models/post.rb@@ -79,6 +79,7 @@ class Post < ApplicationRecord# Callbacks - set visible_to_user before validationbefore_validation :set_visible_to_user_on_privatevalidate :private_post_visibility_consistency+ validate :addressee_in_organisationbefore_save :extract_plain_text_contentafter_create_commit :auto_subscribe_author@@ -123,7 +124,9 @@ class Post < ApplicationRecordenddef set_visible_to_user_on_private- if is_private? && visible_to_user.nil?+ # The id, not the association: an id that resolves to nobody stays and fails the+ # check below, instead of quietly becoming the author.+ if is_private? && visible_to_user_id.nil?self.visible_to_user = userelsif !is_private?self.visible_to_user = nil@@ -138,6 +141,18 @@ class Post < ApplicationRecorderrors.add(:visible_to_user, :not_for_public)end+ # The addressee can come from the request (API). User carries no tenant, so without+ # this any account of the instance was taken, and the answer told an existing id from+ # a missing one. The author is always allowed: a note to oneself is the form's default.+ def addressee_in_organisation+ return unless is_private? && visible_to_user_id.present?+ return unless will_save_change_to_visible_to_user_id?+ return if visible_to_user_id == user_id+ return if organisation&.memberships&.exists?(user_id: visible_to_user_id)++ errors.add(:visible_to_user, :not_a_member)+ end+def auto_subscribe_authorreturn unless user && ticketdiff --git a/app/models/smart_folders/validators/value_validator.rb b/app/models/smart_folders/validators/value_validator.rbindex 68a3ed9..9df6426 100644--- a/app/models/smart_folders/validators/value_validator.rb+++ b/app/models/smart_folders/validators/value_validator.rb@@ -301,7 +301,7 @@ module SmartFoldersrecord = (rule.preloaded_references.dig(model_class.name, value_str) if rule.respond_to?(:preloaded_references) && rule.preloaded_references)- record ||= model_class.find_by(id: value_str)+ record ||= reference_scope(rule, model_class).find_by(id: value_str)unless recordrule.errors.add(:value, :reference_not_found, id: value_str, model: model_class.model_name.human)@@ -332,9 +332,10 @@ module SmartFoldersreturn false unless all_formats_valid# SLOW operation: check the existence of all IDs.- found_count = model_class.where(id: ids).count+ scope = reference_scope(rule, model_class)+ found_count = scope.where(id: ids).countif found_count != ids.length- missing_ids = ids - model_class.where(id: ids).pluck(:id).map(&:to_s)+ missing_ids = ids - scope.where(id: ids).pluck(:id).map(&:to_s)rule.errors.add(:value, :references_not_found, ids: missing_ids.join(', '), model: model_class.model_name.human)return falseend@@ -342,6 +343,21 @@ module SmartFolderstrueend+ # User carries no tenant: any account of the instance passed as creator or assignee,+ # and the rule stored that person's name. Tenant-scoped models are bound by their+ # default scope already. Preloaded records come bound from their only source,+ # AdHocToSmartFolderService#preload_references.+ def reference_scope(rule, model_class)+ return model_class unless tenantless?(model_class)++ organisation = rule.try(:smart_folder_rule_group)&.smart_folder&.organisation || ActsAsTenant.current_tenant+ organisation ? organisation.users : model_class.none+ end++ def tenantless?(model_class)+ model_class <= User+ end+# Checks the format of an ID (UUID or Integer)def valid_id_format?(id_string, model_class, rule)id_type = model_class.columns_hash['id']&.typediff --git a/app/models/time_session.rb b/app/models/time_session.rbindex b97f998..dda3165 100644--- a/app/models/time_session.rb+++ b/app/models/time_session.rb@@ -49,6 +49,15 @@# fk_rails_... (time_session_group_id => time_session_groups.id)#class TimeSession < ApplicationRecord+ # A session's subject is a Ticket OR a Meeting (Gespräche Slice 2), never both —+ # the XOR is enforced by the DB check constraint time_sessions_single_subject and+ # the #at_most_one_subject validation below. touch: keeps the subject's updated_at+ # fresh when its booked time changes (same contract as :ticket).+ # Declared BEFORE acts_as_tenant: the gem checks a foreign id only for associations+ # it already knows, so declared after it, a ticket of another organisation passed.+ belongs_to :ticket, optional: true, touch: true+ belongs_to :meeting, optional: true, touch: true+acts_as_tenant(:organisation)# The three mutually exclusive billing buckets: not in any billing group, in a@@ -149,12 +158,6 @@ class TimeSession < ApplicationRecord# Relationshipsbelongs_to :project- # A session's subject is a Ticket OR a Meeting (Gespräche Slice 2), never both —- # the XOR is enforced by the DB check constraint time_sessions_single_subject and- # the #at_most_one_subject validation below. touch: keeps the subject's updated_at- # fresh when its booked time changes (same contract as :ticket).- belongs_to :ticket, optional: true, touch: true- belongs_to :meeting, optional: true, touch: truebelongs_to :creator, class_name: 'User'belongs_to :organisationbelongs_to :time_session_group, optional: truediff --git a/app/models/view_configuration.rb b/app/models/view_configuration.rbindex ce9d57d..4a1ac32 100644--- a/app/models/view_configuration.rb+++ b/app/models/view_configuration.rb@@ -134,6 +134,7 @@ class ViewConfiguration < ApplicationRecordvalidates :view_type, presence: true, inclusion: { in: %w[tickets notes documents meetings] }validates :user_id, uniqueness: { scope: %i[project_id view_type] }validates :view_mode, inclusion: { in: VIEW_MODES }, allow_nil: true+ validate :kanban_attribute_definition_of_own_project# Ensure required columns are always includedbefore_save :ensure_required_columns@@ -355,6 +356,17 @@ class ViewConfiguration < ApplicationRecordself.class.status_attribute_for(project) || kanban_eligible_attributes.firstend+ # TicketAttributeDefinition carries no tenant (it is scoped through its project), so+ # nothing else checks the id from the request: a foreign one put the values and+ # labels of another project's field on this board.+ def kanban_attribute_definition_of_own_project+ return if kanban_attribute_definition_id.blank?+ return unless will_save_change_to_kanban_attribute_definition_id?+ return if project&.ticket_attribute_definitions&.exists?(kanban_attribute_definition_id)++ errors.add(:kanban_attribute_definition, :invalid)+ end+# Appends custom attribute columns to base when view_type == 'tickets'def self.append_custom_columns(base, project, view_type)if view_type == 'tickets' && project.ticket_attribute_definitions.any?diff --git a/app/services/ad_hoc_to_smart_folder_service.rb b/app/services/ad_hoc_to_smart_folder_service.rbindex 2f8923b..727bbf4 100644--- a/app/services/ad_hoc_to_smart_folder_service.rb+++ b/app/services/ad_hoc_to_smart_folder_service.rb@@ -278,7 +278,7 @@ class AdHocToSmartFolderService.map { |r| r[:value] }.compact.uniqreturn nil if user_ids.empty?- users_by_id = User.where(id: user_ids).index_by { |u| u.id.to_s }+ users_by_id = project.organisation.users.where(id: user_ids).index_by { |u| u.id.to_s }{ 'User' => users_by_id }enddiff --git a/config/locales/models.de.yml b/config/locales/models.de.ymlindex 342b33e..e8c7dab 100644--- a/config/locales/models.de.yml+++ b/config/locales/models.de.yml@@ -330,6 +330,7 @@ de:visible_to_user:required_for_private: "muss für private Beiträge gesetzt sein"not_for_public: "darf für öffentliche Beiträge nicht gesetzt sein"+ not_a_member: "muss Mitglied der Organisation sein"ticket_attribute_definition:invalid_date: "ist kein gültiges Datum (Format JJJJ-MM-TT)"attributes:diff --git a/config/locales/models.en.yml b/config/locales/models.en.ymlindex 22a2348..329309c 100644--- a/config/locales/models.en.yml+++ b/config/locales/models.en.yml@@ -322,6 +322,7 @@ en:visible_to_user:required_for_private: "must be set for private posts"not_for_public: "should not be set for public posts"+ not_a_member: "must be a member of the organisation"ticket_attribute_definition:invalid_date: "is not a valid date (format YYYY-MM-DD)"attributes:diff --git a/spec/jobs/import_users_from_codebase_job_spec.rb b/spec/jobs/import_users_from_codebase_job_spec.rbindex c174440..fde4a15 100644--- a/spec/jobs/import_users_from_codebase_job_spec.rb+++ b/spec/jobs/import_users_from_codebase_job_spec.rb@@ -2,7 +2,7 @@require 'rails_helper'-RSpec.describe ImportUsersFromCodebaseJob, type: :job do+RSpec.describe ImportUsersFromCodebaseJob, :ci_guard, type: :job dolet(:organisation) { create(:organisation) }let(:importing_user) { create(:user, organisation: organisation) }let(:default_role) { create(:role, organisation: organisation, is_default: true) }@@ -166,7 +166,7 @@ RSpec.describe ImportUsersFromCodebaseJob, type: :job doendcontext 'with map action' do- let(:existing_user) { create(:user) }+ let(:existing_user) { create(:user, organisation: organisation) }it 'creates a mapping to the existing user' dofile_id = import_file.id@@ -197,6 +197,21 @@ RSpec.describe ImportUsersFromCodebaseJob, type: :job doexpect(results['failed']).to eq(1)expect(results['mapped']).to eq(0)end++ # The select only offers members, but the id comes from the request. Mapping onto+ # an account of another organisation put that person's name and avatar on imported+ # tickets, posts and time entries here.+ it 'refuses a target user who is not a member of the organisation' do+ foreign_user = create(:user, organisation: create(:organisation))++ expect do+ perform_job(import_file.id, { '101' => "map:#{foreign_user.id}" }, {}, importing_user.id)+ end.not_to change(CodebaseImportMapping, :count)++ results = import_file.reload.metadata['import_results']+ expect(results['failed']).to eq(1)+ expect(results['mapped']).to eq(0)+ endendcontext 'with skip action' do@@ -240,7 +255,7 @@ RSpec.describe ImportUsersFromCodebaseJob, type: :job doendcontext 'with mixed actions' do- let(:existing_user) { create(:user) }+ let(:existing_user) { create(:user, organisation: organisation) }let(:multi_users_xml) dobuild_users_xml([diff --git a/spec/models/smart_folder_rule_spec.rb b/spec/models/smart_folder_rule_spec.rbindex e70c9e4..a04a0fc 100644--- a/spec/models/smart_folder_rule_spec.rb+++ b/spec/models/smart_folder_rule_spec.rb@@ -28,7 +28,7 @@#require 'rails_helper'-RSpec.describe SmartFolderRule, type: :model do+RSpec.describe SmartFolderRule, :ci_guard, type: :model dolet(:organisation) { create(:organisation) }let(:user) { create(:user) }let(:project) { create(:project, organisation: organisation) }@@ -44,6 +44,30 @@ RSpec.describe SmartFolderRule, type: :model doActsAsTenant.current_tenant = nilend+ # User carries no tenant. Before, any account of the instance passed as creator or+ # assignee, the rule stored that person's name, and the error told an existing id from+ # a missing one.+ describe 'user reference of another organisation' do+ def rule_for(field, value, operator: 'equals')+ build(:smart_folder_rule, smart_folder_rule_group: smart_folder_rule_group,+ field: field, operator: operator, value: value)+ end++ it 'accepts a member of the organisation' do+ expect(rule_for('assignee', user.id)).to be_valid+ end++ %w[assignee creator].each do |field|+ it "rejects an account of another organisation as #{field}, like an id that does not exist" do+ foreign_user = create(:user, organisation: create(:organisation))++ rule = rule_for(field, foreign_user.id)+ expect(rule).not_to be_valid+ expect(rule.errors.details[:value]).to include(a_hash_including(error: :reference_not_found))+ end+ end+ end+describe 'field_config' doit 'uses ActionTextFilter for content field' doconfig = SmartFolderRule.field_config['content']diff --git a/spec/models/time_session_spec.rb b/spec/models/time_session_spec.rbindex 7a84286..7707dac 100644--- a/spec/models/time_session_spec.rb+++ b/spec/models/time_session_spec.rb@@ -54,7 +54,7 @@ require 'rails_helper'# Covers the decision points: required fields + DB NOT NULL, numericality > 0# (boundary 0!), billed default, soft-delete default_scope, duration_string parsing# (all branches), billed edit guard, formatting helpers, scopes, tenant isolation.-RSpec.describe TimeSession, type: :model do+RSpec.describe TimeSession, :ci_guard, type: :model dolet(:organisation) { create(:organisation) }let(:project) { create(:project, organisation: organisation) }let(:creator) { create(:user, organisation: organisation) }@@ -75,6 +75,38 @@ RSpec.describe TimeSession, type: :model doit { is_expected.to belong_to(:ticket).optional }it { is_expected.to belong_to(:meeting).optional }it { is_expected.to belong_to(:time_session_group).optional }++ # acts_as_tenant checks foreign ids only for associations declared before its call.+ # Every write path resolves the subject itself today; this keeps the model from+ # taking one of another organisation when a new path forgets to.+ describe 'subject of another organisation' do+ let(:other_organisation) { create(:organisation) }+ let(:other_project) do+ ActsAsTenant.with_tenant(other_organisation) { create(:project, organisation: other_organisation) }+ end++ it 'rejects a ticket of another organisation' do+ foreign_ticket = ActsAsTenant.with_tenant(other_organisation) do+ create(:ticket, project: other_project, organisation: other_organisation,+ creator: create(:user, organisation: other_organisation))+ end++ session = build_session(ticket_id: foreign_ticket.id)+ expect(session).not_to be_valid+ expect(session.errors[:ticket_id]).to be_present+ end++ it 'rejects a meeting of another organisation' do+ foreign_meeting = ActsAsTenant.with_tenant(other_organisation) do+ create(:meeting, project: other_project, organisation: other_organisation,+ creator: create(:user, organisation: other_organisation))+ end++ session = build_session(meeting_id: foreign_meeting.id)+ expect(session).not_to be_valid+ expect(session.errors[:meeting_id]).to be_present+ end+ endend# Gespräche Slice 2: a session's subject is a Ticket OR a Meeting, never both.diff --git a/spec/models/view_configuration_kanban_spec.rb b/spec/models/view_configuration_kanban_spec.rbindex e7ff1dd..9ce362b 100644--- a/spec/models/view_configuration_kanban_spec.rb+++ b/spec/models/view_configuration_kanban_spec.rb@@ -2,7 +2,7 @@require 'rails_helper'-RSpec.describe ViewConfiguration, 'kanban support' do+RSpec.describe ViewConfiguration, 'kanban support', :ci_guard dolet(:organisation) { create(:organisation) }let(:user) { create(:user) }let(:project) { create(:project, organisation: organisation) }@@ -105,5 +105,35 @@ RSpec.describe ViewConfiguration, 'kanban support' doview_config.view_mode = nilexpect(view_config).to be_validend++ # TicketAttributeDefinition carries no tenant, so nothing else stops an id from the+ # request: the board then showed the values and labels of a foreign project's field.+ describe 'kanban_attribute_definition' do+ it "accepts a definition of the view's own project" do+ own = create(:ticket_attribute_definition, :select, project: project, name: 'category')+ view_config.kanban_attribute_definition_id = own.id+ expect(view_config).to be_valid+ end++ it 'rejects a definition of another organisation' do+ other_organisation = create(:organisation)+ foreign = ActsAsTenant.with_tenant(other_organisation) do+ create(:ticket_attribute_definition, :select,+ project: create(:project, organisation: other_organisation), name: 'status')+ end++ view_config.kanban_attribute_definition_id = foreign.id+ expect(view_config).not_to be_valid+ expect(view_config.errors.details[:kanban_attribute_definition]).to include(error: :invalid)+ end++ it 'rejects a definition of another project in the same organisation' do+ other_project = create(:project, organisation: organisation)+ sibling = create(:ticket_attribute_definition, :select, project: other_project, name: 'status')++ view_config.kanban_attribute_definition_id = sibling.id+ expect(view_config).not_to be_valid+ end+ endendenddiff --git a/spec/requests/api/v1/write_endpoints_spec.rb b/spec/requests/api/v1/write_endpoints_spec.rbindex 0d271e1..60816d1 100644--- a/spec/requests/api/v1/write_endpoints_spec.rb+++ b/spec/requests/api/v1/write_endpoints_spec.rb@@ -88,6 +88,24 @@ RSpec.describe 'API V1 Write Endpoints', :ci_guard, type: :request doexpect(body.dig('data', 'visible_to_user_id')).to eq(other_user.id)end+ # The addressee comes from the request. Without a rule it took any account of the+ # instance, and the answer told an existing id (201) from a missing one (422).+ { 'from another organisation' => -> { create(:user, organisation: create(:organisation)).id },+ 'that does not exist' => -> { SecureRandom.uuid } }.each do |label, addressee|+ it "refuses an addressee #{label}, with the same answer" do+ addressee_id = instance_exec(&addressee)++ expect do+ post "/api/v1/tickets/#{ticket.id}/posts",+ params: { post: { body: 'Geheim', is_private: true, visible_to_user_id: addressee_id } },+ headers: auth_headers+ end.not_to(change { ActsAsTenant.with_tenant(organisation) { Post.count } })++ expect(response).to have_http_status(:unprocessable_content)+ expect(JSON.parse(response.body)['error']).to eq('validation_failed')+ end+ end+it 'returns 422 when body is missing' dopost "/api/v1/tickets/#{ticket.id}/posts",params: { post: { body: '' } },diff --git a/spec/requests/organisations/ticket_lookups_spec.rb b/spec/requests/organisations/ticket_lookups_spec.rbindex e4d8a67..c3226c7 100644--- a/spec/requests/organisations/ticket_lookups_spec.rb+++ b/spec/requests/organisations/ticket_lookups_spec.rb@@ -98,7 +98,7 @@ RSpec.describe 'Organisations::TicketLookups', :ci_guard, type: :request doit 'searches the title only, not the text of comments' doActsAsTenant.with_tenant(organisation) docreate(:post, ticket: readable_match, user: user, organisation: organisation,- content: 'Kuendigungsfrist', is_private: true, visible_to_user_id: create(:user).id)+ content: 'Kuendigungsfrist', is_private: true, visible_to_user_id: create(:user, organisation: organisation).id)endexpect(lookup(q: 'Kuendigungsfrist')).to be_emptydiff --git a/spec/services/actors/save_smart_folder_from_filters_spec.rb b/spec/services/actors/save_smart_folder_from_filters_spec.rbindex 2bbe385..2f21ebb 100644--- a/spec/services/actors/save_smart_folder_from_filters_spec.rb+++ b/spec/services/actors/save_smart_folder_from_filters_spec.rb@@ -58,7 +58,7 @@ RSpec.describe Actors::SaveSmartFolderFromFilters doendit 'persists one group per assignee for a multi-OR assignee filter' do- other = create(:user)+ other = create(:user, organisation: organisation)folder = create_from(filter_params: { 'assignee' => [user.id.to_s, other.id.to_s] }).resourceexpect(folder.smart_folder_rule_groups.count).to eq(2)enddiff --git a/spec/services/ad_hoc_to_smart_folder_service_spec.rb b/spec/services/ad_hoc_to_smart_folder_service_spec.rbindex 2b4f887..a3895bc 100644--- a/spec/services/ad_hoc_to_smart_folder_service_spec.rb+++ b/spec/services/ad_hoc_to_smart_folder_service_spec.rb@@ -67,6 +67,15 @@ RSpec.describe AdHocToSmartFolderService doexpect(conversion.preloaded_references['User']).to have_key(user.id.to_s)end+ # The validator trusts this preload, so it holds members of the organisation only;+ # an account of another one is then looked up again and refused.+ it 'preloads no account of another organisation' do+ foreign_user = create(:user, organisation: create(:organisation))+ conversion = convert(filter_params: { 'creator' => [user.id.to_s, foreign_user.id.to_s] })++ expect(conversion.preloaded_references['User'].keys).to contain_exactly(user.id.to_s)+ end+it 'leaves preloaded_references nil when there are no reference rules' doexpect(convert(filter_params: { 'tag' => ['bug'] }).preloaded_references).to be_nilenddiff --git a/spec/services/meetings/list_query_spec.rb b/spec/services/meetings/list_query_spec.rbindex 868c424..a32b94b 100644--- a/spec/services/meetings/list_query_spec.rb+++ b/spec/services/meetings/list_query_spec.rb@@ -137,7 +137,7 @@ RSpec.describe Meetings::ListQuery doit 'does not dissolve a creator equality combined with an exclusion into a different condition' dorecord = meeting('Mine')folder = save_view('creator' => [user.id])- folder.smart_folder_rule_groups.first.smart_folder_rules.create!(field: 'creator', operator: 'not_equals', value: create(:user).id, position: 2)+ folder.smart_folder_rule_groups.first.smart_folder_rules.create!(field: 'creator', operator: 'not_equals', value: create(:user, organisation: organisation).id, position: 2)expect(SmartFolderDissolver.new(folder).call).not_to be_dissolvableexpect(query(smart_folder: folder).pluck(:id)).to eq([record.id])enddiff --git a/spec/services/projects/default_smart_folder_service_spec.rb b/spec/services/projects/default_smart_folder_service_spec.rbindex 2489bb4..f7f2801 100644--- a/spec/services/projects/default_smart_folder_service_spec.rb+++ b/spec/services/projects/default_smart_folder_service_spec.rb@@ -246,6 +246,9 @@ RSpec.describe Projects::DefaultSmartFolderService dobefore doproject.project_permissions.destroy_allorganisation.users.destroy_all+ # "Meine Aufgaben" belongs to the calling member, and with no members left a+ # rule for that user is refused before the public folders ask for one.+ allow(service).to receive(:create_my_tasks)endit 'raises NoSystemUserError with a descriptive message' dodiff --git a/spec/services/smart_folder_round_trip_spec.rb b/spec/services/smart_folder_round_trip_spec.rbindex 9400dd9..62e1306 100644--- a/spec/services/smart_folder_round_trip_spec.rb+++ b/spec/services/smart_folder_round_trip_spec.rb@@ -14,7 +14,7 @@ RSpec.describe 'Smart folder round trip: saved from the bar, read back into thelet(:organisation) { create(:organisation) }let(:admin_role) { create(:admin_role, organisation: organisation) }let(:user) { create(:user) }- let(:other) { create(:user) }+ let(:other) { create(:user, organisation: organisation) }let(:project) { create(:project, organisation: organisation) }before do