
org.xlcloud.console.entitlements.EntitlementDictionary Maven / Gradle / Ivy
The newest version!
/*
* Copyright 2012 AMG.lab, a Bull Group Company
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.xlcloud.console.entitlements;
import org.xlcloud.console.context.EntitlementEngine;
import org.xlcloud.console.context.IdentityContext;
import org.xlcloud.console.entitlements.scope.predicates.EntitlementDictionaryPredicate;
import org.xlcloud.service.AccessToken;
import org.xlcloud.service.Group;
import org.xlcloud.service.User;
/**
* Representation of the entitlement dictionary
* @author "Konrad Król", AMG.net
*/
public interface EntitlementDictionary {
/**
* @return id of the entitlement
*/
public Long getId();
/**
* Sets the id of the entitlement
* @param id id of the entitlement
*/
public void setId(Long id);
/**
* @return description of the entitlement
*/
public String getDescription();
/**
* Sets the description of the entitlement
* @param description of the entitlement
*/
public void setDescription(String description);
/**
* Indicates whether this entitlement can be granted by user identified by identityContext.
* User can not give higher entitlement than he possesses.
* It also verifies if this entitlement matches to the specific subject (e.g. user or group).
* Verification is made using provided predicate.
* @param entitlementEngine entitlement engine
* @param identityContext identity context of the current user
* @param predicate predicate which indicates whether entitlement can be applied to specific subject
* @return {@code true} if the user identified by the identityContext
* is able to grant this entitlement
* to the subject described by the predicate.
* It returns {@code false} otherwise.
*/
public boolean availableFor(EntitlementEngine entitlementEngine, IdentityContext identityContext, EntitlementDictionaryPredicate predicate);
/**
* Inidicates whether this entitlement is possessed by specified user.
* @param user user
* @param entitlementEngine entitlement engine
* @return {@code true} when user possesses this entitlement, {@code false} otherwise
*/
public boolean isOwnedBy(User user, EntitlementEngine entitlementEngine);
/**
* Inidicates whether this entitlement is possessed by specified group.
* @param group group
* @param entitlementEngine entitlement engine
* @return {@code true} when group possesses this entitlement, {@code false} otherwise
*/
public boolean isOwnedBy(Group group, EntitlementEngine entitlementEngine);
/**
* Inidicates whether this entitlement is possessed by specified accessToken.
* @param user user
* @param entitlementEngine entitlement engine
* @return {@code true} when this entitlement is assigned to the accessToken, {@code false} otherwise
*/
public boolean isOwnedBy(AccessToken accessToken, User accessTokenUser, EntitlementEngine entitlementEngine);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy