Coverage Report - org.kuali.rice.kim.api.role.RoleService
 
Classes in this File Line Coverage Branch Coverage Complexity
RoleService
N/A
N/A
1
 
 1  
 /*
 2  
  * Copyright 2006-2011 The Kuali Foundation
 3  
  * Licensed under the Educational Community License, Version 2.0 (the "License");
 4  
  * you may not use this file except in compliance with the License.
 5  
  * You may obtain a copy of the License at
 6  
  *
 7  
  * http://www.opensource.org/licenses/ecl2.php
 8  
  *
 9  
  * Unless required by applicable law or agreed to in writing, software
 10  
  * distributed under the License is distributed on an "AS IS" BASIS,
 11  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 12  
  * See the License for the specific language governing permissions and
 13  
  * limitations under the License.
 14  
  */
 15  
 
 16  
 package org.kuali.rice.kim.api.role;
 17  
 
 18  
 import org.kuali.rice.core.util.jaxb.MapStringStringAdapter;
 19  
 import org.kuali.rice.kim.api.KimConstants;
 20  
 import org.kuali.rice.kim.api.common.delegate.DelegateMember;
 21  
 import org.kuali.rice.kim.api.common.delegate.DelegateType;
 22  
 
 23  
 import javax.jws.WebMethod;
 24  
 import javax.jws.WebParam;
 25  
 import javax.jws.WebResult;
 26  
 import javax.jws.WebService;
 27  
 import javax.jws.soap.SOAPBinding;
 28  
 import javax.xml.bind.annotation.XmlElement;
 29  
 import javax.xml.bind.annotation.XmlElementWrapper;
 30  
 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
 31  
 import java.util.Collection;
 32  
 import java.util.List;
 33  
 import java.util.Map;
 34  
 
 35  
 /**
 36  
  *
 37  
  * This service provides operations for querying role and role qualification
 38  
  * data.
 39  
  *
 40  
  * <p>A role is where permissions and responsibilities are granted.  Roles have
 41  
  * a membership consisting of principals, groups or even other roles.  By
 42  
  * being assigned as members of a role, the associated principals will be
 43  
  * granted all permissions and responsibilities that have been granted to the
 44  
  * role.
 45  
  *
 46  
  * <p>Each membership assignment on the role can have a qualification which
 47  
  * defines extra information about that particular member of the role.  For
 48  
  * example, one may have the role of "Dean" but that can be further qualified
 49  
  * by the school they are the dean of, such as "Dean of Computer Science".
 50  
  * Authorization checks that are then done in the permission service can pass
 51  
  * qualifiers as part of the operation if they want to restrict the subset of
 52  
  * the role against which the check is made.
 53  
  *
 54  
  * <p>This service provides read-only operations.  For write operations, see
 55  
  * {@link RoleUpdateService}.
 56  
  *
 57  
  * @see RoleUpdateService
 58  
  * @see org.kuali.rice.kim.service.PermissionService
 59  
  *
 60  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 61  
  *
 62  
  */
 63  
 @WebService(name = "RoleService", targetNamespace = KimConstants.Namespaces.KIM_NAMESPACE_2_0 )
 64  
 @SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.LITERAL, parameterStyle = SOAPBinding.ParameterStyle.WRAPPED)
 65  
 public interface RoleService {
 66  
     // --------------------
 67  
     // Role Data
 68  
     // --------------------
 69  
 
 70  
         /**
 71  
          * Get the KIM Role object with the given ID.
 72  
          *
 73  
          * If the roleId is blank, this method returns <code>null</code>.
 74  
          */
 75  
     @WebMethod(operationName = "getRole")
 76  
     @WebResult(name = "role")
 77  
     Role getRole(@WebParam(name = "roleId") String roleId);
 78  
 
 79  
         /**
 80  
          * Get the KIM Role objects for the role IDs in the given List.
 81  
          */
 82  
     @WebMethod(operationName = "getRoles")
 83  
     @XmlElementWrapper(name = "roles", required = true)
 84  
     @XmlElement(name = "role", required = false)
 85  
     @WebResult(name = "roles")
 86  
         List<Role> getRoles( @WebParam(name="roleIds") List<String> roleIds );
 87  
 
 88  
         /** Get the KIM Role object with the unique combination of namespace, component,
 89  
          * and role name.
 90  
          *
 91  
          * If any parameter is blank, this method returns <code>null</code>.
 92  
          */
 93  
     @WebMethod(operationName = "getRoleByName")
 94  
     @WebResult(name = "role")
 95  
     Role getRoleByName(@WebParam(name = "namespaceCode") String namespaceCode,
 96  
                        @WebParam(name = "roleName") String roleName);
 97  
 
 98  
         /**
 99  
          * Return the Role ID for the given unique combination of namespace,
 100  
          * component and role name.
 101  
          */
 102  
     @WebMethod(operationName = "getRoleIdByName")
 103  
     @WebResult(name = "roleId")
 104  
         String getRoleIdByName( @WebParam(name="namespaceCode") String namespaceCode,
 105  
                             @WebParam(name="roleName") String roleName );
 106  
 
 107  
         /**
 108  
          * Checks whether the role with the given role ID is active.
 109  
          *
 110  
          * @param roleId
 111  
          * @return
 112  
          */
 113  
     @WebMethod(operationName = "isRoleActive")
 114  
     @WebResult(name = "isRoleActive")
 115  
     boolean isRoleActive( @WebParam(name="roleId") String roleId );
 116  
 
 117  
     /**
 118  
      * Returns a list of role qualifiers that the given principal has without taking into consideration
 119  
      * that the principal may be a member via an assigned group or role.  Use in situations where
 120  
      * you are only interested in the qualifiers that are directly assigned to the principal.
 121  
      */
 122  
     @WebMethod(operationName = "getRoleQualifersForPrincipalByRoleIds")
 123  
     @XmlElementWrapper(name = "attributes", required = true)
 124  
     @XmlElement(name = "attribute", required = false)
 125  
     @WebResult(name = "attributes")
 126  
     @XmlJavaTypeAdapter(value = MapStringStringAdapter.class)
 127  
     List<Map<String, String>> getRoleQualifiersForPrincipal(@WebParam(name="principalId") String principalId,
 128  
                                                      @WebParam(name="roleIds") List<String> roleIds,
 129  
                                                      @WebParam(name="qualification") @XmlJavaTypeAdapter(value = MapStringStringAdapter.class) Map<String, String> qualification );
 130  
 
 131  
     /**
 132  
      * Returns a list of role qualifiers that the given principal has without taking into consideration
 133  
      * that the principal may be a member via an assigned group or role.  Use in situations where
 134  
      * you are only interested in the qualifiers that are directly assigned to the principal.
 135  
      */
 136  
     @WebMethod(operationName = "getRoleQualifersForPrincipalByNamespaceAndRolename")
 137  
     @XmlElementWrapper(name = "attributes", required = true)
 138  
     @XmlElement(name = "attribute", required = false)
 139  
     @WebResult(name = "attributes")
 140  
     @XmlJavaTypeAdapter(value = MapStringStringAdapter.class)
 141  
     List<Map<String, String>> getRoleQualifiersForPrincipal(@WebParam(name="principalId") String principalId,
 142  
                                                      @WebParam(name="namespaceCode") String namespaceCode,
 143  
                                                      @WebParam(name="roleName") String roleName,
 144  
                                                      @WebParam(name="qualification") @XmlJavaTypeAdapter(value = MapStringStringAdapter.class) Map<String, String> qualification );
 145  
 
 146  
     /**
 147  
      * Returns a list of role qualifiers that the given principal.  If the principal's membership
 148  
      * is via a group or role, that group or role's qualifier on the given role is returned.
 149  
      */
 150  
     @WebMethod(operationName = "getNestedRoleQualifersForPrincipalByNamespaceAndRolename")
 151  
     @XmlElementWrapper(name = "attributes", required = true)
 152  
     @XmlElement(name = "attribute", required = false)
 153  
     @WebResult(name = "attributes")
 154  
     @XmlJavaTypeAdapter(value = MapStringStringAdapter.class)
 155  
         List<Map<String, String>> getNestedRoleQualifiersForPrincipal(@WebParam(name = "principalId") String principalId,
 156  
                                                            @WebParam(name = "namespaceCode") String namespaceCode,
 157  
                                                            @WebParam(name = "roleName") String roleName,
 158  
                                                            @WebParam(name = "qualification") @XmlJavaTypeAdapter(value = MapStringStringAdapter.class) Map<String, String> qualification);
 159  
 
 160  
     /**
 161  
      * Returns a list of role qualifiers that the given principal.  If the principal's membership
 162  
      * is via a group or role, that group or role's qualifier on the given role is returned.
 163  
      */
 164  
     @WebMethod(operationName = "getNestedRoleQualifiersForPrincipalByRoleIds")
 165  
     @XmlElementWrapper(name = "attributes", required = true)
 166  
     @XmlElement(name = "attribute", required = false)
 167  
     @WebResult(name = "attributes")
 168  
     @XmlJavaTypeAdapter(value = MapStringStringAdapter.class)
 169  
         List<Map<String, String>> getNestedRoleQualifiersForPrincipal(@WebParam(name = "principalId") String principalId,
 170  
                                                            @WebParam(name = "roleIds") List<String> roleIds,
 171  
                                                            @WebParam(name = "qualification") @XmlJavaTypeAdapter(value = MapStringStringAdapter.class) Map<String, String> qualification);
 172  
 
 173  
 
 174  
     // --------------------
 175  
     // Role Membership Checks
 176  
     // --------------------
 177  
 
 178  
     /**
 179  
      * Get all the role members (groups and principals) associated with the given list of roles
 180  
      * where their role membership/assignment matches the given qualification.
 181  
      *
 182  
      * The return object will have each membership relationship along with the delegations
 183  
      *
 184  
      */
 185  
     @WebMethod(operationName = "getRoleMembers")
 186  
     @XmlElementWrapper(name = "roleMemberships", required = true)
 187  
     @XmlElement(name = "roleMembership", required = false)
 188  
     @WebResult(name = "roleMemberships")
 189  
     List<RoleMembership> getRoleMembers( @WebParam(name="roleIds") List<String> roleIds,
 190  
                                              @WebParam(name="qualification")@XmlJavaTypeAdapter(value = MapStringStringAdapter.class) Map<String, String> qualification );
 191  
 
 192  
     /**
 193  
          * This method gets all the members, then traverses down into members of type role and group to obtain the nested principal ids
 194  
          *
 195  
          * @return list of member principal ids
 196  
          */
 197  
     @WebMethod(operationName = "getRoleMemberPrincipalIds")
 198  
     @XmlElementWrapper(name = "principalIds", required = true)
 199  
     @XmlElement(name = "principalId", required = false)
 200  
     @WebResult(name = "principalIds")
 201  
     Collection<String> getRoleMemberPrincipalIds(@WebParam(name="namespaceCode") String namespaceCode,
 202  
                                                  @WebParam(name="roleName") String roleName,
 203  
                                                  @WebParam(name="qualification") @XmlJavaTypeAdapter(value = MapStringStringAdapter.class) Map<String, String> qualification);
 204  
 
 205  
     /**
 206  
      * Returns whether the given principal has any of the passed role IDs with the given qualification.
 207  
      */
 208  
     @WebMethod(operationName = "principalHasRole")
 209  
     @WebResult(name = "principalHasRole")
 210  
     boolean principalHasRole( @WebParam(name="principalId") String principalId,
 211  
                               @WebParam(name="roleIds") List<String> roleIds,
 212  
                               @WebParam(name="qualification") @XmlJavaTypeAdapter(value = MapStringStringAdapter.class) Map<String, String> qualification );
 213  
 
 214  
     /**
 215  
      * Returns the subset of the given principal ID list which has the given role and qualification.
 216  
      * This is designed to be used by lookups of people by their roles.
 217  
      */
 218  
     @WebMethod(operationName = "getPrincipalIdSubListWithRole")
 219  
     @XmlElementWrapper(name = "principalIds", required = true)
 220  
     @XmlElement(name = "principalId", required = false)
 221  
     @WebResult(name = "principalIds")
 222  
     List<String> getPrincipalIdSubListWithRole( @WebParam(name="principalIds") List<String> principalIds,
 223  
                                                 @WebParam(name="roleNamespaceCode") String roleNamespaceCode,
 224  
                                                 @WebParam(name="roleName") String roleName,
 225  
                                                 @WebParam(name="qualification") @XmlJavaTypeAdapter(value = MapStringStringAdapter.class) Map<String, String> qualification );
 226  
 
 227  
     /**
 228  
          *
 229  
          * This method gets search results for role lookup
 230  
          */
 231  
     @WebMethod(operationName = "getRolesSearchResults")
 232  
     @XmlElementWrapper(name = "roles", required = true)
 233  
     @XmlElement(name = "role", required = false)
 234  
     @WebResult(name = "roles")
 235  
         List<Role> getRolesSearchResults(
 236  
             @XmlJavaTypeAdapter(value = MapStringStringAdapter.class) @WebParam(name = "fieldValues") Map<String,String> fieldValues);
 237  
 
 238  
         /**
 239  
          * Notifies all of a principal's roles and role types that the principal has been inactivated.
 240  
          */
 241  
     @WebMethod(operationName = "principalInactivated")
 242  
         void principalInactivated( @WebParam(name="principalId") String principalId );
 243  
 
 244  
         /**
 245  
          * Notifies the role service that the role with the given id has been inactivated.
 246  
          */
 247  
     @WebMethod(operationName = "roleInactivated")
 248  
         void roleInactivated(@WebParam(name="roleId") String roleId);
 249  
 
 250  
         /**
 251  
          * Notifies the role service that the group with the given id has been inactivated.
 252  
          */
 253  
     @WebMethod(operationName = "groupInactivated")
 254  
     void groupInactivated(@WebParam(name="groupId") String groupId);
 255  
 
 256  
     /**
 257  
      * Gets all direct members of the roles that have ids within the given list
 258  
      * of role ids.  This method does not recurse into any nested roles.
 259  
      *
 260  
      *  <p>The resulting List of role membership will contain membership for
 261  
      *  all the roles with the specified ids.  The list is not guaranteed to be
 262  
      *  in any particular order and may have membership info for the
 263  
      *  different roles interleaved with each other.
 264  
      */
 265  
     @WebMethod(operationName = "getFirstLevelRoleMembers")
 266  
     @XmlElementWrapper(name = "roleMemberships", required = true)
 267  
     @XmlElement(name = "roleMembership", required = false)
 268  
     @WebResult(name = "roleMemberships")
 269  
         List<RoleMembership> getFirstLevelRoleMembers(@WebParam(name="roleIds") List<String> roleIds);
 270  
 
 271  
         /**
 272  
          * Gets role member information based on the given search criteria.  The
 273  
          * map of criteria contains attributes of RoleMembership as it's
 274  
          * key and the values to search on as the value.
 275  
          */
 276  
     @WebMethod(operationName = "findRoleMemberships")
 277  
     @XmlElementWrapper(name = "roleMemberships", required = true)
 278  
     @XmlElement(name = "roleMembership", required = false)
 279  
     @WebResult(name = "roleMemberships")
 280  
         List<RoleMembership> findRoleMemberships(
 281  
             @XmlJavaTypeAdapter(value = MapStringStringAdapter.class) @WebParam(name="fieldValues") java.util.Map<String, String> fieldValues);
 282  
 
 283  
         /**
 284  
          * Gets a list of Roles that the given member belongs to.
 285  
          */
 286  
     @WebMethod(operationName = "getMemberParentRoleIds")
 287  
     @XmlElementWrapper(name = "roleIds", required = true)
 288  
     @XmlElement(name = "roleId", required = false)
 289  
     @WebResult(name = "roleIds")
 290  
         List<String> getMemberParentRoleIds(String memberType, String memberId);
 291  
 
 292  
 
 293  
     @WebMethod(operationName = "findRoleMembers")
 294  
     @XmlElementWrapper(name = "roleMembers", required = true)
 295  
     @XmlElement(name = "roleMember", required = false)
 296  
     @WebResult(name = "roleMembers")
 297  
         List<RoleMember> findRoleMembers(
 298  
             @XmlJavaTypeAdapter(value = MapStringStringAdapter.class) @WebParam(name="fieldValues") java.util.Map<String, String> fieldValues);
 299  
 
 300  
     @WebMethod(operationName = "findDelegateMembers")
 301  
     @XmlElementWrapper(name = "delegateMembers", required = true)
 302  
     @XmlElement(name = "delegateMember", required = false)
 303  
     @WebResult(name = "delegateMembers")
 304  
     List<DelegateMember> findDelegateMembers
 305  
             (@XmlJavaTypeAdapter(value = MapStringStringAdapter.class) @WebParam(name = "fieldValues") java.util.Map<String, String> fieldValues);
 306  
 
 307  
         /**
 308  
          * Gets delegation member information based on the given search criteria.  The
 309  
          * map of criteria contains attributes of Delegate as it's
 310  
          * key and the values to search on as the value.
 311  
          */
 312  
     @WebMethod(operationName = "getDelegationMembersByDelegationId")
 313  
     @XmlElementWrapper(name = "delegateMembers", required = true)
 314  
     @XmlElement(name = "delegateMember", required = false)
 315  
     @WebResult(name = "delegateMembers")
 316  
     List<DelegateMember> getDelegationMembersByDelegationId(
 317  
             @WebParam(name = "delegationId") String delegationId);
 318  
 
 319  
     @WebMethod(operationName = "getDelegationMemberByDelegationAndMemberId")
 320  
     @WebResult(name = "delegateMemberInfo")
 321  
     DelegateMember getDelegationMemberByDelegationAndMemberId(
 322  
             @WebParam(name = "delegationId") String delegationId, @WebParam(name = "memberId") String memberId);
 323  
 
 324  
     @WebMethod(operationName = "getDelegationMemberById")
 325  
     @WebResult(name = "delegateMemberInfo")
 326  
     DelegateMember getDelegationMemberById(@WebParam(name = "delegationMemberId") String delegationMemberId);
 327  
 
 328  
     @WebMethod(operationName = "getRoleResponsibilities")
 329  
     @XmlElementWrapper(name = "roleResponsibilities", required = true)
 330  
     @XmlElement(name = "roleResponsibility", required = false)
 331  
     @WebResult(name = "roleResponsibilities")
 332  
         List<RoleResponsibility> getRoleResponsibilities(@WebParam(name="roleId") String roleId);
 333  
 
 334  
     @WebMethod(operationName = "getRoleMemberResponsibilityActions")
 335  
     @XmlElementWrapper(name = "roleResponsibilityActions", required = true)
 336  
     @XmlElement(name = "roleResponsibilityAction", required = false)
 337  
     @WebResult(name = "roleResponsibilityActions")
 338  
         List<RoleResponsibilityAction> getRoleMemberResponsibilityActions(
 339  
             @WebParam(name = "roleMemberId") String roleMemberId);
 340  
 
 341  
     @WebMethod(operationName = "getDelegateTypeInfo")
 342  
     @WebResult(name = "delegateType")
 343  
     DelegateType getDelegateTypeInfo(
 344  
             @WebParam(name="roleId") String roleId, @WebParam(name="delegationTypeCode") String delegationTypeCode);
 345  
 
 346  
     @WebMethod(operationName = "getDelegateTypeInfoById")
 347  
     @WebResult(name = "delegateType")
 348  
     DelegateType getDelegateTypeInfoById( @WebParam(name="delegationId") String delegationId);
 349  
 
 350  
         @WebMethod(operationName = "applicationRoleMembershipChanged")
 351  
     void applicationRoleMembershipChanged( @WebParam(name="roleId") String roleId );
 352  
 
 353  
     @WebMethod(operationName = "lookupRoles")
 354  
     @XmlElementWrapper(name = "roles", required = true)
 355  
     @XmlElement(name = "role", required = false)
 356  
     @WebResult(name = "roles")
 357  
         List<Role> lookupRoles(@WebParam(name="searchCriteria") @XmlJavaTypeAdapter(value = MapStringStringAdapter.class) Map<String, String> searchCriteria);
 358  
 
 359  
         /**
 360  
          * Flushes an internal role cache used by the base implementation to prevent repeated database I/O.
 361  
          */
 362  
     @WebMethod(operationName = "flushInternalRoleCache")
 363  
         void flushInternalRoleCache();
 364  
 
 365  
         /**
 366  
          * Flushes an internal role member cache used by the base implementation to prevent repeated database I/O.
 367  
          */
 368  
     @WebMethod(operationName = "flushInternalRoleMemberCache")
 369  
         void flushInternalRoleMemberCache();
 370  
 
 371  
         /**
 372  
          * Flushes an internal delegation cache used by the base implementation to prevent repeated database I/O.
 373  
          */
 374  
     @WebMethod(operationName = "flushInternalDelegationCache")
 375  
         void flushInternalDelegationCache();
 376  
 
 377  
         /**
 378  
          * Flushes an internal delegation member cache used by the base implementation to prevent repeated database I/O.
 379  
          */
 380  
     @WebMethod(operationName = "flushInternalDelegationMemberCache")
 381  
         void flushInternalDelegationMemberCache();
 382  
 }