Merge pull request #8782 from andrej-scinote/aj_SCI_12237

Fix global search [SCI-12237]
This commit is contained in:
Martin Artnik 2025-08-13 09:50:51 +02:00 committed by GitHub
commit dfec602322
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 4 additions and 5 deletions

View file

@ -5,7 +5,7 @@ class LabelTemplatesController < ApplicationController
include TeamsHelper
before_action :check_feature_enabled, except: %i(index zpl_preview list)
before_action :load_label_templates, only: %i(index datatable list)
before_action :load_label_templates, only: %i(index list)
before_action :load_label_template, only: %i(show set_default update template_tags)
before_action :check_view_permissions, except: %i(create duplicate set_default delete update)
before_action :check_manage_permissions, only: %i(create duplicate set_default delete update)

View file

@ -23,7 +23,7 @@ class LabelTemplate < ApplicationRecord
scope :predefined, -> { where(predefined: true) }
def self.readable_by_user(user, teams)
where(team: teams.with_granted_permissions(user, TeamPermissions::LABEL_TEMPLATES_READ, teams))
where(team: Team.with_granted_permissions(user, TeamPermissions::LABEL_TEMPLATES_READ, teams))
end
def self.enabled?

View file

@ -35,7 +35,7 @@ class ProjectFolder < ApplicationRecord
scope :top_level, -> { where(parent_folder: nil) }
def self.readable_by_user(user, teams)
joins(team: :users)
joins(team: :user_assignments)
.where(teams: { user_assignments: { user: user } })
.where(team: teams)
end

View file

@ -54,8 +54,7 @@ class Result < ApplicationRecord
new_query = joins(:my_module)
.where(
my_modules: {
id: MyModule.with_granted_permissions(user, MyModulePermissions::READ)
.where(user_assignments: { team: teams }).select(:id)
id: MyModule.with_granted_permissions(user, MyModulePermissions::READ, teams).select(:id)
}
)