Issue
- We want to hide the above-mentioned option from the Documents and media because we don't want our users to be able to add videos, can we do it somehow?
Environment
- Liferay DXP 7.4+
Resolution
- It is not possible to hide the external video shortcut for regular users with the current configuration out of the box.
NOTE: The following resolution requires customization and should only be implemented at the discretion of your team. Liferay Support will not be able to assist with designing or implementing customizations.
-
If you want to hide this option, we recommend implementing the
DLFileEntryTypeVisibilityController
. This approach will allow you to control and manage the visibility of the external video shortcut more effectively. Something similar to https://github.com/liferay/liferay-portal/blob/e01988960ddfdb5a9948a603c7921babfcb[…]y/controller/GoogleDocsDLFileEntryTypeVisibilityController.java but in the isVisible method return false.
/**
* SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com (https://liferay.com/)
* SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
*/
package com.liferay.document.library.google.docs.internal.visibility.controller;
import com.liferay.document.library.google.docs.internal.util.constants.GoogleDocsConstants;
import com.liferay.document.library.google.drive.configuration.DLGoogleDriveCompanyConfiguration;
import com.liferay.document.library.kernel.model.DLFileEntryType;
import com.liferay.document.library.visibility.controller.DLFileEntryTypeVisibilityController;
import com.liferay.portal.configuration.module.configuration.ConfigurationProvider;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.module.configuration.ConfigurationException;
import com.liferay.portal.kernel.util.Validator;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;
@Component(
property = "dl.file.entry.type.key=DL_VIDEO_EXTERNAL_SHORTCUT",
service = DLFileEntryTypeVisibilityController.class
)
public class DLVideoShorcoutDLFileEntryTypeVisibilityController
implements DLFileEntryTypeVisibilityController {
@Override
public boolean isVisible(long userId, DLFileEntryType dlFileEntryType) {
return false;
}
private static final Log _log = LogFactoryUtil.getLog(
GoogleDocsDLFileEntryTypeVisibilityController.class);
@Reference
private ConfigurationProvider _configurationProvider;
}