All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.rapidclipse.framework.security.authorization.PermissionProvider Maven / Gradle / Ivy

There is a newer version: 14.0.0
Show newest version
/*
 * Copyright (C) 2013-2023 by XDEV Software, All Rights Reserved.
 *
 * This file is part of the RapidClipse Application Platform (RAP).
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see .
 *
 * SPDX-License-Identifier: AGPL-3.0-or-later
 *
 * Contributors:
 *     XDEV Software - initial API and implementation
 */
package com.rapidclipse.framework.security.authorization;

/**
 * Function type that provides {@link Permission} instances.
 * For details, see {@link #providePermission(Resource, Integer)}.
 *
 * @author XDEV Software (TM)
 */
@FunctionalInterface
public interface PermissionProvider
{
	/**
	 * Provides a suitable {@link Permission} instance for the passed {@link Resource} instance and
	 * factor value. Providing means to either return a fitting instance or create a new one.
	 *
	 * @param resource
	 *            the {@link Resource} instance to be associated.
	 * @param factor
	 *            the factor of the access to the passed {@link Resource} instance.
	 * @return a {@link Permission} instance satisfiying the specified values.
	 */
	public Permission providePermission(Resource resource, Integer factor);
	
	/**
	 * Provides a permission for the passed {@link Resource} instance and a factor of 0.
	 *
	 * @param resource
	 *            the {@link Resource} instance to be associated.
	 * @return a {@link Permission} instance associated with the passed {@link Resource} instance.
	 * @see #providePermission(Resource, Integer)
	 */
	public default Permission providePermission(final Resource resource)
	{
		return this.providePermission(resource, 0);
	}
	
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy