org.kuali.rice.kim.service.impl
Class PermissionServiceImpl

java.lang.Object
  extended by org.kuali.rice.kim.service.impl.PermissionServiceBase
      extended by org.kuali.rice.kim.service.impl.PermissionServiceImpl
All Implemented Interfaces:
PermissionService

public class PermissionServiceImpl
extends PermissionServiceBase
implements PermissionService

This is a description of what this class does - jonathan don't forget to fill this in.

Author:
Kuali Rice Team (rice.collab@kuali.org)

Field Summary
 
Fields inherited from class org.kuali.rice.kim.service.impl.PermissionServiceBase
DEFAULT_PERMISSION_TYPE_SERVICE, PERMISSION_IMPL_CACHE_GROUP, PERMISSION_IMPL_CACHE_PREFIX, PERMISSION_IMPL_ID_CACHE_PREFIX, PERMISSION_IMPL_NAME_CACHE_PREFIX
 
Constructor Summary
PermissionServiceImpl()
           
 
Method Summary
 List<KimPermissionTemplateInfo> getAllTemplates()
           
 List<KimPermissionInfo> getAuthorizedPermissions(String principalId, String namespaceCode, String permissionName, AttributeSet permissionDetails, AttributeSet qualification)
          Returns permissions (with their details) that are granted to the principal given the passed qualification.
 List<KimPermissionInfo> getAuthorizedPermissionsByTemplateName(String principalId, String namespaceCode, String permissionTemplateName, AttributeSet permissionDetails, AttributeSet qualification)
          Returns permissions (with their details) that are granted to the principal given the passed qualification.
protected  DataDictionaryService getDataDictionaryService()
           
protected  KimPermissionTypeService getDefaultPermissionTypeService()
           
protected  List<KimPermissionInfo> getMatchingPermissions(List<KimPermissionImpl> permissions, AttributeSet permissionDetails)
          Compare each of the passed in permissions with the given permissionDetails.
 KimPermissionInfo getPermission(String permissionId)
          Get the permission object with the given ID.
 List<PermissionAssigneeInfo> getPermissionAssignees(String namespaceCode, String permissionName, AttributeSet permissionDetails, AttributeSet qualification)
          Get the list of principals/groups who have a given permission.
 List<PermissionAssigneeInfo> getPermissionAssigneesForTemplateName(String namespaceCode, String permissionTemplateName, AttributeSet permissionDetails, AttributeSet qualification)
          Get the list of principals/groups who have a given permission that match the given permission template and permission details.
 KimPermissionDao getPermissionDao()
           
 String getPermissionDetailLabel(String permissionId, String kimTypeId, String attributeName)
          Returns the label of the permission detail for the given permissionId, kimType and attributeName.
protected  KimPermissionImpl getPermissionImpl(String permissionId)
           
protected  List<KimPermissionImpl> getPermissionImplsByName(String namespaceCode, String permissionName)
           
protected  List<KimPermissionImpl> getPermissionImplsByNameIncludingInactive(String namespaceCode, String permissionName)
           
protected  List<KimPermissionImpl> getPermissionImplsByTemplateName(String namespaceCode, String permissionTemplateName)
           
 List<KimPermissionInfo> getPermissionsByName(String namespaceCode, String permissionName)
          Return the permission object for the given unique combination of namespace, component and permission name.
 List<KimPermissionInfo> getPermissionsByNameIncludingInactive(String namespaceCode, String permissionName)
          Return the permission object for the given unique combination of namespace, component and permission name.
 List<KimPermissionInfo> getPermissionsByTemplateName(String namespaceCode, String permissionTemplateName)
          Return the permission object for the given unique combination of namespace, component and permission template name.
protected  List<KimPermissionInfo> getPermissionsForUser(String principalId, List<KimPermissionInfo> permissions, AttributeSet qualification)
          Checks the list of permissions against the principal's roles and returns a subset of the list which match.
 KimPermissionTemplateInfo getPermissionTemplate(String permissionTemplateId)
           
 KimPermissionTemplateInfo getPermissionTemplateByName(String namespaceCode, String permissionTemplateName)
          This overridden method ...
protected  KimPermissionTypeService getPermissionTypeService(KimPermissionTemplateImpl permissionTemplate)
           
protected  KimPermissionTypeService getPermissionTypeService(String namespaceCode, String permissionTemplateName, String permissionName, String permissionId)
           
protected  Map<String,KimPermissionTypeService> getPermissionTypeServicesByTemplateId(Collection<KimPermissionImpl> permissions)
           
 int getRefreshPeriodInSeconds()
           
 List<String> getRoleIdsForPermission(String namespaceCode, String permissionName, AttributeSet permissionDetails)
          Get the role IDs for the given permission.
 List<String> getRoleIdsForPermissionId(String permissionId)
          Get the role IDs for the given permission.
 List<String> getRoleIdsForPermissions(List<KimPermissionInfo> permissions)
          Get the role IDs for the given list of permissions.
protected  List<String> getRoleIdsForPermissionTemplate(String namespaceCode, String permissionTemplateName, AttributeSet permissionDetails)
           
protected  RoleService getRoleService()
           
protected  Map<String,List<KimPermissionInfo>> groupPermissionsByTemplate(Collection<KimPermissionImpl> permissions)
           
 boolean hasPermission(String principalId, String namespaceCode, String permissionName, AttributeSet permissionDetails)
          Checks whether the principal has been granted a permission matching the given details without taking role qualifiers into account.
 boolean hasPermissionByTemplateName(String principalId, String namespaceCode, String permissionTemplateName, AttributeSet permissionDetails)
          Checks whether the principal has been granted a permission matching the given details without taking role qualifiers into account.
 boolean isAuthorized(String principalId, String namespaceCode, String permissionName, AttributeSet permissionDetails, AttributeSet qualification)
          Checks whether the given qualified permission is granted to the principal given the passed roleQualification.
 boolean isAuthorizedByTemplateName(String principalId, String namespaceCode, String permissionTemplateName, AttributeSet permissionDetails, AttributeSet qualification)
          Checks whether the given qualified permission is granted to the principal given the passed roleQualification.
 boolean isPermissionAssigned(String namespaceCode, String permissionName, AttributeSet permissionDetails)
           
 boolean isPermissionDefined(String namespaceCode, String permissionName, AttributeSet permissionDetails)
          Returns true if the given permission is defined on any Roles.
 boolean isPermissionDefinedForTemplateName(String namespaceCode, String permissionTemplateName, AttributeSet permissionDetails)
          Returns true if the given permission template is defined on any Roles.
 List<KimPermissionInfo> lookupPermissions(Map<String,String> searchCriteria, boolean unbounded)
          Search for permissions using arbitrary search criteria.
 void setPermissionDao(KimPermissionDao permissionDao)
           
 void setRoleService(RoleService roleService)
           
 
Methods inherited from class org.kuali.rice.kim.service.impl.PermissionServiceBase
addRolesForPermissionsToCache, flushPermissionImplCache, getBusinessObjectService, getCacheAdministrator, getNewAttributeDataId, getPermissionImplByIdCacheKey, getPermissionImplByNameCacheKey, getPermissionImplByTemplateNameCacheKey, getPermissionTypeServiceByNameCache, getRolesForPermissionsFromCache, getSequenceAccessorService
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PermissionServiceImpl

public PermissionServiceImpl()
Method Detail

getPermissionTypeService

protected KimPermissionTypeService getPermissionTypeService(String namespaceCode,
                                                            String permissionTemplateName,
                                                            String permissionName,
                                                            String permissionId)

getPermissionTypeService

protected KimPermissionTypeService getPermissionTypeService(KimPermissionTemplateImpl permissionTemplate)

getDefaultPermissionTypeService

protected KimPermissionTypeService getDefaultPermissionTypeService()

hasPermission

public boolean hasPermission(String principalId,
                             String namespaceCode,
                             String permissionName,
                             AttributeSet permissionDetails)
Description copied from interface: PermissionService
Checks whether the principal has been granted a permission matching the given details without taking role qualifiers into account. This method should not be used for true authorization checks since a principal may only have this permission within a given context. It could be used to identify that the user would have some permissions within a certain area. Later checks would identify exactly what permissions were granted. It can also be used when the client application KNOWS that this is a role which is never qualified.

Specified by:
hasPermission in interface PermissionService
See Also:
PermissionService.hasPermission(java.lang.String, String, java.lang.String, AttributeSet)

isAuthorized

public boolean isAuthorized(String principalId,
                            String namespaceCode,
                            String permissionName,
                            AttributeSet permissionDetails,
                            AttributeSet qualification)
Description copied from interface: PermissionService
Checks whether the given qualified permission is granted to the principal given the passed roleQualification. If no roleQualification is passed (null or empty) then this method behaves the same as PermissionService.hasPermission(String, String, String, AttributeSet). Each role assigned to the principal is checked for qualifications. If a qualifier exists on the principal's membership in that role, that is checked first through the role's type service. Once it is determined that the principal has the role in the given context (qualification), the permissions are examined. Each permission is checked against the permissionDetails. The KimPermissionTypeService is called for each permission with the given permissionName to see if the permissionDetails matches its details.

Specified by:
isAuthorized in interface PermissionService
See Also:
PermissionService.isAuthorized( java.lang.String, String, java.lang.String, AttributeSet, AttributeSet)

hasPermissionByTemplateName

public boolean hasPermissionByTemplateName(String principalId,
                                           String namespaceCode,
                                           String permissionTemplateName,
                                           AttributeSet permissionDetails)
Description copied from interface: PermissionService
Checks whether the principal has been granted a permission matching the given details without taking role qualifiers into account. This method should not be used for true authorization checks since a principal may only have this permission within a given context. It could be used to identify that the user would have some permissions within a certain area. Later checks would identify exactly what permissions were granted. It can also be used when the client application KNOWS that this is a role which is never qualified.

Specified by:
hasPermissionByTemplateName in interface PermissionService
See Also:
PermissionService.hasPermission(String, String, String, AttributeSet)

isAuthorizedByTemplateName

public boolean isAuthorizedByTemplateName(String principalId,
                                          String namespaceCode,
                                          String permissionTemplateName,
                                          AttributeSet permissionDetails,
                                          AttributeSet qualification)
Description copied from interface: PermissionService
Checks whether the given qualified permission is granted to the principal given the passed roleQualification. If no roleQualification is passed (null or empty) then this method behaves the same as PermissionService.hasPermission(String, String, String, AttributeSet). Each role assigned to the principal is checked for qualifications. If a qualifier exists on the principal's membership in that role, that is checked first through the role's type service. Once it is determined that the principal has the role in the given context (qualification), the permissions are examined. Each permission is checked against the permissionDetails. The KimPermissionTypeService is called for each permission with the given permissionName to see if the permissionDetails matches its details.

Specified by:
isAuthorizedByTemplateName in interface PermissionService
See Also:
PermissionService.isAuthorized( java.lang.String, String, java.lang.String, AttributeSet, AttributeSet)

getAuthorizedPermissions

public List<KimPermissionInfo> getAuthorizedPermissions(String principalId,
                                                        String namespaceCode,
                                                        String permissionName,
                                                        AttributeSet permissionDetails,
                                                        AttributeSet qualification)
Description copied from interface: PermissionService
Returns permissions (with their details) that are granted to the principal given the passed qualification. If no qualification is passed (null or empty) then this method does not check any qualifications on the roles. All permissions with the given name are checked against the permissionDetails. The KimPermissionTypeService is called for each permission to see if the permissionDetails matches its details. An asterisk (*) as a value in any permissionDetails key-value pair will match any value. This forms a way to provide a wildcard to obtain multiple permissions in one call. After the permissions are determined, the roles that hold those permissions are determined. Each role that matches between the principal and the permission objects is checked for qualifications. If a qualifier exists on the principal's membership in that role, that is checked through the role's type service.

Specified by:
getAuthorizedPermissions in interface PermissionService
See Also:
PermissionService.getAuthorizedPermissions(String, String, String, AttributeSet, AttributeSet)

getAuthorizedPermissionsByTemplateName

public List<KimPermissionInfo> getAuthorizedPermissionsByTemplateName(String principalId,
                                                                      String namespaceCode,
                                                                      String permissionTemplateName,
                                                                      AttributeSet permissionDetails,
                                                                      AttributeSet qualification)
Description copied from interface: PermissionService
Returns permissions (with their details) that are granted to the principal given the passed qualification. If no qualification is passed (null or empty) then this method does not check any qualifications on the roles. All permissions with the given name are checked against the permissionDetails. The KimPermissionTypeService is called for each permission to see if the permissionDetails matches its details. An asterisk (*) as a value in any permissionDetails key-value pair will match any value. This forms a way to provide a wildcard to obtain multiple permissions in one call. After the permissions are determined, the roles that hold those permissions are determined. Each role that matches between the principal and the permission objects is checked for qualifications. If a qualifier exists on the principal's membership in that role, that is checked through the role's type service.

Specified by:
getAuthorizedPermissionsByTemplateName in interface PermissionService
See Also:
PermissionService.getAuthorizedPermissionsByTemplateName(String, String, String, AttributeSet, AttributeSet)

getPermissionsForUser

protected List<KimPermissionInfo> getPermissionsForUser(String principalId,
                                                        List<KimPermissionInfo> permissions,
                                                        AttributeSet qualification)
Checks the list of permissions against the principal's roles and returns a subset of the list which match.


getPermissionTypeServicesByTemplateId

protected Map<String,KimPermissionTypeService> getPermissionTypeServicesByTemplateId(Collection<KimPermissionImpl> permissions)

groupPermissionsByTemplate

protected Map<String,List<KimPermissionInfo>> groupPermissionsByTemplate(Collection<KimPermissionImpl> permissions)

getMatchingPermissions

protected List<KimPermissionInfo> getMatchingPermissions(List<KimPermissionImpl> permissions,
                                                         AttributeSet permissionDetails)
Compare each of the passed in permissions with the given permissionDetails. Those that match are added to the result list.


getPermissionAssignees

public List<PermissionAssigneeInfo> getPermissionAssignees(String namespaceCode,
                                                           String permissionName,
                                                           AttributeSet permissionDetails,
                                                           AttributeSet qualification)
Description copied from interface: PermissionService
Get the list of principals/groups who have a given permission. This also returns delegates for the given principals/groups who also have this permission given the context in the qualification parameter. Each role assigned to the principal is checked for qualifications. If a qualifier exists on the principal's membership in that role, that is checked first through the role's type service. Once it is determined that the principal has the role in the given context (qualification), the permissions are examined.

Specified by:
getPermissionAssignees in interface PermissionService
See Also:
PermissionService.getPermissionAssignees(String, String, AttributeSet, AttributeSet)

getPermissionAssigneesForTemplateName

public List<PermissionAssigneeInfo> getPermissionAssigneesForTemplateName(String namespaceCode,
                                                                          String permissionTemplateName,
                                                                          AttributeSet permissionDetails,
                                                                          AttributeSet qualification)
Description copied from interface: PermissionService
Get the list of principals/groups who have a given permission that match the given permission template and permission details. This also returns delegates for the given principals/groups who also have this permission given the context in the qualification parameter. Each role assigned to the principal is checked for qualifications. If a qualifier exists on the principal's membership in that role, that is checked first through the role's type service. Once it is determined that the principal has the role in the given context (qualification), the permissions are examined.

Specified by:
getPermissionAssigneesForTemplateName in interface PermissionService

isPermissionAssigned

public boolean isPermissionAssigned(String namespaceCode,
                                    String permissionName,
                                    AttributeSet permissionDetails)

isPermissionDefined

public boolean isPermissionDefined(String namespaceCode,
                                   String permissionName,
                                   AttributeSet permissionDetails)
Description copied from interface: PermissionService
Returns true if the given permission is defined on any Roles.

Specified by:
isPermissionDefined in interface PermissionService

isPermissionDefinedForTemplateName

public boolean isPermissionDefinedForTemplateName(String namespaceCode,
                                                  String permissionTemplateName,
                                                  AttributeSet permissionDetails)
Description copied from interface: PermissionService
Returns true if the given permission template is defined on any Roles.

Specified by:
isPermissionDefinedForTemplateName in interface PermissionService

getRoleIdsForPermission

public List<String> getRoleIdsForPermission(String namespaceCode,
                                            String permissionName,
                                            AttributeSet permissionDetails)
Description copied from interface: PermissionService
Get the role IDs for the given permission.

Specified by:
getRoleIdsForPermission in interface PermissionService

getRoleIdsForPermissionTemplate

protected List<String> getRoleIdsForPermissionTemplate(String namespaceCode,
                                                       String permissionTemplateName,
                                                       AttributeSet permissionDetails)

getRoleIdsForPermissions

public List<String> getRoleIdsForPermissions(List<KimPermissionInfo> permissions)
Description copied from interface: PermissionService
Get the role IDs for the given list of permissions.

Specified by:
getRoleIdsForPermissions in interface PermissionService

getPermission

public KimPermissionInfo getPermission(String permissionId)
Description copied from interface: PermissionService
Get the permission object with the given ID.

Specified by:
getPermission in interface PermissionService
See Also:
PermissionService.getPermission(java.lang.String)

getPermissionsByTemplateName

public List<KimPermissionInfo> getPermissionsByTemplateName(String namespaceCode,
                                                            String permissionTemplateName)
Description copied from interface: PermissionService
Return the permission object for the given unique combination of namespace, component and permission template name.

Specified by:
getPermissionsByTemplateName in interface PermissionService
See Also:
PermissionService.getPermissionsByTemplateName(String, String)

getPermissionsByName

public List<KimPermissionInfo> getPermissionsByName(String namespaceCode,
                                                    String permissionName)
Description copied from interface: PermissionService
Return the permission object for the given unique combination of namespace, component and permission name.

Specified by:
getPermissionsByName in interface PermissionService
See Also:
PermissionService.getPermissionsByName(String, String)

getPermissionImpl

protected KimPermissionImpl getPermissionImpl(String permissionId)

getPermissionImplsByTemplateName

protected List<KimPermissionImpl> getPermissionImplsByTemplateName(String namespaceCode,
                                                                   String permissionTemplateName)

getPermissionImplsByName

protected List<KimPermissionImpl> getPermissionImplsByName(String namespaceCode,
                                                           String permissionName)

getRoleService

protected RoleService getRoleService()

setRoleService

public void setRoleService(RoleService roleService)

getPermissionDao

public KimPermissionDao getPermissionDao()

setPermissionDao

public void setPermissionDao(KimPermissionDao permissionDao)

lookupPermissions

public List<KimPermissionInfo> lookupPermissions(Map<String,String> searchCriteria,
                                                 boolean unbounded)
Description copied from interface: PermissionService
Search for permissions using arbitrary search criteria. JavaBeans property syntax should be used to reference the properties. If the searchCriteria parameter is null or empty, an empty list will be returned.

Specified by:
lookupPermissions in interface PermissionService

getPermissionDetailLabel

public String getPermissionDetailLabel(String permissionId,
                                       String kimTypeId,
                                       String attributeName)
Description copied from interface: PermissionService
Returns the label of the permission detail for the given permissionId, kimType and attributeName.

Specified by:
getPermissionDetailLabel in interface PermissionService

getPermissionTemplate

public KimPermissionTemplateInfo getPermissionTemplate(String permissionTemplateId)
Specified by:
getPermissionTemplate in interface PermissionService
See Also:
PermissionService.getPermissionTemplate(java.lang.String)

getPermissionTemplateByName

public KimPermissionTemplateInfo getPermissionTemplateByName(String namespaceCode,
                                                             String permissionTemplateName)
This overridden method ...

Specified by:
getPermissionTemplateByName in interface PermissionService
See Also:
PermissionService.getPermissionTemplateByName(java.lang.String, java.lang.String)

getAllTemplates

public List<KimPermissionTemplateInfo> getAllTemplates()
Specified by:
getAllTemplates in interface PermissionService

getDataDictionaryService

protected DataDictionaryService getDataDictionaryService()

getRoleIdsForPermissionId

public List<String> getRoleIdsForPermissionId(String permissionId)
Description copied from interface: PermissionService
Get the role IDs for the given permission.

Specified by:
getRoleIdsForPermissionId in interface PermissionService

getPermissionsByNameIncludingInactive

public List<KimPermissionInfo> getPermissionsByNameIncludingInactive(String namespaceCode,
                                                                     String permissionName)
Description copied from interface: PermissionService
Return the permission object for the given unique combination of namespace, component and permission name. Inactive permissions are also returned

Specified by:
getPermissionsByNameIncludingInactive in interface PermissionService

getPermissionImplsByNameIncludingInactive

protected List<KimPermissionImpl> getPermissionImplsByNameIncludingInactive(String namespaceCode,
                                                                            String permissionName)

getRefreshPeriodInSeconds

public int getRefreshPeriodInSeconds()


Copyright © 2004-2012 The Kuali Foundation. All Rights Reserved.