diff --git a/share/html/Asset/Create.html b/share/html/Asset/Create.html index 5042609cf59..db69fd3c311 100644 --- a/share/html/Asset/Create.html +++ b/share/html/Asset/Create.html @@ -110,6 +110,19 @@ my $asset = RT::Asset->new( $session{CurrentUser} ); my $catalog = LoadDefaultCatalog( $Catalog || '' ); +if ( !$Catalog && ( !$catalog->id || !$catalog->CurrentUserHasRight('CreateAsset') ) ) { + my $cache_key = SetObjectSessionCache( + ObjectType => 'Catalog', + CheckRight => 'CreateAsset', + CacheNeedsUpdate => RT::Catalog->CacheNeedsUpdate, + ShowAll => 0, + ); + + if ( $session{$cache_key}{objects}[0] ) { + $catalog->Load( $session{$cache_key}{objects}[0]->{Id} ); + } +} + Abort(loc("Unable to find catalog '[_1]'", $Catalog)) unless $catalog->id;