Class CmsUserDriver
- All Implemented Interfaces:
I_CmsDriver,I_CmsUserDriver
- Direct Known Subclasses:
CmsUserDriver,CmsUserDriver,CmsUserDriver,CmsUserDriver,CmsUserDriver,CmsUserDriver,CmsUserDriver
- Since:
- 6.0.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected MessageDigestA digest to encrypt the passwords.protected StringThe algorithm used to encode passwords.protected StringThe file.encoding to code passwords after encryption with digest.protected CmsDriverManagerThe driver manager.protected CmsSqlManagerThe SQL manager.static final StringThe root path for organizational units.static final StringThe internal request attribute to indicate that the password has not to be digested.Fields inherited from interface org.opencms.db.I_CmsDriver
AND_CONDITION, BEGIN_CONDITION, BEGIN_EXCLUDE_CONDITION, BEGIN_INCLUDE_CONDITION, END_CONDITION, OR_CONDITIONFields inherited from interface org.opencms.db.I_CmsUserDriver
DRIVER_TYPE_ID -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddResourceToOrganizationalUnit(CmsDbContext dbc, CmsOrganizationalUnit orgUnit, CmsResource resource) Adds a resource to the given organizational unit.longcountUsers(CmsDbContext dbc, CmsUserSearchParameters searchParams) Counts the total number of users which match the given search criteria.voidcreateAccessControlEntry(CmsDbContext dbc, CmsProject project, CmsUUID resource, CmsUUID principal, int allowed, int denied, int flags) Creates an access control entry.createGroup(CmsDbContext dbc, CmsUUID groupId, String groupFqn, String description, int flags, String parentGroupFqn) Creates a new group.createOrganizationalUnit(CmsDbContext dbc, String name, String description, int flags, CmsOrganizationalUnit parent, String associatedResource) Creates a new organizational unit.protected StringcreateRoleQuery(String mainQuery, boolean includeSubOus, boolean readRoles) Returns a sql query to select groups.voidCreates the default root organizational unit.createUser(CmsDbContext dbc, CmsUUID id, String userFqn, String password, String firstname, String lastname, String email, long lastlogin, int flags, long dateCreated, Map<String, Object> additionalInfos) Creates a new user.voidcreateUserInGroup(CmsDbContext dbc, CmsUUID userId, CmsUUID groupId) Adds a user to a group.createUserQuery(CmsUserSearchParameters searchParams, boolean countOnly) Creates a query for searching users.protected CmsUserQueryBuilderCreates a new user query builder.voiddeleteGroup(CmsDbContext dbc, String groupFqn) Deletes a group.voiddeleteOrganizationalUnit(CmsDbContext dbc, CmsOrganizationalUnit organizationalUnit) Deletes an organizational unit.voiddeleteUser(CmsDbContext dbc, String userFqn) Deletes a user.voiddeleteUserInfos(CmsDbContext dbc, CmsUUID userId) Deletes the user additional information table.voiddeleteUserInGroup(CmsDbContext dbc, CmsUUID userId, CmsUUID groupId) Removes a user from a group.voiddestroy()Destroys this driver.booleanexistsGroup(CmsDbContext dbc, String groupFqn) Tests if a group with the specified name exists.booleanexistsUser(CmsDbContext dbc, String userFqn) Tests if a user with the specified name exists.voidfillDefaults(CmsDbContext dbc) Initializes the default organizational units, users and groups.getGroups(CmsDbContext dbc, CmsOrganizationalUnit orgUnit, boolean includeSubOus, boolean readRoles) Returns all groups of the given organizational unit.getOrganizationalUnits(CmsDbContext dbc, CmsOrganizationalUnit parent, boolean includeChildren) Returns all child organizational units of the given parent organizational unit including hierarchical deeper organization units if needed.Returns all resources of the given organizational unit.Returns the SqlManager of this driver.getUsers(CmsDbContext dbc, CmsOrganizationalUnit orgUnit, boolean recursive) Returns all users of the given organizational unit.getUsersWithoutAdditionalInfo(CmsDbContext dbc, CmsOrganizationalUnit orgUnit, boolean recursive) Returns all users of the given organizational unit, without reading their additional infos.voidinit(CmsDbContext dbc, CmsConfigurationManager configurationManager, List<String> successiveDrivers, CmsDriverManager driverManager) Initializes the driver.initSqlManager(String classname) Initializes the SQL manager for this driver.protected CmsAccessControlEntryInternal helper method to create an access control entry from a database record.protected CmsAccessControlEntryinternalCreateAce(ResultSet res, CmsUUID newId) Internal helper method to create an access control entry from a database record.protected voidinternalCreateDefaultGroups(CmsDbContext dbc, String ouFqn, String ouDescription, boolean webuser) Creates the default groups and user for the given organizational unit.protected CmsGroupSemi-constructor to create aCmsGroupinstance from a JDBC result set.protected CmsOrganizationalUnitinternalCreateOrgUnitFromResource(CmsDbContext dbc, CmsResource resource) Returns the organizational unit represented by the given resource.protected CmsResourceinternalCreateResourceForOrgUnit(CmsDbContext dbc, String path, int flags) Creates a folder with the given path an properties, offline AND online.protected CmsUserinternalCreateUser(CmsDbContext dbc, ResultSet res) Semi-constructor to create aCmsUserinstance from a JDBC result set.protected voidinternalDeleteOrgUnitResource(CmsDbContext dbc, CmsResource resource) Deletes a resource representing a organizational unit, offline AND online.protected voidinternalDeleteUserInfo(CmsDbContext dbc, CmsUUID userId, String key) Deletes an additional user info.internalGetUsers(CmsDbContext dbc, CmsOrganizationalUnit orgUnit, boolean recursive, boolean readAdditionalInfos) Internal implementation for reading users of an OU, with or without additional infos.protected CmsResourceinternalOrgUnitFolder(CmsDbContext dbc, CmsOrganizationalUnit orgUnit) Returns the folder for the given organizational units, or the base folder ifnull.internalResourcesForOrgUnit(CmsDbContext dbc, CmsResource ouResource) Returns the list of root paths associated to the organizational unit represented by the given resource.protected voidinternalUpdateRoleGroup(CmsDbContext dbc, String groupName, CmsRole role) Updates a group to a virtual group.protected voidinternalUpdateUserInfo(CmsDbContext dbc, CmsUUID userId, String key, Object value) Updates additional user info.protected voidinternalValidateResourceForOrgUnit(CmsDbContext dbc, CmsOrganizationalUnit orgUnit, String rootPath) Validates the given root path to be in the scope of the resources of the given organizational unit.protected booleaninternalValidateUserInGroup(CmsDbContext dbc, CmsUUID userId, CmsUUID groupId) Checks if a user is member of a group.protected voidinternalWriteOrgUnitProperty(CmsDbContext dbc, CmsResource resource, CmsProperty property) Writes a property for an organizational unit resource, online AND offline.protected voidinternalWriteUserInfo(CmsDbContext dbc, CmsUUID userId, String key, Object value) Writes a new additional user info.protected voidinternalWriteUserInfos(CmsDbContext dbc, CmsUUID userId, Map<String, Object> additionalInfo) Updates the user additional information map.voidpublishAccessControlEntries(CmsDbContext dbc, CmsProject offlineProject, CmsProject onlineProject, CmsUUID offlineId, CmsUUID onlineId) Publish all access control entries of a resource from the given offline project to the online project.readAccessControlEntries(CmsDbContext dbc, CmsProject project, CmsUUID resource, boolean inheritedOnly) Reads all relevant access control entries for a given resource.readAccessControlEntry(CmsDbContext dbc, CmsProject project, CmsUUID resource, CmsUUID principal) Reads an access control entry for a given principal that is attached to a resource.readChildGroups(CmsDbContext dbc, String parentGroupFqn) Reads all child groups of a group.readGroup(CmsDbContext dbc, String groupFqn) Reads a group based on the group name.readGroup(CmsDbContext dbc, CmsUUID groupId) Reads a group based on the group id.readGroupsOfUser(CmsDbContext dbc, CmsUUID userId, String ouFqn, boolean includeChildOus, String remoteAddress, boolean readRoles) Reads all groups the given user is a member in.readOrganizationalUnit(CmsDbContext dbc, String ouFqn) Reads an organizational Unit based on its fully qualified name.readUser(CmsDbContext dbc, String userFqn) Reads a user based in the user fully qualified name.readUser(CmsDbContext dbc, String userFqn, String password, String remoteAddress) Reads a user from the database, only if the password is correct.readUser(CmsDbContext dbc, CmsUUID id) Reads a user based on the user id.readUserInfos(CmsDbContext dbc, CmsUUID userId) Reads the user additional information map.readUsersOfGroup(CmsDbContext dbc, String groupFqn, boolean includeOtherOuUsers) Reads all users that are members of the given group.voidremoveAccessControlEntries(CmsDbContext dbc, CmsProject project, CmsUUID resource) Removes all access control entries belonging to a resource.voidremoveAccessControlEntriesForPrincipal(CmsDbContext dbc, CmsProject project, CmsProject onlineProject, CmsUUID principal) Removes all access control entries belonging to a principal.voidremoveAccessControlEntry(CmsDbContext dbc, CmsProject project, CmsUUID resource, CmsUUID principal) Removes an access control entry.voidremoveResourceFromOrganizationalUnit(CmsDbContext dbc, CmsOrganizationalUnit orgUnit, CmsResource resource) Removes a resource from the given organizational unit.searchUsers(CmsDbContext dbc, CmsUserSearchParameters searchParams) Searches for users which match the given search criteria.voidsetDriverManager(CmsDriverManager driverManager) Sets the driver manager for this driver if possible.voidsetSqlManager(CmsSqlManager sqlManager) Sets the SQL manager for this driver if possible.voidsetUsersOrganizationalUnit(CmsDbContext dbc, CmsOrganizationalUnit orgUnit, CmsUser user) Moves an user to the given organizational unit.voidwriteAccessControlEntry(CmsDbContext dbc, CmsProject project, CmsAccessControlEntry acEntry) Writes an access control entry.voidwriteGroup(CmsDbContext dbc, CmsGroup group) Writes an already existing group.voidwriteOrganizationalUnit(CmsDbContext dbc, CmsOrganizationalUnit organizationalUnit) Writes an already existing organizational unit.voidwritePassword(CmsDbContext dbc, String userFqn, String oldPassword, String newPassword) Sets a new password for a user.voidwriteUser(CmsDbContext dbc, CmsUser user) Updates the user information.voidwriteUserInfo(CmsDbContext dbc, CmsUUID userId, String key, Object value) Writes an user additional information entry.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.opencms.db.I_CmsDriver
toString
-
Field Details
-
ORGUNIT_BASE_FOLDER
The root path for organizational units.- See Also:
-
REQ_ATTR_DONT_DIGEST_PASSWORD
The internal request attribute to indicate that the password has not to be digested.- See Also:
-
m_digest
A digest to encrypt the passwords. -
m_digestAlgorithm
The algorithm used to encode passwords. -
m_digestFileEncoding
The file.encoding to code passwords after encryption with digest. -
m_driverManager
The driver manager. -
m_sqlManager
The SQL manager.
-
-
Constructor Details
-
CmsUserDriver
public CmsUserDriver()
-
-
Method Details
-
addResourceToOrganizationalUnit
public void addResourceToOrganizationalUnit(CmsDbContext dbc, CmsOrganizationalUnit orgUnit, CmsResource resource) throws CmsDataAccessException Description copied from interface:I_CmsUserDriverAdds a resource to the given organizational unit.- Specified by:
addResourceToOrganizationalUnitin interfaceI_CmsUserDriver- Parameters:
dbc- the current db contextorgUnit- the organizational unit to add the resource toresource- the resource that is to be added to the organizational unit- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
countUsers
public long countUsers(CmsDbContext dbc, CmsUserSearchParameters searchParams) throws CmsDataAccessException Description copied from interface:I_CmsUserDriverCounts the total number of users which match the given search criteria.- Specified by:
countUsersin interfaceI_CmsUserDriver- Parameters:
dbc- the database contextsearchParams- the search criteria- Returns:
- the number of users which match the search criteria
- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
createAccessControlEntry
public void createAccessControlEntry(CmsDbContext dbc, CmsProject project, CmsUUID resource, CmsUUID principal, int allowed, int denied, int flags) throws CmsDataAccessException Description copied from interface:I_CmsUserDriverCreates an access control entry.- Specified by:
createAccessControlEntryin interfaceI_CmsUserDriver- Parameters:
dbc- the current database contextproject- the project to write the entryresource- the id of the resourceprincipal- the id of the principal (user or group)allowed- the bitset of allowed permissionsdenied- the bitset of denied permissionsflags- flags- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
createGroup
public CmsGroup createGroup(CmsDbContext dbc, CmsUUID groupId, String groupFqn, String description, int flags, String parentGroupFqn) throws CmsDataAccessException Description copied from interface:I_CmsUserDriverCreates a new group.- Specified by:
createGroupin interfaceI_CmsUserDriver- Parameters:
dbc- the current database contextgroupId- the id of the new groupgroupFqn- the fully qualified name of the new groupdescription- The description for the new groupflags- the flags for the new groupparentGroupFqn- the name of the parent group (or null if the group has no parent)- Returns:
- the created group
- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
createOrganizationalUnit
public CmsOrganizationalUnit createOrganizationalUnit(CmsDbContext dbc, String name, String description, int flags, CmsOrganizationalUnit parent, String associatedResource) throws CmsDataAccessException Description copied from interface:I_CmsUserDriverCreates a new organizational unit.- Specified by:
createOrganizationalUnitin interfaceI_CmsUserDriver- Parameters:
dbc- the current db contextname- the name of the new organizational unitdescription- the description of the new organizational unitflags- the flags for the new organizational unitparent- the parent organizational unit (ornull)associatedResource- the first associated resource- Returns:
- a
object representing the newly created organizational unitCmsOrganizationalUnit - Throws:
CmsDataAccessException- if operation was not successful- See Also:
-
createRootOrganizationalUnit
Description copied from interface:I_CmsUserDriverCreates the default root organizational unit.- Specified by:
createRootOrganizationalUnitin interfaceI_CmsUserDriver- Parameters:
dbc- the current database context- See Also:
-
createUser
public CmsUser createUser(CmsDbContext dbc, CmsUUID id, String userFqn, String password, String firstname, String lastname, String email, long lastlogin, int flags, long dateCreated, Map<String, Object> additionalInfos) throws CmsDataAccessExceptionDescription copied from interface:I_CmsUserDriverCreates a new user.- Specified by:
createUserin interfaceI_CmsUserDriver- Parameters:
dbc- the current database contextid- the id of the useruserFqn- the fully qualified name of the new userpassword- the already encripted user passwordfirstname- the user firstnamelastname- the user lastnameemail- the user emaillastlogin- the user lastlogin timeflags- the user flagsdateCreated- the creation dateadditionalInfos- the user additional infos- Returns:
- the created user
- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
createUserInGroup
public void createUserInGroup(CmsDbContext dbc, CmsUUID userId, CmsUUID groupId) throws CmsDataAccessException Description copied from interface:I_CmsUserDriverAdds a user to a group.- Specified by:
createUserInGroupin interfaceI_CmsUserDriver- Parameters:
dbc- the current database contextuserId- the id of the user that is to be added to the groupgroupId- the id of the group- Throws:
CmsDataAccessException- if operation was not successful- See Also:
-
deleteGroup
Description copied from interface:I_CmsUserDriverDeletes a group.Only groups that contain no subgroups can be deleted.
- Specified by:
deleteGroupin interfaceI_CmsUserDriver- Parameters:
dbc- the current database contextgroupFqn- the fully qualified name of the group that is to be deleted- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
deleteOrganizationalUnit
public void deleteOrganizationalUnit(CmsDbContext dbc, CmsOrganizationalUnit organizationalUnit) throws CmsDataAccessException Description copied from interface:I_CmsUserDriverDeletes an organizational unit.Only organizational units that contain no suborganizational unit can be deleted.
- Specified by:
deleteOrganizationalUnitin interfaceI_CmsUserDriver- Parameters:
dbc- the current db contextorganizationalUnit- the organizational unit to delete- Throws:
CmsDataAccessException- if operation was not successful- See Also:
-
deleteUser
Description copied from interface:I_CmsUserDriverDeletes a user.- Specified by:
deleteUserin interfaceI_CmsUserDriver- Parameters:
dbc- the current database contextuserFqn- the fully qualified name of the user to delete- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
deleteUserInfos
Description copied from interface:I_CmsUserDriverDeletes the user additional information table.- Specified by:
deleteUserInfosin interfaceI_CmsUserDriver- Parameters:
dbc- the current database contextuserId- the id of the user to update- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
deleteUserInGroup
public void deleteUserInGroup(CmsDbContext dbc, CmsUUID userId, CmsUUID groupId) throws CmsDataAccessException Description copied from interface:I_CmsUserDriverRemoves a user from a group.- Specified by:
deleteUserInGroupin interfaceI_CmsUserDriver- Parameters:
dbc- the current database contextuserId- the id of the user that is to be removed from the groupgroupId- the id of the group- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
destroy
Description copied from interface:I_CmsUserDriverDestroys this driver.- Specified by:
destroyin interfaceI_CmsUserDriver- Throws:
Throwable- if something goes wrong- See Also:
-
existsGroup
Description copied from interface:I_CmsUserDriverTests if a group with the specified name exists.- Specified by:
existsGroupin interfaceI_CmsUserDriver- Parameters:
dbc- the current database contextgroupFqn- the fully qualified group name to be checked- Returns:
true, if a group with the specified name exists,falseotherwise- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
existsUser
Description copied from interface:I_CmsUserDriverTests if a user with the specified name exists.- Specified by:
existsUserin interfaceI_CmsUserDriver- Parameters:
dbc- the current database contextuserFqn- the fully qualified name of the user to be checked- Returns:
- true, if a user with the specified name exists, false otherwise
- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
fillDefaults
Description copied from interface:I_CmsUserDriverInitializes the default organizational units, users and groups.- Specified by:
fillDefaultsin interfaceI_CmsUserDriver- Parameters:
dbc- the current database context, be aware that this dbc has no runtime data!- Throws:
CmsInitException- if something goes wrong- See Also:
-
getGroups
public List<CmsGroup> getGroups(CmsDbContext dbc, CmsOrganizationalUnit orgUnit, boolean includeSubOus, boolean readRoles) throws CmsDataAccessException Description copied from interface:I_CmsUserDriverReturns all groups of the given organizational unit.- Specified by:
getGroupsin interfaceI_CmsUserDriver- Parameters:
dbc- the current db contextorgUnit- the organizational unit to get all groups forincludeSubOus- flag to signalize the retrieval of groups of sub-organizational units tooreadRoles- if to read roles or groups- Returns:
- all
objects in the organizational unitCmsGroup - Throws:
CmsDataAccessException- if operation was not successful- See Also:
-
getOrganizationalUnits
public List<CmsOrganizationalUnit> getOrganizationalUnits(CmsDbContext dbc, CmsOrganizationalUnit parent, boolean includeChildren) throws CmsDataAccessException Description copied from interface:I_CmsUserDriverReturns all child organizational units of the given parent organizational unit including hierarchical deeper organization units if needed.- Specified by:
getOrganizationalUnitsin interfaceI_CmsUserDriver- Parameters:
dbc- the current db contextparent- the parent organizational unit, ornullfor the rootincludeChildren- if hierarchical deeper organization units should also be returned- Returns:
- a list of
objectsCmsOrganizationalUnit - Throws:
CmsDataAccessException- if operation was not succesful- See Also:
-
getResourcesForOrganizationalUnit
public List<CmsResource> getResourcesForOrganizationalUnit(CmsDbContext dbc, CmsOrganizationalUnit orgUnit) throws CmsDataAccessException Description copied from interface:I_CmsUserDriverReturns all resources of the given organizational unit.- Specified by:
getResourcesForOrganizationalUnitin interfaceI_CmsUserDriver- Parameters:
dbc- the current db contextorgUnit- the organizational unit to get all resources for- Returns:
- all
objects in the organizational unitCmsResource - Throws:
CmsDataAccessException- if operation was not successful- See Also:
-
getSqlManager
Description copied from interface:I_CmsUserDriverReturns the SqlManager of this driver.- Specified by:
getSqlManagerin interfaceI_CmsUserDriver- Returns:
- the SqlManager of this driver
- See Also:
-
getUsers
public List<CmsUser> getUsers(CmsDbContext dbc, CmsOrganizationalUnit orgUnit, boolean recursive) throws CmsDataAccessException Description copied from interface:I_CmsUserDriverReturns all users of the given organizational unit.- Specified by:
getUsersin interfaceI_CmsUserDriver- Parameters:
dbc- the current db contextorgUnit- the organizational unit to get all users forrecursive- flag to signalize the retrieval of users of sub-organizational units too- Returns:
- all
objects in the organizational unitCmsUser - Throws:
CmsDataAccessException- if operation was not successful- See Also:
-
getUsersWithoutAdditionalInfo
public List<CmsUser> getUsersWithoutAdditionalInfo(CmsDbContext dbc, CmsOrganizationalUnit orgUnit, boolean recursive) throws CmsDataAccessException Description copied from interface:I_CmsUserDriverReturns all users of the given organizational unit, without reading their additional infos.- Specified by:
getUsersWithoutAdditionalInfoin interfaceI_CmsUserDriver- Parameters:
dbc- the current db contextorgUnit- the organizational unit to get all users forrecursive- flag to signalize the retrieval of users of sub-organizational units too- Returns:
- all
objects in the organizational unitCmsUser - Throws:
CmsDataAccessException- if operation was not successful- See Also:
-
init
public void init(CmsDbContext dbc, CmsConfigurationManager configurationManager, List<String> successiveDrivers, CmsDriverManager driverManager) Description copied from interface:I_CmsDriverInitializes the driver.- Specified by:
initin interfaceI_CmsDriver- Parameters:
dbc- the current database contextconfigurationManager- the configuration managersuccessiveDrivers- a list of successive drivers to be initializeddriverManager- the initialized OpenCms driver manager- See Also:
-
initSqlManager
Description copied from interface:I_CmsUserDriverInitializes the SQL manager for this driver.To obtain JDBC connections from different pools, further {online|offline|history} pool Urls have to be specified.
- Specified by:
initSqlManagerin interfaceI_CmsUserDriver- Parameters:
classname- the classname of the SQL manager- Returns:
- the SQL manager for this driver
- See Also:
-
publishAccessControlEntries
public void publishAccessControlEntries(CmsDbContext dbc, CmsProject offlineProject, CmsProject onlineProject, CmsUUID offlineId, CmsUUID onlineId) throws CmsDataAccessException Description copied from interface:I_CmsUserDriverPublish all access control entries of a resource from the given offline project to the online project.Within the given project, the resource is identified by its offlineId, in the online project, it is identified by the given onlineId.
- Specified by:
publishAccessControlEntriesin interfaceI_CmsUserDriver- Parameters:
dbc- the current database contextofflineProject- an offline projectonlineProject- the onlie projectofflineId- the offline resource idonlineId- the online resource id- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
readAccessControlEntries
public List<CmsAccessControlEntry> readAccessControlEntries(CmsDbContext dbc, CmsProject project, CmsUUID resource, boolean inheritedOnly) throws CmsDataAccessException Description copied from interface:I_CmsUserDriverReads all relevant access control entries for a given resource.- Specified by:
readAccessControlEntriesin interfaceI_CmsUserDriver- Parameters:
dbc- the current database contextproject- the project to write the entryresource- the id of the resourceinheritedOnly- flag to indicate that only inherited entries should be returned- Returns:
- a list of
objects defining all permissions for the given resourceCmsAccessControlEntry - Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
readAccessControlEntry
public CmsAccessControlEntry readAccessControlEntry(CmsDbContext dbc, CmsProject project, CmsUUID resource, CmsUUID principal) throws CmsDataAccessException Description copied from interface:I_CmsUserDriverReads an access control entry for a given principal that is attached to a resource.- Specified by:
readAccessControlEntryin interfaceI_CmsUserDriver- Parameters:
dbc- the current database contextproject- the project to write the entryresource- the id of the resourceprincipal- the id of the principal- Returns:
- an access control entry that defines the permissions of the principal for the given resource
- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
readChildGroups
public List<CmsGroup> readChildGroups(CmsDbContext dbc, String parentGroupFqn) throws CmsDataAccessException Description copied from interface:I_CmsUserDriverReads all child groups of a group.- Specified by:
readChildGroupsin interfaceI_CmsUserDriver- Parameters:
dbc- the current database contextparentGroupFqn- the fully qualified name of the group to read the child groups from- Returns:
- a list of all child
objects orCmsGroupnull - Throws:
CmsDataAccessException- if operation was not succesful- See Also:
-
readGroup
Description copied from interface:I_CmsUserDriverReads a group based on the group id.- Specified by:
readGroupin interfaceI_CmsUserDriver- Parameters:
dbc- the current database contextgroupId- the id of the group that is to be read- Returns:
- the group that was read
- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
readGroup
Description copied from interface:I_CmsUserDriverReads a group based on the group name.- Specified by:
readGroupin interfaceI_CmsUserDriver- Parameters:
dbc- the current database contextgroupFqn- the fully qualified name of the group that is to be read- Returns:
- the group that was read
- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
readGroupsOfUser
public List<CmsGroup> readGroupsOfUser(CmsDbContext dbc, CmsUUID userId, String ouFqn, boolean includeChildOus, String remoteAddress, boolean readRoles) throws CmsDataAccessException Description copied from interface:I_CmsUserDriverReads all groups the given user is a member in.- Specified by:
readGroupsOfUserin interfaceI_CmsUserDriver- Parameters:
dbc- the current database contextuserId- the id of the userouFqn- the fully qualified name of the organizational unit to restrict the result set forincludeChildOus- include groups of child organizational unitsremoteAddress- the IP address to filter the groups in the result listreadRoles- if to read roles or groups- Returns:
- a list of
objectsCmsGroup - Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
readOrganizationalUnit
public CmsOrganizationalUnit readOrganizationalUnit(CmsDbContext dbc, String ouFqn) throws CmsDataAccessException Description copied from interface:I_CmsUserDriverReads an organizational Unit based on its fully qualified name.- Specified by:
readOrganizationalUnitin interfaceI_CmsUserDriver- Parameters:
dbc- the current db contextouFqn- the fully qualified name of the organizational Unit to be read- Returns:
- the organizational Unit with the provided fully qualified name
- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
readUser
Description copied from interface:I_CmsUserDriverReads a user based on the user id.- Specified by:
readUserin interfaceI_CmsUserDriver- Parameters:
dbc- the current database contextid- the id of the user to read- Returns:
- the user that was read
- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
readUser
Description copied from interface:I_CmsUserDriverReads a user based in the user fully qualified name.- Specified by:
readUserin interfaceI_CmsUserDriver- Parameters:
dbc- the current database contextuserFqn- the fully qualified name of the user to read- Returns:
- the user that was read
- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
readUser
public CmsUser readUser(CmsDbContext dbc, String userFqn, String password, String remoteAddress) throws CmsDataAccessException Description copied from interface:I_CmsUserDriverReads a user from the database, only if the password is correct.- Specified by:
readUserin interfaceI_CmsUserDriver- Parameters:
dbc- the current database contextuserFqn- the name of the userpassword- the password of the userremoteAddress- the remote address of the request, may benull- Returns:
- the user that was read
- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
readUserInfos
public Map<String,Object> readUserInfos(CmsDbContext dbc, CmsUUID userId) throws CmsDataAccessException Description copied from interface:I_CmsUserDriverReads the user additional information map.- Specified by:
readUserInfosin interfaceI_CmsUserDriver- Parameters:
dbc- the current database contextuserId- the id of the user to update- Returns:
- the user additional information map
- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
readUsersOfGroup
public List<CmsUser> readUsersOfGroup(CmsDbContext dbc, String groupFqn, boolean includeOtherOuUsers) throws CmsDataAccessException Description copied from interface:I_CmsUserDriverReads all users that are members of the given group.- Specified by:
readUsersOfGroupin interfaceI_CmsUserDriver- Parameters:
dbc- the current database contextgroupFqn- the fully qualified name of the group to read the users fromincludeOtherOuUsers- include users of other organizational units- Returns:
- all
objects in the groupCmsUser - Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
removeAccessControlEntries
public void removeAccessControlEntries(CmsDbContext dbc, CmsProject project, CmsUUID resource) throws CmsDataAccessException Description copied from interface:I_CmsUserDriverRemoves all access control entries belonging to a resource.- Specified by:
removeAccessControlEntriesin interfaceI_CmsUserDriver- Parameters:
dbc- the current database contextproject- the project to write the entryresource- the id of the resource- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
removeAccessControlEntriesForPrincipal
public void removeAccessControlEntriesForPrincipal(CmsDbContext dbc, CmsProject project, CmsProject onlineProject, CmsUUID principal) throws CmsDataAccessException Description copied from interface:I_CmsUserDriverRemoves all access control entries belonging to a principal.- Specified by:
removeAccessControlEntriesForPrincipalin interfaceI_CmsUserDriver- Parameters:
dbc- the current database contextproject- the project to write the entryonlineProject- the online projectprincipal- the id of the principal- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
removeAccessControlEntry
public void removeAccessControlEntry(CmsDbContext dbc, CmsProject project, CmsUUID resource, CmsUUID principal) throws CmsDataAccessException Description copied from interface:I_CmsUserDriverRemoves an access control entry.- Specified by:
removeAccessControlEntryin interfaceI_CmsUserDriver- Parameters:
dbc- the current database contextproject- the project to write the entryresource- the id of the resourceprincipal- the id of the principal- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
removeResourceFromOrganizationalUnit
public void removeResourceFromOrganizationalUnit(CmsDbContext dbc, CmsOrganizationalUnit orgUnit, CmsResource resource) throws CmsDataAccessException Description copied from interface:I_CmsUserDriverRemoves a resource from the given organizational unit.- Specified by:
removeResourceFromOrganizationalUnitin interfaceI_CmsUserDriver- Parameters:
dbc- the current db contextorgUnit- the organizational unit to remove the resource fromresource- the resource that is to be removed from the organizational unit- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
searchUsers
public List<CmsUser> searchUsers(CmsDbContext dbc, CmsUserSearchParameters searchParams) throws CmsDataAccessException Description copied from interface:I_CmsUserDriverSearches for users which match the given search criteria.- Specified by:
searchUsersin interfaceI_CmsUserDriver- Parameters:
dbc- the database contextsearchParams- the search criteria- Returns:
- the users which match the given criteria
- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
setDriverManager
Description copied from interface:I_CmsUserDriverSets the driver manager for this driver if possible.- Specified by:
setDriverManagerin interfaceI_CmsUserDriver- Parameters:
driverManager- the new driver manager- See Also:
-
setSqlManager
Description copied from interface:I_CmsUserDriverSets the SQL manager for this driver if possible.- Specified by:
setSqlManagerin interfaceI_CmsUserDriver- Parameters:
sqlManager- the new SQL manager- See Also:
-
setUsersOrganizationalUnit
public void setUsersOrganizationalUnit(CmsDbContext dbc, CmsOrganizationalUnit orgUnit, CmsUser user) throws CmsDataAccessException Description copied from interface:I_CmsUserDriverMoves an user to the given organizational unit.- Specified by:
setUsersOrganizationalUnitin interfaceI_CmsUserDriver- Parameters:
dbc- the current db contextorgUnit- the organizational unit to move the user touser- the user that is to be moved to the given organizational unit- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
writeAccessControlEntry
public void writeAccessControlEntry(CmsDbContext dbc, CmsProject project, CmsAccessControlEntry acEntry) throws CmsDataAccessException Description copied from interface:I_CmsUserDriverWrites an access control entry.- Specified by:
writeAccessControlEntryin interfaceI_CmsUserDriver- Parameters:
dbc- the current database contextproject- the project to write the entryacEntry- the entry to write- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
writeGroup
Description copied from interface:I_CmsUserDriverWrites an already existing group.The group id has to be a valid OpenCms group id.
The group with the given id will be completely overriden by the given data.- Specified by:
writeGroupin interfaceI_CmsUserDriver- Parameters:
dbc- the current database contextgroup- the group to update- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
writeOrganizationalUnit
public void writeOrganizationalUnit(CmsDbContext dbc, CmsOrganizationalUnit organizationalUnit) throws CmsDataAccessException Description copied from interface:I_CmsUserDriverWrites an already existing organizational unit.The organizational unit id has to be a valid OpenCms organizational unit id.
The organizational unit with the given id will be completely overriden by the given data.- Specified by:
writeOrganizationalUnitin interfaceI_CmsUserDriver- Parameters:
dbc- the current db contextorganizationalUnit- the organizational unit that should be written- Throws:
CmsDataAccessException- if operation was not successful- See Also:
-
writePassword
public void writePassword(CmsDbContext dbc, String userFqn, String oldPassword, String newPassword) throws CmsDataAccessException, CmsPasswordEncryptionException Description copied from interface:I_CmsUserDriverSets a new password for a user.- Specified by:
writePasswordin interfaceI_CmsUserDriver- Parameters:
dbc- the current database contextuserFqn- the fullyqualified name of the user to set the password foroldPassword- the current passwordnewPassword- the password to set- Throws:
CmsDataAccessException- if something goes wrongCmsPasswordEncryptionException- if the (new) password could not be encrypted- See Also:
-
writeUser
Description copied from interface:I_CmsUserDriverUpdates the user information.The user id has to be a valid OpenCms user id.
The user with the given id will be completely overriden by the given data.
- Specified by:
writeUserin interfaceI_CmsUserDriver- Parameters:
dbc- the current database contextuser- the user to update- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
writeUserInfo
public void writeUserInfo(CmsDbContext dbc, CmsUUID userId, String key, Object value) throws CmsDataAccessException Description copied from interface:I_CmsUserDriverWrites an user additional information entry.- Specified by:
writeUserInfoin interfaceI_CmsUserDriver- Parameters:
dbc- the current database contextuserId- the id of the user to updatekey- the key of the info to writevalue- the value of the info to write- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
createRoleQuery
Returns a sql query to select groups.- Parameters:
mainQuery- the main select sql queryincludeSubOus- if groups in sub-ous should be included in the selectionreadRoles- if groups or roles whould be selected- Returns:
- a sql query to select groups
-
createUserQuery
protected CmsPair<String,List<Object>> createUserQuery(CmsUserSearchParameters searchParams, boolean countOnly) Creates a query for searching users.- Parameters:
searchParams- the user search criteriacountOnly- if true, the query will only count the total number of results instead of returning them- Returns:
- a pair consisting of the query string and its parameters
-
createUserQueryBuilder
Creates a new user query builder.- Returns:
- the new user query builder
-
internalCreateAce
Internal helper method to create an access control entry from a database record.- Parameters:
res- resultset of the current query- Returns:
- a new
CmsAccessControlEntryinitialized with the values from the current database record - Throws:
SQLException- if something goes wrong
-
internalCreateAce
Internal helper method to create an access control entry from a database record.- Parameters:
res- resultset of the current querynewId- the id of the new access control entry- Returns:
- a new
CmsAccessControlEntryinitialized with the values from the current database record - Throws:
SQLException- if something goes wrong
-
internalCreateDefaultGroups
protected void internalCreateDefaultGroups(CmsDbContext dbc, String ouFqn, String ouDescription, boolean webuser) throws CmsException Creates the default groups and user for the given organizational unit.- Parameters:
dbc- the database contextouFqn- the fully qualified name of the organizational unit to create the principals forouDescription- the description of the given organizational unitwebuser- the webuser ou flag- Throws:
CmsException- if something goes wrong
-
internalCreateGroup
Semi-constructor to create aCmsGroupinstance from a JDBC result set.- Parameters:
res- the JDBC ResultSet- Returns:
- CmsGroup the new CmsGroup object
- Throws:
SQLException- in case the result set does not include a requested table attribute
-
internalCreateOrgUnitFromResource
protected CmsOrganizationalUnit internalCreateOrgUnitFromResource(CmsDbContext dbc, CmsResource resource) throws CmsException Returns the organizational unit represented by the given resource.- Parameters:
dbc- the current db contextresource- the resource that represents an organizational unit- Returns:
- the organizational unit represented by the given resource
- Throws:
CmsException- if something goes wrong
-
internalCreateResourceForOrgUnit
protected CmsResource internalCreateResourceForOrgUnit(CmsDbContext dbc, String path, int flags) throws CmsException Creates a folder with the given path an properties, offline AND online.- Parameters:
dbc- the current database contextpath- the path to create the folderflags- the resource flags- Returns:
- the new created offline folder
- Throws:
CmsException- if something goes wrong
-
internalCreateUser
Semi-constructor to create aCmsUserinstance from a JDBC result set.- Parameters:
dbc- the current database contextres- the JDBC ResultSet- Returns:
- the new CmsUser object
- Throws:
SQLException- in case the result set does not include a requested table attribute
-
internalDeleteOrgUnitResource
protected void internalDeleteOrgUnitResource(CmsDbContext dbc, CmsResource resource) throws CmsException Deletes a resource representing a organizational unit, offline AND online.- Parameters:
dbc- the current database contextresource- the resource to delete- Throws:
CmsException- if something goes wrong
-
internalDeleteUserInfo
protected void internalDeleteUserInfo(CmsDbContext dbc, CmsUUID userId, String key) throws CmsDataAccessException Deletes an additional user info.- Parameters:
dbc- the current dbcuserId- the user to delete additional info fromkey- the additional info to delete- Throws:
CmsDataAccessException- if something goes wrong
-
internalGetUsers
protected List<CmsUser> internalGetUsers(CmsDbContext dbc, CmsOrganizationalUnit orgUnit, boolean recursive, boolean readAdditionalInfos) throws CmsDataAccessException Internal implementation for reading users of an OU, with or without additional infos.- Parameters:
dbc- the database contextorgUnit- the OUrecursive- if true, sub-OUs should be searchedreadAdditionalInfos- if true, additional infos should be read- Returns:
- the users which have been read
- Throws:
CmsDataAccessException- if something goes wrong
-
internalOrgUnitFolder
protected CmsResource internalOrgUnitFolder(CmsDbContext dbc, CmsOrganizationalUnit orgUnit) throws CmsException Returns the folder for the given organizational units, or the base folder ifnull.The base folder will be created if it does not exist.
- Parameters:
dbc- the current db contextorgUnit- the organizational unit to get the folder for- Returns:
- the base folder for organizational units
- Throws:
CmsException- if something goes wrong
-
internalResourcesForOrgUnit
protected List<String> internalResourcesForOrgUnit(CmsDbContext dbc, CmsResource ouResource) throws CmsException Returns the list of root paths associated to the organizational unit represented by the given resource.- Parameters:
dbc- the current db contextouResource- the resource that represents the organizational unit to get the resources for- Returns:
- the list of associated resource names
- Throws:
CmsException- if something goes wrong
-
internalUpdateRoleGroup
protected void internalUpdateRoleGroup(CmsDbContext dbc, String groupName, CmsRole role) throws CmsDataAccessException Updates a group to a virtual group.- Parameters:
dbc- the database contextgroupName- the name of the group to updaterole- the role for this group- Throws:
CmsDataAccessException- if something goes wrong
-
internalUpdateUserInfo
protected void internalUpdateUserInfo(CmsDbContext dbc, CmsUUID userId, String key, Object value) throws CmsDataAccessException Updates additional user info.- Parameters:
dbc- the current dbcuserId- the user id to add the user info forkey- the name of the additional user infovalue- the value of the additional user info- Throws:
CmsDataAccessException- if something goes wrong
-
internalValidateResourceForOrgUnit
protected void internalValidateResourceForOrgUnit(CmsDbContext dbc, CmsOrganizationalUnit orgUnit, String rootPath) throws CmsException Validates the given root path to be in the scope of the resources of the given organizational unit.- Parameters:
dbc- the current db contextorgUnit- the organizational unitrootPath- the root path to check- Throws:
CmsException- if something goes wrong
-
internalValidateUserInGroup
protected boolean internalValidateUserInGroup(CmsDbContext dbc, CmsUUID userId, CmsUUID groupId) throws CmsDataAccessException Checks if a user is member of a group.- Parameters:
dbc- the database contextuserId- the id of the user to checkgroupId- the id of the group to check- Returns:
- true if user is member of group
- Throws:
CmsDataAccessException- if operation was not succesful
-
internalWriteOrgUnitProperty
protected void internalWriteOrgUnitProperty(CmsDbContext dbc, CmsResource resource, CmsProperty property) throws CmsException Writes a property for an organizational unit resource, online AND offline.- Parameters:
dbc- the current database contextresource- the resource representing the organizational unitproperty- the property to write- Throws:
CmsException- if something goes wrong
-
internalWriteUserInfo
protected void internalWriteUserInfo(CmsDbContext dbc, CmsUUID userId, String key, Object value) throws CmsDataAccessException Writes a new additional user info.- Parameters:
dbc- the current dbcuserId- the user id to add the user info forkey- the name of the additional user infovalue- the value of the additional user info- Throws:
CmsDataAccessException- if something goes wrong
-
internalWriteUserInfos
protected void internalWriteUserInfos(CmsDbContext dbc, CmsUUID userId, Map<String, Object> additionalInfo) throws CmsDataAccessExceptionUpdates the user additional information map.- Parameters:
dbc- the current database contextuserId- the id of the user to updateadditionalInfo- the info to write- Throws:
CmsDataAccessException- if user data could not be written
-