Skip to content

Commit

Permalink
Merge branch '5.0/default-catalog-on-asset-create' into 5.0-trunk
Browse files Browse the repository at this point in the history
  • Loading branch information
cbrandtbuffalo committed Mar 25, 2024
2 parents 783c845 + bdbdf0c commit f1fdeb6
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions share/html/Asset/Create.html
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit f1fdeb6

Please sign in to comment.