Class UserPermissionDAOHibernate
java.lang.Object
com.atlassian.crowd.util.persistence.hibernate.StatelessDao
com.atlassian.crowd.util.persistence.hibernate.HibernateDao<InternalGrantedPermission>
com.atlassian.crowd.dao.permission.UserPermissionDAOHibernate
- All Implemented Interfaces:
InternalUserPermissionDAO
public class UserPermissionDAOHibernate
extends HibernateDao<InternalGrantedPermission>
implements InternalUserPermissionDAO
-
Field Summary
Fields inherited from class com.atlassian.crowd.util.persistence.hibernate.HibernateDao
batchFinder, batchProcessor, logger, statelessSessionBatchProcessor, timeSource
Fields inherited from class com.atlassian.crowd.util.persistence.hibernate.StatelessDao
sessionFactory
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
exists
(InternalGrantedPermission grantedPermission) Return true if the InternalGrantedPermission has been explicitly granted.This is used in the backup procedurefindAllPermissionsForGroup
(String groupName, long directoryId) Find all permission entries for this group.findHighestPermissionPerGroup
(int start, int limit) Find all groups with an explicit permission, and return their highest permissionfindHighestPermissionPerGroupByPrefix
(String prefix, int start, int limit) Find all groups with an explicit permission, and return their highest permissiongetGrantedPermissions
(UserPermission permission) Find all groups that have been explicitly (not implicitly) granted the provided permissiongetGrantedPermissions
(UserPermission permission, Application application) Find all groups that have been explicitly (not implicitly) granted the provided permissionAll subclasses of HibernateDao must implement this method forHibernateDao.load(Serializable)
to work correctly.void
grant
(InternalGrantedPermission permission) Grant the explicit permission to the group.boolean
revoke
(InternalGrantedPermission permission) Remove the explicit permission from the group.int
revokeAll
(DirectoryMapping directoryMapping) Revokes all permissions associated with the specified directory mappingMethods inherited from class com.atlassian.crowd.util.persistence.hibernate.HibernateDao
createDeleteQuery, createDeleteQuery, createQuery, createQuery, executeHQLQuery, findAllInternal, findByProperties, findByPropertiesOptional, findByProperty, findByProperty, findByPropertyOptional, findByPropertyOrThrow, getCountByProperties, load, load, loadOptional, loadReference, loadReference, remove, removeByIdIfPresent, save, saveOrUpdate, session, setBatchFinder, setBatchProcessor, setClock, setStatelessSessionBatchProcessor, toPredicates, update
Methods inherited from class com.atlassian.crowd.util.persistence.hibernate.StatelessDao
setSessionFactory, withStatelessSession
-
Constructor Details
-
UserPermissionDAOHibernate
public UserPermissionDAOHibernate()
-
-
Method Details
-
getPersistentClass
Description copied from class:HibernateDao
All subclasses of HibernateDao must implement this method forHibernateDao.load(Serializable)
to work correctly.- Specified by:
getPersistentClass
in classHibernateDao<InternalGrantedPermission>
- Returns:
- the entity class for this DAO
-
grant
Description copied from interface:InternalUserPermissionDAO
Grant the explicit permission to the group. If the permission already explicitly exists, do nothing.- Specified by:
grant
in interfaceInternalUserPermissionDAO
- Parameters:
permission
- the group/permission pair to create
-
getGrantedPermissions
Description copied from interface:InternalUserPermissionDAO
Find all groups that have been explicitly (not implicitly) granted the provided permission- Specified by:
getGrantedPermissions
in interfaceInternalUserPermissionDAO
- Parameters:
permission
- permission to search for- Returns:
- all groups with this permission
-
getGrantedPermissions
public Collection<PermittedGroup> getGrantedPermissions(UserPermission permission, Application application) Description copied from interface:InternalUserPermissionDAO
Find all groups that have been explicitly (not implicitly) granted the provided permission- Specified by:
getGrantedPermissions
in interfaceInternalUserPermissionDAO
- Parameters:
permission
- permission to search forapplication
- application the permission should apply to- Returns:
- all groups with this permission
-
findHighestPermissionPerGroupByPrefix
public List<PermittedGroup> findHighestPermissionPerGroupByPrefix(String prefix, int start, int limit) Description copied from interface:InternalUserPermissionDAO
Find all groups with an explicit permission, and return their highest permission- Specified by:
findHighestPermissionPerGroupByPrefix
in interfaceInternalUserPermissionDAO
- Parameters:
prefix
- prefix return only groups whose names start with this prefixstart
- index to start page atlimit
- max number of results to return, 0 for all results- Returns:
- the highest permission for each group with an explicit permission ordered by groupName. If a group has ADMIN and SYS_ADMIN, only return SYS_ADMIN
-
findHighestPermissionPerGroup
Description copied from interface:InternalUserPermissionDAO
Find all groups with an explicit permission, and return their highest permission- Specified by:
findHighestPermissionPerGroup
in interfaceInternalUserPermissionDAO
- Parameters:
start
- index to start page atlimit
- max number of results to return, 0 for all results- Returns:
- the highest permission for each group with an explicit permission ordered by groupName. If a group has ADMIN and SYS_ADMIN, only return SYS_ADMIN
-
findAllPermissionsForGroup
public List<InternalGrantedPermission> findAllPermissionsForGroup(String groupName, long directoryId) Description copied from interface:InternalUserPermissionDAO
Find all permission entries for this group. Used for eg. cleaning up when deleting the group.- Specified by:
findAllPermissionsForGroup
in interfaceInternalUserPermissionDAO
- Parameters:
groupName
- name of group to search- Returns:
- database entries ordered by groupName
-
findAllInternalGrantedPermissions
This is used in the backup procedure -
revoke
Description copied from interface:InternalUserPermissionDAO
Remove the explicit permission from the group.- Specified by:
revoke
in interfaceInternalUserPermissionDAO
- Parameters:
permission
- the group/permission pair to remove- Returns:
- true if the permission existed and was removed
-
revokeAll
Description copied from interface:InternalUserPermissionDAO
Revokes all permissions associated with the specified directory mapping- Specified by:
revokeAll
in interfaceInternalUserPermissionDAO
- Parameters:
directoryMapping
- the directory mapping to revoke permissions for- Returns:
- the number of permissions removed
-
exists
Description copied from interface:InternalUserPermissionDAO
Return true if the InternalGrantedPermission has been explicitly granted. Ie. there is a row matching the group and permission specified by the permission param- Specified by:
exists
in interfaceInternalUserPermissionDAO
- Parameters:
grantedPermission
- the group/permission pair to search for- Returns:
- true if the permission has been explicitly granted (not implicitly)
-