private long _getScopeGroupId(Layout layout, String portletId) throws PortalException { PortletPreferences portletSetup = PortletPreferencesFactoryUtil.getStrictLayoutPortletSetup( layout, portletId); String scopeType = GetterUtil.getString( portletSetup.getValue("lfrScopeType", null)); if (Validator.isNull(scopeType)) { return layout.getGroupId(); } if (scopeType.equals("company")) { Group companyGroup = GroupLocalServiceUtil.getCompanyGroup( layout.getCompanyId()); return companyGroup.getGroupId(); } String scopeLayoutUuid = GetterUtil.getString( portletSetup.getValue("lfrScopeLayoutUuid", null)); Layout scopeLayout = LayoutLocalServiceUtil.getLayoutByUuidAndGroupId( scopeLayoutUuid, layout.getGroupId(), layout.isPrivateLayout()); Group scopeGroup = scopeLayout.getScopeGroup(); return scopeGroup.getGroupId(); }