Searching and indexing custom Entity in Liferay 7.4 Using Elastic Search

3年前 に Amresh kumar によって更新されました。 New Member 投稿: 20 参加年月日: 12/05/17 最新の投稿
@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 ?

thumbnail
3年前 に Russell Bohl によって更新されました。 Expert 投稿: 308 参加年月日: 13/02/13 最新の投稿

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.

3年前 に Amresh kumar によって更新されました。 New Member 投稿: 20 参加年月日: 12/05/17 最新の投稿

Thanks a lot Russell for your prompt response.

Finally I have implemented the permission and now working fine.