Searching and indexing custom Entity in Liferay 7.4 Using Elastic SearchSearching and indexing custom Entity in Liferay 7.4 Using Elastic Searchhttps://liferay.dev/c/message_boards/find_thread?p_l_id=119785333&threadId=1214368022024-03-28T13:45:26Z2024-03-28T13:45:26ZRE: RE: Searching and indexing custom Entity in Liferay 7.4 Using Elastic SearchAmresh kumarhttps://liferay.dev/c/message_boards/find_message?p_l_id=119785333&messageId=1214376602022-06-02T16:18:39Z2022-06-02T16:13:13Z<p>Thanks a lot Russell for your prompt response.</p>
<p>Finally I have implemented the permission and now working fine.</p>
<p> </p>
<p> </p>Amresh kumar2022-06-02T16:13:13ZRE: Searching and indexing custom Entity in Liferay 7.4 Using Elastic SearchRussell Bohlhttps://liferay.dev/c/message_boards/find_message?p_l_id=119785333&messageId=1214372802022-06-02T15:30:14Z2022-06-02T15:30:14Z<p>Hi Amresh, with the new composite indexing framework it is no longer
possible (as far as I know) to set permissions aware to false.</p>
<p>
<a
href="https://help.liferay.com/hc/en-us/articles/360022194411-Indexing-Framework#permissions-aware-searching-and-indexing">Indexing
Introduction in Liferay Help Center</a></p>
<p>However, you can probably get the behavior you want (I am guessing
you want unauthenticated users to be able to search for your entity)
by allowing guests to view the asset.</p>Russell Bohl2022-06-02T15:30:14ZSearching and indexing custom Entity in Liferay 7.4 Using Elastic SearchAmresh kumarhttps://liferay.dev/c/message_boards/find_message?p_l_id=119785333&messageId=1214368012022-06-02T16:34:24Z2022-06-02T05:07:48Z<pre>
<code class="language-java">@Component(immediate = true)
public class EmployeeEntryModelResourcePermissionRegistrar {
@Activate
public void activate(BundleContext bundleContext) {
Dictionary<String, Object> properties = new HashMapDictionary<>();
properties.put("model.class.name", Employee.class.getName());
_serviceRegistration = bundleContext.registerService(
ModelResourcePermission.class,
ModelResourcePermissionFactory.create(
Employee.class, Employee::getEmployeeId,
_empoloyeeLocalService::getEmployee, _portletResourcePermission,
(modelResourcePermission, consumer) -> {
consumer.accept(
new StagedModelPermissionLogic<>(
_stagingPermission, "com_test_TestDemoPortlet",
Employee::getEmployeeId));
consumer.accept( new WorkflowedModelPermissionLogic<>( _workflowPermission,
modelResourcePermission, _groupLocalService, Employee::getEmployeeId));
}),properties);
}
@Deactivate
public void deactivate() {
_serviceRegistration.unregister();
}@Reference
private EmployeeLocalService _empoloyeeLocalService;
@Reference(target = "(resource.name=" + "com.emp.service.employee" + ")")
private PortletResourcePermission _portletResourcePermission;
private ServiceRegistration<ModelResourcePermission> _serviceRegistration;
@Reference
private StagingPermission _stagingPermission;
@Reference
private WorkflowPermission _workflowPermission;
@Reference
private GroupLocalService _groupLocalService;</code></pre>
<p>Hi,</p>
<p>I have developed the Indexer by extending <strong>BaseIndexer and
</strong>there is an option to disabled the permission check </p>
<p>setPermissionAware(<b>false</b>); is working absolutly fine.</p>
<p>Try to use the newer approach as below for indexing
, <strong>setPermissionAware(true/false)</strong> is not longer necessary.</p>
<p>
<strong>How to disabled permission in newer approach any idea ?</strong>