001/**
002 * Copyright 2005-2016 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.kuali.rice.kim.framework.permission;
017
018import org.kuali.rice.core.api.exception.RiceIllegalArgumentException;
019import org.kuali.rice.core.api.util.jaxb.MapStringStringAdapter;
020import org.kuali.rice.kim.api.KimConstants;
021import org.kuali.rice.kim.api.permission.Permission;
022import org.kuali.rice.kim.framework.type.KimTypeService;
023
024import javax.jws.WebMethod;
025import javax.jws.WebParam;
026import javax.jws.WebResult;
027import javax.jws.WebService;
028import javax.jws.soap.SOAPBinding;
029import javax.xml.bind.annotation.XmlElement;
030import javax.xml.bind.annotation.XmlElementWrapper;
031import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
032import java.util.List;
033import java.util.Map;
034
035
036/**
037 * A {@link KimTypeService} with specific methods for Permissions.
038 */
039@WebService(name = "permissionTypeService", targetNamespace = KimConstants.Namespaces.KIM_NAMESPACE_2_0)
040@SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.LITERAL, parameterStyle = SOAPBinding.ParameterStyle.WRAPPED)
041public interface PermissionTypeService extends KimTypeService {
042
043    /**
044     * Gets whether a permission assignment with the given details is applicable for the given request details.
045     * 
046     * For example, the details for a permission (say edit) could be as follows:
047     *   component = Account
048     *   field = incomeStreamAccountNumber
049     *   
050     * The Account component is known to belong to the KFS-COA namespace.  If this service is requested...
051     * component = Account, field = All  
052     *
053     * @param requestedDetails the requested details.  cannot be null.
054     * @param permissions the list of permission to check for matches. cannot be null.
055     * @return an immutable list of matched permissions.  will not return null.
056     * @throws IllegalArgumentException if the requestedDetails or permissions is null.
057     */
058    @WebMethod(operationName="getMatchingPermissions")
059    @XmlElementWrapper(name = "permissions", required = true)
060    @XmlElement(name = "permission", required = false)
061    @WebResult(name = "permissions")
062    List<Permission> getMatchingPermissions(@WebParam(name = "requestedDetails")
063                                            @XmlJavaTypeAdapter(value = MapStringStringAdapter.class)
064                                            Map<String, String> requestedDetails,
065                                            @WebParam(name = "permissions")
066                                            List<Permission> permissions) throws RiceIllegalArgumentException;
067
068}