Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
Searching and indexing custom Entity in Liferay 7.4 Using Elastic Search
@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;
Hi,
I have developed the Indexer by extending BaseIndexer and there is an option to disabled the permission check
setPermissionAware(false); is working absolutly fine.
Try to use the newer approach as below for indexing , setPermissionAware(true/false) is not longer necessary.
How to disabled permission in newer approach any idea ?
Hi Amresh, with the new composite indexing framework it is no longer possible (as far as I know) to set permissions aware to false.
Indexing Introduction in Liferay Help Center
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.
Thanks a lot Russell for your prompt response.
Finally I have implemented the permission and now working fine.
Powered by Liferay™