Example usage for com.liferay.portal.kernel.security.membershippolicy OrganizationMembershipPolicyUtil verifyPolicy

List of usage examples for com.liferay.portal.kernel.security.membershippolicy OrganizationMembershipPolicyUtil verifyPolicy

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.security.membershippolicy OrganizationMembershipPolicyUtil verifyPolicy.

Prototype

public static void verifyPolicy(Role role) throws PortalException 

Source Link

Usage

From source file:eu.gerhards.liferay.services.angular.service.impl.AngularOrganizationServiceImpl.java

License:Open Source License

@Override
public Organization updateOrganization(long organizationId, String name, String type, long regionId,
        long countryId, long statusId, String comment, boolean site, long[] addresses, long[] emailAddresses,
        long[] phones, long[] websites, long[] orgLabors) throws PortalException {

    _log.info("Updating organization ... ");

    _log.debug("    ... security check ...");

    PortalPermissionUtil.check(getPermissionChecker(), AngularActionKeys.UPDATE_COMMUNITY);

    _log.debug("    ... saving information ... ");

    User creator = this.getGuestOrUser();

    ServiceContext serviceContext = new ServiceContext();
    boolean indexingEnabled = true;

    if (serviceContext != null) {
        indexingEnabled = serviceContext.isIndexingEnabled();

        serviceContext.setIndexingEnabled(false);
    }//from   ww  w . ja  va  2 s.  co m

    try {

        _log.debug("        ... organization ...");

        serviceContext.setUserId(this.getGuestOrUserId());
        Organization organization = null;
        // Organization organization = organizationLocalService.updateOrganization(creator.getCompanyId(),organizationId,OrganizationConstants.DEFAULT_PARENT_ORGANIZATION_ID ,name, type, regionId, countryId, statusId, comment,false, null, site,serviceContext);

        this.updateOrganizationParts(organization, addresses, emailAddresses, phones, websites, orgLabors);

        if (indexingEnabled) {
            Indexer<Organization> indexer = IndexerRegistryUtil.nullSafeGetIndexer(Organization.class);

            indexer.reindex(organization);
        }

        OrganizationMembershipPolicyUtil.verifyPolicy(organization);

        return organization;

    } finally {
        if (serviceContext != null) {
            serviceContext.setIndexingEnabled(indexingEnabled);
        }
    }
}