Example usage for com.liferay.portal.kernel.security.permission.resource WorkflowedModelPermissionLogic WorkflowedModelPermissionLogic

List of usage examples for com.liferay.portal.kernel.security.permission.resource WorkflowedModelPermissionLogic WorkflowedModelPermissionLogic

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.security.permission.resource WorkflowedModelPermissionLogic WorkflowedModelPermissionLogic.

Prototype

public WorkflowedModelPermissionLogic(WorkflowPermission workflowPermission,
            ModelResourcePermission<T> modelResourcePermission, GroupLocalService groupLocalService,
            ToLongFunction<T> primKeyToLongFunction) 

Source Link

Usage

From source file:com.liferay.docs.guestbook.internal.security.permission.resource.GuestbookEntryModelResourcePermissionRegistrar.java

License:Open Source License

@Activate
public void activate(BundleContext bundleContext) {
    Dictionary<String, Object> properties = new HashMapDictionary<>();

    properties.put("model.class.name", GuestbookEntry.class.getName());

    _serviceRegistration = bundleContext.registerService(ModelResourcePermission.class,
            ModelResourcePermissionFactory.create(GuestbookEntry.class, GuestbookEntry::getEntryId,
                    _guestbookEntryLocalService::getGuestbookEntry, _portletResourcePermission,
                    (modelResourcePermission, consumer) -> {
                        consumer.accept(new StagedModelPermissionLogic<>(_stagingPermission,
                                GuestbookPortletKeys.GUESTBOOK, GuestbookEntry::getEntryId));
                        consumer.accept(new WorkflowedModelPermissionLogic<>(_workflowPermission,
                                modelResourcePermission, _groupLocalService, GuestbookEntry::getEntryId));
                    }),//w  ww  .  j  a  va2  s .  c  om
            properties);
}

From source file:com.liferay.docs.guestbook.internal.security.permission.resource.GuestbookModelResourcePermissionRegistrar.java

License:Open Source License

@Activate
public void activate(BundleContext bundleContext) {
    Dictionary<String, Object> properties = new HashMapDictionary<>();

    properties.put("model.class.name", Guestbook.class.getName());

    _serviceRegistration = bundleContext.registerService(ModelResourcePermission.class,
            ModelResourcePermissionFactory.create(Guestbook.class, Guestbook::getGuestbookId,
                    _guestbookLocalService::getGuestbook, _portletResourcePermission,
                    (modelResourcePermission, consumer) -> {
                        consumer.accept(new StagedModelPermissionLogic<>(_stagingPermission,
                                GuestbookPortletKeys.GUESTBOOK, Guestbook::getGuestbookId));
                        consumer.accept(new WorkflowedModelPermissionLogic<>(_workflowPermission,
                                modelResourcePermission, _groupLocalService, Guestbook::getGuestbookId));
                    }),// ww w.  j  a v  a  2s. c om
            properties);
}