1+ /**
2+ * SPDX-FileCopyrightText: (c) 2025 Liferay, Inc. https://liferay.com
3+ * SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
4+ */
5+
6+ package com .liferay .calendar .web .internal .model ;
7+
8+ import com .liferay .calendar .constants .CalendarPortletKeys ;
9+ import com .liferay .portal .kernel .model .Layout ;
10+ import com .liferay .portal .kernel .model .LayoutTypeAccessPolicy ;
11+ import com .liferay .portal .kernel .model .Portlet ;
12+ import com .liferay .portal .kernel .model .impl .DefaultLayoutTypeAccessPolicyImpl ;
13+ import com .liferay .portal .kernel .security .permission .PermissionChecker ;
14+ import com .liferay .portal .kernel .util .StringUtil ;
15+
16+ import org .osgi .service .component .annotations .Component ;
17+
18+ /**
19+ * @author Carolina Barbosa
20+ */
21+ @ Component (
22+ property = "layout.type=" + CalendarPortletKeys .CALENDAR ,
23+ service = LayoutTypeAccessPolicy .class
24+ )
25+ public class CalendarPortletLayoutTypeAccessPolicy
26+ extends DefaultLayoutTypeAccessPolicyImpl {
27+
28+ @ Override
29+ public boolean isAddLayoutAllowed (
30+ PermissionChecker permissionChecker , Layout layout ) {
31+
32+ return false ;
33+ }
34+
35+ @ Override
36+ public boolean isCustomizeLayoutAllowed (
37+ PermissionChecker permissionChecker , Layout layout ) {
38+
39+ return false ;
40+ }
41+
42+ @ Override
43+ public boolean isDeleteLayoutAllowed (
44+ PermissionChecker permissionChecker , Layout layout ) {
45+
46+ return false ;
47+ }
48+
49+ @ Override
50+ public boolean isUpdateLayoutAllowed (
51+ PermissionChecker permissionChecker , Layout layout ) {
52+
53+ return false ;
54+ }
55+
56+ @ Override
57+ protected boolean isAccessGrantedByPortletOnPage (
58+ Layout layout , Portlet portlet ) {
59+
60+ return StringUtil .equalsIgnoreCase (
61+ portlet .getPortletId (), CalendarPortletKeys .CALENDAR );
62+ }
63+
64+ }
0 commit comments