Coverage Report - org.kuali.rice.kim.api.services.IdentityManagementService
 
Classes in this File Line Coverage Branch Coverage Complexity
IdentityManagementService
N/A
N/A
1
 
 1  
 /*
 2  
  * Copyright 2008-2009 The Kuali Foundation
 3  
  *
 4  
  * Licensed under the Educational Community License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  * http://www.opensource.org/licenses/ecl2.php
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  */
 16  
 package org.kuali.rice.kim.api.services;
 17  
 
 18  
 import org.kuali.rice.core.util.AttributeSet;
 19  
 import org.kuali.rice.core.util.jaxb.AttributeSetAdapter;
 20  
 import org.kuali.rice.core.util.jaxb.MapStringStringAdapter;
 21  
 import org.kuali.rice.kim.api.group.Group;
 22  
 import org.kuali.rice.kim.api.identity.Type;
 23  
 import org.kuali.rice.kim.api.identity.affiliation.EntityAffiliationType;
 24  
 import org.kuali.rice.kim.api.identity.principal.Principal;
 25  
 import org.kuali.rice.kim.api.responsibility.Responsibility;
 26  
 import org.kuali.rice.kim.api.responsibility.ResponsibilityAction;
 27  
 import org.kuali.rice.kim.bo.entity.dto.KimEntityDefaultInfo;
 28  
 import org.kuali.rice.kim.bo.entity.dto.KimEntityInfo;
 29  
 import org.kuali.rice.kim.bo.reference.dto.EmploymentStatusInfo;
 30  
 import org.kuali.rice.kim.bo.reference.dto.EmploymentTypeInfo;
 31  
 import org.kuali.rice.kim.bo.reference.dto.ExternalIdentifierTypeInfo;
 32  
 import org.kuali.rice.kim.bo.role.dto.KimPermissionInfo;
 33  
 import org.kuali.rice.kim.bo.role.dto.PermissionAssigneeInfo;
 34  
 import org.kuali.rice.kim.util.KIMWebServiceConstants;
 35  
 
 36  
 import javax.jws.WebMethod;
 37  
 import javax.jws.WebParam;
 38  
 import javax.jws.WebService;
 39  
 import javax.jws.soap.SOAPBinding;
 40  
 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
 41  
 import java.util.List;
 42  
 import java.util.Map;
 43  
 
 44  
 /**
 45  
  * This is the front end for the KIM module.  Clients of KIM should access this service from
 46  
  * their applications.  If KIM is not running on the same machine (VM) as the application
 47  
  * (as would be the case with a standalone Rice server), then this service should be implemented
 48  
  * locally within the application and access the core KIM services
 49  
  * (Authentication/Authorization/Identity/Group) via the service bus.
 50  
  *
 51  
  *  For efficiency, implementations of this interface should add appropriate caching of
 52  
  *  the information retrieved from the core services for load and performance reasons.
 53  
  *
 54  
  *  Most of the methods on this interface are straight pass-thrus to methods on the four core services.
 55  
  *
 56  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 57  
  *
 58  
  */
 59  
 @WebService(name = KIMWebServiceConstants.IdentityManagementService.WEB_SERVICE_NAME, targetNamespace = KIMWebServiceConstants.MODULE_TARGET_NAMESPACE)
 60  
 @SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.LITERAL, parameterStyle = SOAPBinding.ParameterStyle.WRAPPED)
 61  
 public interface IdentityManagementService {
 62  
 
 63  
         // *******************************
 64  
         // IdentityService
 65  
         // *******************************
 66  
 
 67  
         Principal getPrincipal(@WebParam(name = "principalId") String principalId);
 68  
         Principal getPrincipalByPrincipalName(@WebParam(name = "principalName") String principalName);
 69  
 
 70  
         Principal getPrincipalByPrincipalNameAndPassword(
 71  
             @WebParam(name = "principalName") String principalName,
 72  
             @WebParam(name = "password") String password
 73  
     );
 74  
 
 75  
         KimEntityDefaultInfo getEntityDefaultInfo(@WebParam(name = "entityId") String entityId);
 76  
         KimEntityDefaultInfo getEntityDefaultInfoByPrincipalId(@WebParam(name = "principalId") String principalId);
 77  
         KimEntityDefaultInfo getEntityDefaultInfoByPrincipalName(@WebParam(name = "principalName") String principalName);
 78  
 
 79  
         List<? extends KimEntityDefaultInfo> lookupEntityDefaultInfo(
 80  
             @XmlJavaTypeAdapter(value = MapStringStringAdapter.class)
 81  
             @WebParam(name = "searchCriteria") Map<String, String> searchCriteria,
 82  
             @WebParam(name = "unbounded") boolean unbounded
 83  
     );
 84  
 
 85  
         int getMatchingEntityCount(@XmlJavaTypeAdapter(value = MapStringStringAdapter.class)
 86  
                                @WebParam(name = "searchCriteria") Map<String, String> searchCriteria);
 87  
 
 88  
         //KimEntityPrivacyPreferencesInfo getEntityPrivacyPreferences(String entityId);
 89  
 
 90  
         KimEntityInfo getEntityInfo(@WebParam(name = "entityId") String entityId);
 91  
         KimEntityInfo getEntityInfoByPrincipalId(@WebParam(name = "principalId") String principalId);
 92  
         KimEntityInfo getEntityInfoByPrincipalName(@WebParam(name = "principalName") String principalName);
 93  
 
 94  
         List<KimEntityInfo> lookupEntityInfo(
 95  
             @XmlJavaTypeAdapter(value = MapStringStringAdapter.class)
 96  
             @WebParam(name = "searchCriteria") Map<String, String> searchCriteria,
 97  
             @WebParam(name = "unbounded") boolean unbounded
 98  
     );
 99  
 
 100  
         Type getAddressType(@WebParam(name = "code") String code);
 101  
         EntityAffiliationType getAffiliationType(@WebParam(name = "code") String code);
 102  
         Type getCitizenshipStatus(@WebParam(name = "code") String code);
 103  
         Type getEmailType(@WebParam(name = "code") String code);
 104  
         EmploymentStatusInfo getEmploymentStatus(@WebParam(name = "code") String code);
 105  
         EmploymentTypeInfo getEmploymentType(@WebParam(name = "code") String code);
 106  
         Type getEntityNameType(@WebParam(name = "code") String code);
 107  
         Type getEntityType(@WebParam(name = "code") String code);
 108  
         ExternalIdentifierTypeInfo getExternalIdentifierType(@WebParam(name = "code") String code);
 109  
         Type getPhoneType(@WebParam(name = "code") String code);
 110  
 
 111  
         // *******************************
 112  
         // GroupService
 113  
         // *******************************
 114  
 
 115  
         Group getGroup(@WebParam(name = "groupId") String groupId);
 116  
 
 117  
     Group getGroupByName(
 118  
             @WebParam(name = "namespaceCode") String namespaceCode,
 119  
             @WebParam(name = "groupName") String groupName
 120  
     );
 121  
 
 122  
     List<String> getParentGroupIds(@WebParam(name = "groupId") String groupId);
 123  
     List<String> getDirectParentGroupIds(@WebParam(name = "groupId") String groupId);
 124  
 
 125  
     @WebMethod(operationName="getGroupIdsForPrincipal")
 126  
     List<String> getGroupIdsForPrincipal(@WebParam(name = "principalId") String principalId);
 127  
 
 128  
     @WebMethod(operationName="getGroupIdsForPrincipalByNamespace")
 129  
     List<String> getGroupIdsForPrincipal(
 130  
             @WebParam(name = "principalId") String principalId,
 131  
             @WebParam(name = "namespaceCode") String namespaceCode
 132  
     );
 133  
 
 134  
     @WebMethod(operationName="getGroupsForPrincipal")
 135  
     List<? extends Group> getGroupsForPrincipal(@WebParam(name = "principalId") String principalId);
 136  
 
 137  
     @WebMethod(operationName="getGroupsForPrincipalByNamespace")
 138  
     List<? extends Group> getGroupsForPrincipal(
 139  
             @WebParam(name = "principalId") String principalId,
 140  
             @WebParam(name = "namespaceCode") String namespaceCode
 141  
     );
 142  
 
 143  
     List<String> getMemberGroupIds(@WebParam(name = "groupId") String groupId);
 144  
     List<String> getDirectMemberGroupIds(@WebParam(name = "groupId") String groupId);
 145  
 
 146  
     @WebMethod(operationName="isMemberOfGroup")
 147  
         boolean isMemberOfGroup(
 148  
             @WebParam(name = "principalId") String principalId,
 149  
             @WebParam(name = "groupId") String groupId
 150  
     );
 151  
 
 152  
     @WebMethod(operationName="isMemberOfGroupByNamespace")
 153  
         boolean isMemberOfGroup(
 154  
             @WebParam(name = "principalId") String principalId,
 155  
             @WebParam(name = "namespaceCode") String namespaceCode,
 156  
             @WebParam(name = "groupName") String groupName
 157  
     );
 158  
 
 159  
         boolean isGroupMemberOfGroup(
 160  
             @WebParam(name = "potentialMemberGroupId") String potentialMemberGroupId,
 161  
             @WebParam(name = "potentialParentId") String potentialParentId
 162  
     );
 163  
 
 164  
         List<String> getGroupMemberPrincipalIds(@WebParam(name = "groupId") String groupId);
 165  
         List<String> getDirectGroupMemberPrincipalIds(@WebParam(name = "groupId") String groupId);
 166  
 
 167  
     boolean addGroupToGroup(
 168  
             @WebParam(name = "childId") String childId,
 169  
             @WebParam(name = "parentId") String parentId
 170  
     );
 171  
 
 172  
     boolean removeGroupFromGroup(
 173  
             @WebParam(name = "childId") String childId,
 174  
             @WebParam(name = "parentId") String parentId
 175  
     );
 176  
 
 177  
     boolean addPrincipalToGroup(
 178  
             @WebParam(name = "principalId") String principalId,
 179  
             @WebParam(name = "groupId") String groupId
 180  
     );
 181  
 
 182  
     boolean removePrincipalFromGroup(
 183  
             @WebParam(name = "principalId") String principalId,
 184  
             @WebParam(name = "groupId") String groupId
 185  
     );
 186  
 
 187  
     Group createGroup(@WebParam(name = "group") Group group);
 188  
     void removeAllMembers(@WebParam(name = "groupId") String groupId);
 189  
 
 190  
     Group updateGroup(
 191  
             @WebParam(name = "groupId") String groupId,
 192  
             @WebParam(name = "group") Group group
 193  
     );
 194  
 
 195  
         // *******************************
 196  
         // AuthenticationService
 197  
         // *******************************
 198  
     //@WebMethod(exclude=true)
 199  
         //String getAuthenticatedPrincipalName( @WebParam(name="request") HttpServletRequest request);
 200  
 
 201  
         // *******************************
 202  
         // AuthorizationService
 203  
         // *******************************
 204  
 
 205  
     // --------------------
 206  
     // Authorization Checks
 207  
     // --------------------
 208  
 
 209  
     boolean hasPermission(
 210  
             @WebParam(name = "principalId") String principalId,
 211  
             @WebParam(name = "namespaceCode") String namespaceCode,
 212  
             @WebParam(name = "permissionName") String permissionName,
 213  
             @WebParam(name = "permissionDetails") @XmlJavaTypeAdapter(value = AttributeSetAdapter.class) AttributeSet permissionDetails
 214  
     );
 215  
 
 216  
     boolean isAuthorized(
 217  
             @WebParam(name = "principalId") String principalId,
 218  
             @WebParam(name = "namespaceCode") String namespaceCode,
 219  
             @WebParam(name = "permissionName") String permissionName,
 220  
             @WebParam(name = "permissionDetails") @XmlJavaTypeAdapter(value = AttributeSetAdapter.class) AttributeSet permissionDetails,
 221  
             @WebParam(name = "qualification") @XmlJavaTypeAdapter(value = AttributeSetAdapter.class) AttributeSet qualification
 222  
     );
 223  
 
 224  
     boolean hasPermissionByTemplateName(
 225  
             @WebParam(name = "principalId") String principalId,
 226  
             @WebParam(name = "namespaceCode") String namespaceCode,
 227  
             @WebParam(name = "permissionTemplateName") String permissionTemplateName,
 228  
             @WebParam(name = "permissionDetails") @XmlJavaTypeAdapter(value = AttributeSetAdapter.class) AttributeSet permissionDetails
 229  
     );
 230  
 
 231  
     boolean isAuthorizedByTemplateName(
 232  
             @WebParam(name = "principalId") String principalId,
 233  
             @WebParam(name = "namespaceCode") String namespaceCode,
 234  
             @WebParam(name = "permissionTemplateName") String permissionTemplateName,
 235  
             @WebParam(name = "permissionDetails") @XmlJavaTypeAdapter(value = AttributeSetAdapter.class) AttributeSet permissionDetails,
 236  
             @WebParam(name = "qualification") @XmlJavaTypeAdapter(value = AttributeSetAdapter.class) AttributeSet qualification
 237  
     );
 238  
 
 239  
     /**
 240  
      * Returns the matching permission objects for a principal.
 241  
      */
 242  
     List<? extends KimPermissionInfo> getAuthorizedPermissions(
 243  
             @WebParam(name = "principalId") String principalId,
 244  
             @WebParam(name = "namespaceCode") String namespaceCode,
 245  
             @WebParam(name = "permissionName") String permissionName,
 246  
             @WebParam(name = "permissionDetails") @XmlJavaTypeAdapter(value = AttributeSetAdapter.class) AttributeSet permissionDetails,
 247  
             @WebParam(name = "qualification") @XmlJavaTypeAdapter(value = AttributeSetAdapter.class) AttributeSet qualification
 248  
     );
 249  
 
 250  
     List<? extends KimPermissionInfo> getAuthorizedPermissionsByTemplateName(
 251  
             @WebParam(name = "principalId") String principalId,
 252  
             @WebParam(name = "namespaceCode") String namespaceCode,
 253  
             @WebParam(name = "permissionTemplateName") String permissionTemplateName,
 254  
             @WebParam(name = "permissionDetails") @XmlJavaTypeAdapter(value = AttributeSetAdapter.class) AttributeSet permissionDetails,
 255  
             @WebParam(name = "qualification") @XmlJavaTypeAdapter(value = AttributeSetAdapter.class) AttributeSet qualification
 256  
     );
 257  
 
 258  
     List<PermissionAssigneeInfo> getPermissionAssignees(
 259  
             @WebParam(name = "namespaceCode") String namespaceCode,
 260  
             @WebParam(name = "permissionName") String permissionName,
 261  
             @WebParam(name = "permissionDetails") @XmlJavaTypeAdapter(value = AttributeSetAdapter.class) AttributeSet permissionDetails,
 262  
             @WebParam(name = "qualification") @XmlJavaTypeAdapter(value = AttributeSetAdapter.class) AttributeSet qualification
 263  
     );
 264  
 
 265  
     List<PermissionAssigneeInfo> getPermissionAssigneesForTemplateName(
 266  
             @WebParam(name = "namespaceCode") String namespaceCode,
 267  
             @WebParam(name = "permissionTemplateName") String permissionTemplateName,
 268  
             @WebParam(name = "permissionDetails") @XmlJavaTypeAdapter(value = AttributeSetAdapter.class) AttributeSet permissionDetails,
 269  
             @WebParam(name = "qualification") @XmlJavaTypeAdapter(value = AttributeSetAdapter.class) AttributeSet qualification
 270  
     );
 271  
 
 272  
     // ----------------------
 273  
     // Responsibility Methods
 274  
     // ----------------------
 275  
 
 276  
     /**
 277  
      * Get the responsibility object with the given ID.
 278  
      */
 279  
     Responsibility getResponsibility(@WebParam(name = "responsibilityId") String responsibilityId);
 280  
 
 281  
          /**
 282  
           * Return the responsibility object for the given unique combination of namespace,
 283  
           * component and responsibility name.
 284  
           */
 285  
     List<? extends Responsibility> getResponsibilitiesByName(
 286  
             @WebParam(name = "namespaceCode") String namespaceCode,
 287  
             @WebParam(name = "responsibilityName") String responsibilityName
 288  
     );
 289  
 
 290  
     /**
 291  
      * Check whether the principal has the given responsibility within the passed qualifier.
 292  
      */
 293  
     boolean hasResponsibility(
 294  
             @WebParam(name = "principalId") String principalId,
 295  
             @WebParam(name = "namespaceCode") String namespaceCode,
 296  
             @WebParam(name = "responsibilityName") String responsibilityName,
 297  
             @WebParam(name = "qualification") @XmlJavaTypeAdapter(value = AttributeSetAdapter.class) AttributeSet qualification,
 298  
             @WebParam(name = "responsibilityDetails") @XmlJavaTypeAdapter(value = AttributeSetAdapter.class) AttributeSet responsibilityDetails
 299  
     );
 300  
 
 301  
     /**
 302  
      * Check whether the principal has the given responsibility within the passed qualifier.
 303  
      */
 304  
     boolean hasResponsibilityByTemplateName(
 305  
             @WebParam(name = "principalId") String principalId,
 306  
             @WebParam(name = "namespaceCode") String namespaceCode,
 307  
             @WebParam(name = "responsibilityTemplateName") String responsibilityTemplateName,
 308  
             @WebParam(name = "qualification") @XmlJavaTypeAdapter(value = AttributeSetAdapter.class) AttributeSet qualification,
 309  
             @WebParam(name = "responsibilityDetails") @XmlJavaTypeAdapter(value = AttributeSetAdapter.class) AttributeSet responsibilityDetails
 310  
     );
 311  
 
 312  
     List<ResponsibilityAction> getResponsibilityActions(
 313  
             @WebParam(name = "namespaceCode") String namespaceCode,
 314  
             @WebParam(name = "responsibilityName") String responsibilityName,
 315  
             @WebParam(name = "qualification") @XmlJavaTypeAdapter(value = AttributeSetAdapter.class) AttributeSet qualification,
 316  
             @WebParam(name = "responsibilityDetails") @XmlJavaTypeAdapter(value = AttributeSetAdapter.class) AttributeSet responsibilityDetails
 317  
     );
 318  
 
 319  
     List<ResponsibilityAction> getResponsibilityActionsByTemplateName(
 320  
             @WebParam(name = "namespaceCode") String namespaceCode,
 321  
             @WebParam(name = "responsibilityTemplateName") String responsibilityTemplateName,
 322  
             @WebParam(name = "qualification") @XmlJavaTypeAdapter(value = AttributeSetAdapter.class) AttributeSet qualification,
 323  
             @WebParam(name = "responsibilityDetails") @XmlJavaTypeAdapter(value = AttributeSetAdapter.class) AttributeSet responsibilityDetails
 324  
     );
 325  
 
 326  
     /**
 327  
      * Returns true if there are any assigned permissions with the given template.
 328  
      */
 329  
     boolean isPermissionDefinedForTemplateName(
 330  
             @WebParam(name = "namespaceCode") String namespaceCode,
 331  
             @WebParam(name = "permissionTemplateName") String permissionTemplateName,
 332  
             @WebParam(name = "permissionDetails") @XmlJavaTypeAdapter(value = AttributeSetAdapter.class) AttributeSet permissionDetails
 333  
     );
 334  
 
 335  
 
 336  
     // ----------------------
 337  
     // Cache Flush Methods
 338  
     // ----------------------
 339  
 
 340  
     void flushAllCaches();
 341  
     void flushEntityPrincipalCaches();
 342  
         void flushGroupCaches();
 343  
         void flushPermissionCaches();
 344  
         void flushResponsibilityCaches();
 345  
 
 346  
 }