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