/**
 * Copyright (c) 2000-2017 Liferay, Inc. All rights reserved.
 *
 * The contents of this file are subject to the terms of the Liferay Enterprise
 * pSubscription License ("License"). You may not use this file except in
 * compliance with the License. You can obtain a copy of the License by
 * contacting Liferay, Inc. See the License for the specific language governing
 * permissions and limitations under the License, including but not limited to
 * distribution rights of the Software.
 *
 *
 *
 */

package com.liferay.portal.security.auth;

import com.liferay.portal.kernel.security.pacl.permission.PortalRuntimePermission;

import java.util.Set;

/**
 * @author Tomas Polesovsky
 * @author Raymond Augé
 */
public class InterruptedPortletRequestWhitelistUtil {

	public static PortletRequestWhitelist
		getInterruptedPortletRequestWhitelist() {

		PortalRuntimePermission.checkGetBeanProperty(
			PortletRequestWhitelist.class);

		return _interruptedPortletRequestWhitelist;
	}

	public static Set<String> getPortletInvocationWhitelist() {
		return getInterruptedPortletRequestWhitelist().
			getPortletInvocationWhitelist();
	}

	public static Set<String> getPortletInvocationWhitelistActions() {
		return getInterruptedPortletRequestWhitelist().
			getPortletInvocationWhitelistActions();
	}

	public static boolean isPortletInvocationWhitelisted(
		long companyId, String portletId, String strutsAction) {

		return getInterruptedPortletRequestWhitelist().
			isPortletInvocationWhitelisted(companyId, portletId, strutsAction);
	}

	public static Set<String> resetPortletInvocationWhitelist() {
		return getInterruptedPortletRequestWhitelist().
			resetPortletInvocationWhitelist();
	}

	public static Set<String> resetPortletInvocationWhitelistActions() {
		return getInterruptedPortletRequestWhitelist().
			resetPortletInvocationWhitelistActions();
	}

	public void setInterruptedPortletRequestWhitelist(
		PortletRequestWhitelist whitelist) {

		PortalRuntimePermission.checkSetBeanProperty(getClass());

		_interruptedPortletRequestWhitelist = whitelist;
	}

	private static PortletRequestWhitelist _interruptedPortletRequestWhitelist;

}