Example usage for com.liferay.portal.kernel.service ResourcePermissionServiceUtil setIndividualResourcePermissions

List of usage examples for com.liferay.portal.kernel.service ResourcePermissionServiceUtil setIndividualResourcePermissions

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.service ResourcePermissionServiceUtil setIndividualResourcePermissions.

Prototype

public static void setIndividualResourcePermissions(long groupId, long companyId, String name, String primKey,
        long roleId, String[] actionIds) throws com.liferay.portal.kernel.exception.PortalException 

Source Link

Document

Updates the role's permissions at the scope, setting the actions that can be performed on resources of the type.

Usage

From source file:com.liferay.exportimport.test.LayoutSetPrototypePropagationTest.java

License:Open Source License

@Ignore
@Test//  w ww  .j  ava  2  s.  co  m
public void testLayoutPermissionPropagationWithLinkEnabled() throws Exception {

    setLinkEnabled(true);

    Role role = RoleLocalServiceUtil.getRole(TestPropsValues.getCompanyId(), RoleConstants.POWER_USER);

    ResourcePermissionServiceUtil.setIndividualResourcePermissions(prototypeLayout.getGroupId(),
            prototypeLayout.getCompanyId(), Layout.class.getName(),
            String.valueOf(prototypeLayout.getPrimaryKey()), role.getRoleId(),
            new String[] { ActionKeys.CUSTOMIZE });

    prototypeLayout = updateModifiedDate(prototypeLayout, new Date(System.currentTimeMillis() + Time.MINUTE));

    CacheUtil.clearCache(prototypeLayout.getCompanyId());

    propagateChanges(group);

    Assert.assertTrue(ResourcePermissionLocalServiceUtil.hasResourcePermission(layout.getCompanyId(),
            Layout.class.getName(), ResourceConstants.SCOPE_INDIVIDUAL, String.valueOf(layout.getPrimaryKey()),
            role.getRoleId(), ActionKeys.CUSTOMIZE));
}