From 11bbdd5cbba0bc6afe386d619be24a1e625a9678 Mon Sep 17 00:00:00 2001 From: Tomas Hermanek Date: Mon, 29 Jun 2026 13:58:09 +0000 Subject: [PATCH 1/3] add #84735 scope podcast/asset pickers by ext system for cross-licence attach PodcastEpisodeNewDialog passes the asset's ext system to PodcastRemoteAutocomplete; sibling asset picker offers all readable licences of the ext system (useReadableLicencesByExtSystem). --- src/composables/system/currentExtSystem.ts | 27 ++++++++++++++++++- .../podcast/PodcastEpisodeNewDialog.vue | 20 +++++++++++++- .../detail/components/slots/AssetSibling.vue | 7 ++--- 3 files changed, 49 insertions(+), 5 deletions(-) diff --git a/src/composables/system/currentExtSystem.ts b/src/composables/system/currentExtSystem.ts index 49dce06a..9db3b2a6 100644 --- a/src/composables/system/currentExtSystem.ts +++ b/src/composables/system/currentExtSystem.ts @@ -6,6 +6,7 @@ import { useAssetDetailStore } from '@/stores/coreDam/assetDetailStore' import { type DamCurrentUserDto, type DocId, + type IntegerId, isDocId, isNull, isString, @@ -13,7 +14,7 @@ import { useDamConfigStore, } from '@anzusystems/common-admin' import { storeToRefs } from 'pinia' -import { readonly, ref } from 'vue' +import { computed, readonly, ref, toValue, type MaybeRefOrGetter } from 'vue' const currentExtSystemId = ref(0) @@ -89,3 +90,27 @@ export function useCurrentAssetLicence() { currentAssetLicenceId: readonly(currentAssetLicenceId), } } + +/** + * Returns the IDs of all asset licences the current user may read for a given ext system. + * Used to build the `selectLicences` list for AAssetSelect in cross-licence contexts + * (e.g. sibling pairing, episode asset selection) so that assets from TTS or other + * licences within the same ext system are visible without triggering a 403 from + * CollectionListAwareVoter (which rejects any licence the user cannot read). + */ +export function useReadableLicencesByExtSystem(extSystemId: MaybeRefOrGetter) { + const { useCurrentUser } = useAuth() + const { currentUser } = useCurrentUser(SYSTEM_DAM) + + const licenceIds = computed(() => { + if (!currentUser.value) return [] + const id = toValue(extSystemId) + // resolvedAssetLicences = direct + licence-group grants, matching the backend LicenceVoterTrait; + // assetLicencesDto would miss group-granted licences and under-offer assets the user may actually read. + return currentUser.value.resolvedAssetLicences + .filter((licence) => licence.extSystem === id) + .map((licence) => licence.id) + }) + + return { licenceIds } +} diff --git a/src/views/coreDam/asset/detail/components/podcast/PodcastEpisodeNewDialog.vue b/src/views/coreDam/asset/detail/components/podcast/PodcastEpisodeNewDialog.vue index b0bba894..ee4fd703 100644 --- a/src/views/coreDam/asset/detail/components/podcast/PodcastEpisodeNewDialog.vue +++ b/src/views/coreDam/asset/detail/components/podcast/PodcastEpisodeNewDialog.vue @@ -1,6 +1,6 @@