diff --git a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-actions/publish.action.ts b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-actions/publish.action.ts index 1175fd3361..845f47e73d 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-actions/publish.action.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-actions/publish.action.ts @@ -8,6 +8,7 @@ import { UmbVariantId } from '@umbraco-cms/backoffice/variant'; import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api'; import { UMB_MODAL_MANAGER_CONTEXT } from '@umbraco-cms/backoffice/modal'; import { UMB_ACTION_EVENT_CONTEXT } from '@umbraco-cms/backoffice/action'; +import { UMB_CURRENT_USER_CONTEXT } from '@umbraco-cms/backoffice/current-user'; export class UmbPublishDocumentEntityAction extends UmbEntityActionBase { constructor(host: UmbControllerHost, args: UmbEntityActionArgs) { @@ -25,8 +26,16 @@ export class UmbPublishDocumentEntityAction extends UmbEntityActionBase { if (!documentData) throw new Error('The document was not found'); - const context = await this.getContext(UMB_APP_LANGUAGE_CONTEXT); - const appCulture = context.getAppCulture(); + const appLanguageContext = await this.getContext(UMB_APP_LANGUAGE_CONTEXT); + const appCulture = appLanguageContext.getAppCulture(); + + const currentUserContext = await this.getContext(UMB_CURRENT_USER_CONTEXT); + const currentUserAllowedLanguages = currentUserContext.getLanguages(); + const currentUserHasAccessToAllLanguages = currentUserContext.getHasAccessToAllLanguages(); + + if (currentUserAllowedLanguages === undefined) throw new Error('The current user languages are missing'); + if (currentUserHasAccessToAllLanguages === undefined) + throw new Error('The current user access to all languages is missing'); const options: Array = documentData.variants.map( (variant) => ({ @@ -76,6 +85,11 @@ export class UmbPublishDocumentEntityAction extends UmbEntityActionBase { .open(this, UMB_DOCUMENT_PUBLISH_MODAL, { data: { options, + pickableFilter: (option) => { + if (!option.culture) return false; + if (currentUserHasAccessToAllLanguages) return true; + return currentUserAllowedLanguages.includes(option.culture); + }, }, value: { selection }, })