Skip to content

Commit bb75141

Browse files
committed
Display first accessible catalog when default unset
Users were wrongly receiving a permission denied error when no default catalog was set on their account or if the default catalog of the system was one that they did not have access to, or even if there was not default catalog set on the system. This change will show the first available catalog for the user when no default catalog is set based on the catalogs that the user has access to create assets in.
1 parent cf34cad commit bb75141

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/RT/Interface/Web.pm

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4634,8 +4634,11 @@ sub LoadDefaultCatalog {
46344634
# If no catalog, default to the first active catalog
46354635
my $catalogs = RT::Catalogs->new($session{CurrentUser});
46364636
$catalogs->UnLimit;
4637-
my $candidate = $catalogs->First;
4638-
$catalog_obj = $candidate if $candidate;
4637+
while ( my $catalog = $catalogs->Next ) {
4638+
next unless $catalog->CurrentUserHasRight('CreateAsset');
4639+
$catalog_obj = $catalog;
4640+
last;
4641+
}
46394642
RT::Logger->error("No active catalogs.")
46404643
unless $catalog_obj and $catalog_obj->Id;
46414644
}

0 commit comments

Comments
 (0)