public final class CmsSecurityManager extends java.lang.Object
The security manager checks the permissions required for a user action invoke by the Cms object. If permissions are granted, the security manager invokes a method on the OpenCms driver manager to access the database.
Modifier and Type | Field and Description |
---|---|
protected I_CmsDbContextFactory |
m_dbContextFactory
The factory to create runtime info objects.
|
protected CmsDriverManager |
m_driverManager
The initialized OpenCms driver manager to access the database.
|
Modifier and Type | Method and Description |
---|---|
void |
addAlias(CmsRequestContext context,
CmsAlias alias)
Adds an alias.
|
void |
addRelationToResource(CmsRequestContext context,
CmsResource resource,
CmsResource target,
CmsRelationType type,
boolean importCase)
Adds a new relation to a given resource.
|
void |
addResourceToOrgUnit(CmsRequestContext context,
CmsOrganizationalUnit orgUnit,
CmsResource resource)
Adds a resource to the given organizational unit.
|
void |
addUserToGroup(CmsRequestContext context,
java.lang.String username,
java.lang.String groupname,
boolean readRoles)
Adds a user to a group.
|
void |
changeLock(CmsRequestContext context,
CmsResource resource)
Changes the lock of a resource to the current user, that is "steals" the lock from another user.
|
java.util.List<CmsResource> |
changeResourcesInFolderWithProperty(CmsRequestContext context,
CmsResource resource,
java.lang.String propertyDefinition,
java.lang.String oldValue,
java.lang.String newValue,
boolean recursive)
Returns a list with all sub resources of a given folder that have set the given property,
matching the current property's value with the given old value and replacing it by a given new value.
|
void |
checkManagerOfProjectRole(CmsDbContext dbc,
CmsProject project)
Checks if the current user has management access to the given project.
|
void |
checkOfflineProject(CmsDbContext dbc)
Checks if the project in the given database context is not the "Online" project,
and throws an Exception if this is the case.
|
protected void |
checkPermissions(CmsDbContext dbc,
CmsResource resource,
CmsPermissionSet requiredPermissions,
boolean checkLock,
CmsResourceFilter filter)
Performs a blocking permission check on a resource.
|
void |
checkPermissions(CmsRequestContext context,
CmsResource resource,
CmsPermissionSet requiredPermissions,
boolean checkLock,
CmsResourceFilter filter)
Performs a blocking permission check on a resource.
|
protected void |
checkPermissions(CmsRequestContext context,
CmsResource resource,
CmsPermissionSet requiredPermissions,
I_CmsPermissionHandler.CmsPermissionCheckResult permissions)
Applies the permission check result of a previous call
to
hasPermissions(CmsRequestContext, CmsResource, CmsPermissionSet, boolean, CmsResourceFilter) . |
void |
checkPublishPermissions(CmsDbContext dbc,
CmsPublishList publishList)
Checks if the current user has the permissions to publish the given publish list
(which contains the information about the resources / project to publish).
|
void |
checkRole(CmsDbContext dbc,
CmsRole role)
Checks if the user of the current database context has permissions to impersonate the given role
in the given organizational unit.
|
void |
checkRole(CmsRequestContext context,
CmsRole role)
Checks if the user of the current context has permissions to impersonate the given role.
|
void |
checkRoleForResource(CmsDbContext dbc,
CmsRole role,
CmsResource resource)
Checks if the user of the current database context has permissions to impersonate the given role
for the given resource.
|
void |
checkRoleForResource(CmsRequestContext context,
CmsRole role,
CmsResource resource)
Checks if the user of the current context has permissions to impersonate the given role
for the given resource.
|
protected void |
checkRoleForUserModification(CmsDbContext dbc,
java.lang.String username,
CmsRole role)
Checks that the current user has enough permissions to modify the given user.
|
protected void |
checkSystemLocks(CmsDbContext dbc,
CmsResource resource)
Checks if the given resource contains a resource that has a system lock.
|
void |
chflags(CmsRequestContext context,
CmsResource resource,
int flags)
Changes the resource flags of a resource.
|
void |
chtype(CmsRequestContext context,
CmsResource resource,
int type)
Changes the resource type of a resource.
|
void |
copyAccessControlEntries(CmsRequestContext context,
CmsResource source,
CmsResource destination)
Copies the access control entries of a given resource to a destination resource.
|
void |
copyResource(CmsRequestContext context,
CmsResource source,
java.lang.String destination,
CmsResource.CmsResourceCopyMode siblingMode)
Copies a resource.
|
void |
copyResourceToProject(CmsRequestContext context,
CmsResource resource)
Copies a resource to the current project of the user.
|
int |
countLockedResources(CmsRequestContext context,
CmsUUID id)
Counts the locked resources in this project.
|
long |
countUsers(CmsRequestContext requestContext,
CmsUserSearchParameters searchParams)
Counts the total number of users which match the given search criteria.
|
CmsGroup |
createGroup(CmsRequestContext context,
java.lang.String name,
java.lang.String description,
int flags,
java.lang.String parent)
Creates a new user group.
|
CmsOrganizationalUnit |
createOrganizationalUnit(CmsRequestContext context,
java.lang.String ouFqn,
java.lang.String description,
int flags,
CmsResource resource)
Creates a new organizational unit.
|
CmsProject |
createProject(CmsRequestContext context,
java.lang.String name,
java.lang.String description,
java.lang.String groupname,
java.lang.String managergroupname,
CmsProject.CmsProjectType projecttype)
Creates a project.
|
CmsPropertyDefinition |
createPropertyDefinition(CmsRequestContext context,
java.lang.String name)
Creates a property definition.
|
CmsResource |
createResource(CmsRequestContext context,
java.lang.String resourcePath,
CmsResource resource,
byte[] content,
java.util.List<CmsProperty> properties)
Creates a new resource with the provided content and properties.
|
CmsResource |
createResource(CmsRequestContext context,
java.lang.String resourcename,
int type,
byte[] content,
java.util.List<CmsProperty> properties)
Creates a new resource of the given resource type with the provided content and properties.
|
CmsResource |
createSibling(CmsRequestContext context,
CmsResource source,
java.lang.String destination,
java.util.List<CmsProperty> properties)
Creates a new sibling of the source resource.
|
CmsProject |
createTempfileProject(CmsRequestContext context)
Creates the project for the temporary workplace files.
|
CmsUser |
createUser(CmsRequestContext context,
java.lang.String name,
java.lang.String password,
java.lang.String description,
java.util.Map<java.lang.String,java.lang.Object> additionalInfos)
Creates a new user.
|
void |
deleteAliases(CmsRequestContext context,
CmsAliasFilter filter)
Deletes alias entries matching a filter.
|
void |
deleteAllStaticExportPublishedResources(CmsRequestContext context,
int linkType)
Deletes all entries in the published resource table.
|
void |
deleteGroup(CmsRequestContext context,
CmsUUID groupId,
CmsUUID replacementId)
Deletes a group, where all permissions, users and children of the group
are transfered to a replacement group.
|
void |
deleteGroup(CmsRequestContext context,
java.lang.String name)
Delete a user group.
|
void |
deleteHistoricalVersions(CmsRequestContext context,
int versionsToKeep,
int versionsDeleted,
long timeDeleted,
I_CmsReport report)
Deletes the versions from the history tables, keeping the given number of versions per resource.
|
void |
deleteLogEntries(CmsRequestContext context,
CmsLogFilter filter)
Deletes all log entries matching the given filter.
|
void |
deleteOrganizationalUnit(CmsRequestContext context,
CmsOrganizationalUnit organizationalUnit)
Deletes an organizational unit.
|
void |
deleteProject(CmsRequestContext context,
CmsUUID projectId)
Deletes a project.
|
void |
deletePropertyDefinition(CmsRequestContext context,
java.lang.String name)
Deletes a property definition.
|
void |
deleteRelationsForResource(CmsRequestContext context,
CmsResource resource,
CmsRelationFilter filter)
Deletes all relations for the given resource matching the given filter.
|
protected void |
deleteResource(CmsDbContext dbc,
CmsResource resource,
CmsResource.CmsResourceDeleteMode siblingMode)
Internal recursive method for deleting a resource.
|
void |
deleteResource(CmsRequestContext context,
CmsResource resource,
CmsResource.CmsResourceDeleteMode siblingMode)
Deletes a resource given its name.
|
void |
deleteStaticExportPublishedResource(CmsRequestContext context,
java.lang.String resourceName,
int linkType,
java.lang.String linkParameter)
Deletes an entry in the published resource table.
|
protected void |
deleteUser(CmsRequestContext context,
CmsUser user,
CmsUser replacement)
Deletes a user, where all permissions and resources attributes of the user
were transfered to a replacement user, if given.
|
void |
deleteUser(CmsRequestContext context,
CmsUUID userId)
Deletes a user.
|
void |
deleteUser(CmsRequestContext context,
CmsUUID userId,
CmsUUID replacementId)
Deletes a user, where all permissions and resources attributes of the user
were transfered to a replacement user.
|
void |
deleteUser(CmsRequestContext context,
java.lang.String username)
Deletes a user.
|
void |
destroy()
Destroys this security manager.
|
boolean |
existsResource(CmsRequestContext context,
CmsUUID structureId,
CmsResourceFilter filter)
Checks the availability of a resource in the VFS,
using the
filter. |
boolean |
existsResource(CmsRequestContext context,
java.lang.String resourcePath,
CmsResourceFilter filter)
Checks the availability of a resource in the VFS,
using the
filter. |
CmsPublishList |
fillPublishList(CmsRequestContext context,
CmsPublishList publishList)
Fills the given publish list with the the VFS resources that actually get published.
|
java.util.List<CmsAccessControlEntry> |
getAccessControlEntries(CmsRequestContext context,
CmsResource resource,
boolean getInherited)
Returns the list of access control entries of a resource given its name.
|
CmsAccessControlList |
getAccessControlList(CmsRequestContext context,
CmsResource resource,
boolean inheritedOnly)
Returns the access control list (summarized access control entries) of a given resource.
|
java.util.List<CmsAlias> |
getAliasesForSite(CmsRequestContext requestContext,
java.lang.String siteRoot)
Gets the aliases for a given site.
|
java.util.List<CmsAccessControlEntry> |
getAllAccessControlEntries(CmsRequestContext context)
Gets all access control entries.
|
java.util.List<CmsProject> |
getAllAccessibleProjects(CmsRequestContext context,
CmsOrganizationalUnit orgUnit,
boolean includeSubOus)
Returns all projects which are owned by the current user or which are
accessible for the group of the user.
|
java.util.List<CmsHistoryProject> |
getAllHistoricalProjects(CmsRequestContext context)
Returns a list with all projects from history.
|
java.util.List<CmsProject> |
getAllManageableProjects(CmsRequestContext context,
CmsOrganizationalUnit orgUnit,
boolean includeSubOus)
Returns all projects which are owned by the current user or which are manageable
for the group of the user.
|
java.util.List<CmsGroup> |
getChildren(CmsRequestContext context,
java.lang.String groupname,
boolean includeSubChildren)
Returns all child groups of a group.
|
long |
getDateLastVisitedBy(CmsRequestContext context,
java.lang.String poolName,
CmsUser user,
CmsResource resource)
Returns the date when the resource was last visited by the user.
|
java.util.List<CmsGroup> |
getGroups(CmsRequestContext context,
CmsOrganizationalUnit orgUnit,
boolean includeSubOus,
boolean readRoles)
Returns all groups of the given organizational unit.
|
java.util.List<CmsGroup> |
getGroupsOfUser(CmsRequestContext context,
java.lang.String username,
java.lang.String ouFqn,
boolean includeChildOus,
boolean readRoles,
boolean directGroupsOnly,
java.lang.String remoteAddress)
Returns the list of groups to which the user directly belongs to.
|
CmsLock |
getLock(CmsRequestContext context,
CmsResource resource)
Returns the lock state of a resource.
|
java.util.List<java.lang.String> |
getLockedResources(CmsRequestContext context,
CmsResource resource,
CmsLockFilter filter)
Returns all locked resources in a given folder.
|
java.util.List<CmsResource> |
getLockedResourcesObjects(CmsRequestContext context,
CmsResource resource,
CmsLockFilter filter)
Returns all locked resources in a given folder.
|
java.util.List<CmsResource> |
getLockedResourcesObjectsWithCache(CmsRequestContext context,
CmsResource resource,
CmsLockFilter filter,
java.util.Map<java.lang.String,CmsResource> cache)
Returns all locked resources in a given folder, but uses a cache for resource lookups.
|
CmsLockManager |
getLockManager()
Returns the lock manger.
|
java.util.List<CmsLogEntry> |
getLogEntries(CmsRequestContext context,
CmsLogFilter filter)
Returns all log entries matching the given filter.
|
protected java.util.List<CmsResource> |
getManageableResources(CmsDbContext dbc,
CmsRole role)
Returns all resources of organizational units for which the current user has
the given role role.
|
java.util.List<CmsResource> |
getManageableResources(CmsRequestContext context,
CmsRole role)
Returns all resources of organizational units for which the current user has
the given role role.
|
java.util.List<CmsOrganizationalUnit> |
getOrganizationalUnits(CmsRequestContext context,
CmsOrganizationalUnit parent,
boolean includeChildren)
Returns all child organizational units of the given parent organizational unit including
hierarchical deeper organization units if needed.
|
java.util.List<CmsOrganizationalUnit> |
getOrgUnitsForRole(CmsRequestContext requestContext,
CmsRole role,
boolean includeSubOus)
Returns all the organizational units for which the current user has the given role.
|
CmsGroup |
getParent(CmsRequestContext context,
java.lang.String groupname)
Returns the parent group of a group.
|
protected java.lang.String |
getParentOrganizationalUnit(java.lang.String fqn)
Returns the organizational unit for the parent of the given fully qualified name.
|
CmsPermissionSetCustom |
getPermissions(CmsRequestContext context,
CmsResource resource,
CmsUser user)
Returns the set of permissions of the current user for a given resource.
|
CmsUUID |
getProjectId(CmsRequestContext context,
int id)
Returns the uuid id for the given id,
remove this method as soon as possible.
|
CmsPublishList |
getRelatedResourcesToPublish(CmsRequestContext context,
CmsPublishList publishList,
CmsRelationFilter filter)
Returns a new publish list that contains the unpublished resources related
to all resources in the given publish list, the related resources exclude
all resources in the given publish list and also locked (by other users) resources.
|
java.util.List<CmsRelation> |
getRelationsForResource(CmsRequestContext context,
CmsResource resource,
CmsRelationFilter filter)
Returns all relations for the given resource matching the given filter.
|
java.util.List<CmsResource> |
getResourcesForOrganizationalUnit(CmsRequestContext context,
CmsOrganizationalUnit orgUnit)
Returns all resources of the given organizational unit.
|
java.util.Set<CmsResource> |
getResourcesForPrincipal(CmsRequestContext context,
CmsUUID principalId,
CmsPermissionSet permissions,
boolean includeAttr)
Returns all resources associated to a given principal via an ACE with the given permissions.
|
java.util.List<CmsRewriteAlias> |
getRewriteAliases(CmsRequestContext requestContext,
CmsRewriteAliasFilter filter)
Gets the rewrite aliases matching a given filter.
|
java.util.Set<CmsGroup> |
getRoleGroups(CmsRequestContext context,
CmsRole role,
boolean directUsersOnly)
Gets the groups which constitute a given role.
|
java.util.List<CmsRole> |
getRolesForResource(CmsRequestContext context,
CmsUser user,
CmsResource resource)
Returns all roles the given user has for the given resource.
|
CmsSqlManager |
getSqlManager()
Returns an instance of the common sql manager.
|
java.util.List<CmsUser> |
getUsers(CmsRequestContext context,
CmsOrganizationalUnit orgUnit,
boolean recursive)
Returns all users of the given organizational unit.
|
java.util.List<CmsUser> |
getUsersOfGroup(CmsRequestContext context,
java.lang.String groupname,
boolean includeOtherOuUsers,
boolean directUsersOnly,
boolean readRoles)
Returns a list of users in a group.
|
java.util.List<CmsResource> |
getUsersPubList(CmsRequestContext context)
Returns the current user's publish list.
|
java.util.List<CmsUser> |
getUsersWithoutAdditionalInfo(CmsRequestContext context,
CmsOrganizationalUnit orgUnit,
boolean recursive)
Returns all users of the given organizational unit.
|
protected I_CmsPermissionHandler.CmsPermissionCheckResult |
hasPermissions(CmsDbContext dbc,
CmsResource resource,
CmsPermissionSet requiredPermissions,
boolean checkLock,
CmsResourceFilter filter)
Performs a non-blocking permission check on a resource.
|
I_CmsPermissionHandler.CmsPermissionCheckResult |
hasPermissions(CmsRequestContext context,
CmsResource resource,
CmsPermissionSet requiredPermissions,
boolean checkLock,
CmsResourceFilter filter)
Performs a non-blocking permission check on a resource.
|
boolean |
hasRole(CmsDbContext dbc,
CmsUser user,
CmsRole role)
Checks if the given user has the given role in the given organizational unit.
|
boolean |
hasRole(CmsRequestContext context,
CmsUser user,
CmsRole role)
Checks if the given user has the given role in the given organizational unit.
|
protected boolean |
hasRole(CmsRole role,
java.util.List<CmsGroup> roles)
Returns
true if at least one of the given group names is equal to a group name
of the given role in the given organizational unit. |
boolean |
hasRoleForResource(CmsDbContext dbc,
CmsUser user,
CmsRole role,
CmsResource resource)
Checks if the given user has the given role for the given resource.
|
boolean |
hasRoleForResource(CmsRequestContext context,
CmsUser user,
CmsRole role,
CmsResource resource)
Checks if the given user has the given role for the given resource.
|
void |
importAccessControlEntries(CmsRequestContext context,
CmsResource resource,
java.util.List<CmsAccessControlEntry> acEntries)
Writes a list of access control entries as new access control entries of a given resource.
|
CmsResource |
importResource(CmsRequestContext context,
java.lang.String resourcePath,
CmsResource resource,
byte[] content,
java.util.List<CmsProperty> properties,
boolean importCase)
Creates a new resource with the provided content and properties.
|
CmsAliasImportResult |
importRewriteAlias(CmsRequestContext requestContext,
java.lang.String siteRoot,
java.lang.String source,
java.lang.String target,
CmsAliasMode mode)
Imports a rewrite alias.
|
CmsUser |
importUser(CmsRequestContext context,
java.lang.String id,
java.lang.String name,
java.lang.String password,
java.lang.String firstname,
java.lang.String lastname,
java.lang.String email,
int flags,
long dateCreated,
java.util.Map<java.lang.String,java.lang.Object> additionalInfos)
Creates a new user by import.
|
int |
incrementCounter(CmsRequestContext context,
java.lang.String name)
Increments a counter and returns its old value.
|
void |
init(CmsConfigurationManager configurationManager,
I_CmsDbContextFactory dbContextFactory,
CmsPublishEngine publishEngine)
Initializes this security manager with a given runtime info factory.
|
void |
initializeOrgUnit(CmsRequestContext context,
CmsOrganizationalUnit ou)
Initializes the default groups for an organizational unit.
|
boolean |
isInsideCurrentProject(CmsRequestContext context,
java.lang.String resourcename)
Checks if the specified resource is inside the current project.
|
boolean |
isManagerOfProject(CmsRequestContext context)
Checks if the current user has management access to the current project.
|
boolean |
isSubscriptionDriverAvailable()
Checks whether the subscription driver is available.
|
void |
lockResource(CmsRequestContext context,
CmsResource resource,
CmsLockType type)
Locks a resource.
|
CmsUser |
loginUser(CmsRequestContext context,
java.lang.String username,
java.lang.String password,
java.lang.String remoteAddress)
Attempts to authenticate a user into OpenCms with the given password.
|
I_CmsPrincipal |
lookupPrincipal(CmsRequestContext context,
CmsUUID principalId)
Lookup and read the user or group with the given UUID.
|
I_CmsPrincipal |
lookupPrincipal(CmsRequestContext context,
java.lang.String principalName)
Lookup and read the user or group with the given name.
|
void |
markResourceAsVisitedBy(CmsRequestContext context,
java.lang.String poolName,
CmsResource resource,
CmsUser user)
Mark the given resource as visited by the user.
|
CmsPublishList |
mergePublishLists(CmsRequestContext context,
CmsPublishList pubList1,
CmsPublishList pubList2)
Returns a new publish list that contains all resources of both given publish lists.
|
protected void |
moveResource(CmsDbContext dbc,
CmsResource source,
java.lang.String destination)
Internal recursive method to move a resource.
|
void |
moveResource(CmsRequestContext context,
CmsResource source,
java.lang.String destination)
Moves a resource.
|
java.lang.String |
moveToLostAndFound(CmsRequestContext context,
CmsResource resource,
boolean returnNameOnly)
Moves a resource to the "lost and found" folder.
|
static CmsSecurityManager |
newInstance(CmsConfigurationManager configurationManager,
I_CmsDbContextFactory runtimeInfoFactory,
CmsPublishEngine publishEngine)
Creates a new instance of the OpenCms security manager.
|
CmsUUID |
publishProject(CmsObject cms,
CmsPublishList publishList,
I_CmsReport report)
Publishes the resources of a specified publish list.
|
CmsAlias |
readAliasByPath(CmsRequestContext context,
java.lang.String siteRoot,
java.lang.String path)
Reads the alias with a given path in a given site.
|
java.util.List<CmsAlias> |
readAliasesById(CmsRequestContext context,
CmsUUID structureId)
Reads the aliases for a resource with a given structure id.
|
java.util.List<I_CmsHistoryResource> |
readAllAvailableVersions(CmsRequestContext context,
CmsResource resource)
Reads all historical versions of a resource.
|
java.util.List<CmsPropertyDefinition> |
readAllPropertyDefinitions(CmsRequestContext context)
Reads all property definitions for the given mapping type.
|
java.util.List<CmsResource> |
readAllSubscribedResources(CmsRequestContext context,
java.lang.String poolName,
CmsPrincipal principal)
Returns all resources subscribed by the given user or group.
|
java.util.List<java.lang.String> |
readAllUrlNameMappingEntries(CmsRequestContext context,
CmsUUID id)
Reads all URL name mapping entries for a given structure id.
|
CmsFolder |
readAncestor(CmsRequestContext context,
CmsResource resource,
CmsResourceFilter filter)
Returns the first ancestor folder matching the filter criteria.
|
java.lang.String |
readBestUrlName(CmsRequestContext context,
CmsUUID id,
java.util.Locale locale,
java.util.List<java.util.Locale> defaultLocales)
Reads the newest URL name which is mapped to the given structure id.
|
java.util.List<CmsResource> |
readChildResources(CmsRequestContext context,
CmsResource resource,
CmsResourceFilter filter,
boolean getFolders,
boolean getFiles)
Returns the child resources of a resource, that is the resources
contained in a folder.
|
CmsResource |
readDefaultFile(CmsRequestContext context,
CmsResource resource,
CmsResourceFilter resourceFilter)
Returns the default file for the given folder.
|
java.util.List<I_CmsHistoryResource> |
readDeletedResources(CmsRequestContext context,
CmsResource resource,
boolean readTree)
Reads all deleted (historical) resources below the given path,
including the full tree below the path, if required.
|
CmsFile |
readFile(CmsRequestContext context,
CmsResource resource)
Reads a file resource (including it's binary content) from the VFS.
|
protected CmsFolder |
readFolder(CmsDbContext dbc,
java.lang.String resourcename,
CmsResourceFilter filter)
Reads a folder from the VFS, using the specified resource filter.
|
CmsFolder |
readFolder(CmsRequestContext context,
java.lang.String resourcename,
CmsResourceFilter filter)
Reads a folder resource from the VFS,
using the specified resource filter.
|
CmsGroup |
readGroup(CmsRequestContext context,
CmsProject project)
Reads the group of a project.
|
CmsGroup |
readGroup(CmsRequestContext context,
CmsUUID groupId)
Reads a group based on its id.
|
CmsGroup |
readGroup(CmsRequestContext context,
java.lang.String groupname)
Reads a group based on its name.
|
CmsHistoryPrincipal |
readHistoricalPrincipal(CmsRequestContext context,
CmsUUID principalId)
Reads a principal (an user or group) from the historical archive based on its ID.
|
CmsHistoryProject |
readHistoryProject(CmsRequestContext context,
CmsUUID projectId)
Returns the latest historical project entry with the given id.
|
CmsHistoryProject |
readHistoryProject(CmsRequestContext context,
int publishTag)
Returns a historical project entry.
|
java.util.List<CmsProperty> |
readHistoryPropertyObjects(CmsRequestContext context,
I_CmsHistoryResource resource)
Reads the list of all
objects that belong to the given historical resource. |
CmsUUID |
readIdForUrlName(CmsRequestContext context,
java.lang.String name)
Reads the structure id which is mapped to the given URL name, or null if the name is not
mapped to any structure IDs.
|
void |
readLocks()
Reads the locks that were saved to the database in the previous run of OpenCms.
|
CmsGroup |
readManagerGroup(CmsRequestContext context,
CmsProject project)
Reads the manager group of a project.
|
CmsOrganizationalUnit |
readOrganizationalUnit(CmsRequestContext context,
java.lang.String ouFqn)
Reads an organizational Unit based on its fully qualified name.
|
CmsUser |
readOwner(CmsRequestContext context,
CmsProject project)
Reads the owner of a project from the OpenCms.
|
CmsResource |
readParentFolder(CmsRequestContext context,
CmsUUID structureId)
Returns the parent folder to the given structure id.
|
java.util.List<CmsResource> |
readPath(CmsRequestContext context,
java.lang.String path,
CmsResourceFilter filter)
Builds a list of resources for a given path.
|
CmsProject |
readProject(CmsUUID id)
Reads a project given the projects id.
|
CmsProject |
readProject(java.lang.String name)
Reads a project.
|
java.util.List<java.lang.String> |
readProjectResources(CmsRequestContext context,
CmsProject project)
Returns the list of all resource names that define the "view" of the given project.
|
java.util.List<CmsResource> |
readProjectView(CmsRequestContext context,
CmsUUID projectId,
CmsResourceState state)
Reads all resources of a project that match a given state from the VFS.
|
CmsPropertyDefinition |
readPropertyDefinition(CmsRequestContext context,
java.lang.String name)
Reads a property definition.
|
CmsProperty |
readPropertyObject(CmsRequestContext context,
CmsResource resource,
java.lang.String key,
boolean search)
Reads a property object from a resource specified by a property name.
|
java.util.List<CmsProperty> |
readPropertyObjects(CmsRequestContext context,
CmsResource resource,
boolean search)
Reads all property objects from a resource.
|
java.util.List<CmsPublishedResource> |
readPublishedResources(CmsRequestContext context,
CmsUUID publishHistoryId)
Reads the resources that were published in a publish task for a given publish history ID.
|
protected CmsResource |
readResource(CmsDbContext dbc,
CmsUUID structureID,
CmsResourceFilter filter)
Reads a resource from the OpenCms VFS, using the specified resource filter.
|
protected CmsResource |
readResource(CmsDbContext dbc,
java.lang.String resourcePath,
CmsResourceFilter filter)
Reads a resource from the OpenCms VFS, using the specified resource filter.
|
I_CmsHistoryResource |
readResource(CmsRequestContext context,
CmsResource resource,
int version)
Reads the historical resource entry for the given resource with the given version number.
|
CmsResource |
readResource(CmsRequestContext context,
CmsUUID structureID,
CmsResourceFilter filter)
Reads a resource from the VFS,
using the specified resource filter.
|
CmsResource |
readResource(CmsRequestContext context,
java.lang.String resourcePath,
CmsResourceFilter filter)
Reads a resource from the VFS,
using the specified resource filter.
|
java.util.List<CmsResource> |
readResources(CmsRequestContext context,
CmsResource parent,
CmsResourceFilter filter,
boolean readTree)
Reads all resources below the given path matching the filter criteria,
including the full tree below the path only in case the
readTree
parameter is true . |
java.util.List<CmsResource> |
readResourcesVisitedBy(CmsRequestContext context,
java.lang.String poolName,
CmsVisitedByFilter filter)
Returns the resources that were visited by a user set in the filter.
|
java.util.List<CmsResource> |
readResourcesWithProperty(CmsRequestContext context,
CmsResource folder,
java.lang.String propertyDefinition,
java.lang.String value,
CmsResourceFilter filter)
Reads all resources that have a value (containing the specified value) set
for the specified property (definition) in the given path.
|
java.util.Set<I_CmsPrincipal> |
readResponsiblePrincipals(CmsRequestContext context,
CmsResource resource)
Returns a set of users that are responsible for a specific resource.
|
java.util.Set<CmsUser> |
readResponsibleUsers(CmsRequestContext context,
CmsResource resource)
Returns a set of users that are responsible for a specific resource.
|
java.util.List<CmsResource> |
readSiblings(CmsRequestContext context,
CmsResource resource,
CmsResourceFilter filter)
Returns a List of all siblings of the specified resource,
the specified resource being always part of the result set.
|
java.lang.String |
readStaticExportPublishedResourceParameters(CmsRequestContext context,
java.lang.String rfsName)
Returns the parameters of a resource in the table of all published template resources.
|
java.util.List<java.lang.String> |
readStaticExportResources(CmsRequestContext context,
int parameterResources,
long timestamp)
Returns a list of all template resources which must be processed during a static export.
|
java.util.List<I_CmsHistoryResource> |
readSubscribedDeletedResources(CmsRequestContext context,
java.lang.String poolName,
CmsUser user,
java.util.List<CmsGroup> groups,
CmsResource parent,
boolean includeSubFolders,
long deletedFrom)
Returns the subscribed history resources that were deleted.
|
java.util.List<CmsResource> |
readSubscribedResources(CmsRequestContext context,
java.lang.String poolName,
CmsSubscriptionFilter filter)
Returns the resources that were subscribed by a user or group set in the filter.
|
java.util.List<CmsUrlNameMappingEntry> |
readUrlNameMappings(CmsRequestContext context,
CmsUrlNameMappingFilter filter)
Reads the URL name mappings matching a given filter.
|
java.util.List<java.lang.String> |
readUrlNamesForAllLocales(CmsRequestContext context,
CmsUUID id)
Reads the newest URL names of a structure id for all locales.
|
CmsUser |
readUser(CmsRequestContext context,
CmsUUID id)
Returns a user object based on the id of a user.
|
CmsUser |
readUser(CmsRequestContext context,
java.lang.String username)
Returns a user object.
|
CmsUser |
readUser(CmsRequestContext context,
java.lang.String username,
java.lang.String password)
Returns a user object if the password for the user is correct.
|
void |
removeAccessControlEntry(CmsRequestContext context,
CmsResource resource,
CmsUUID principal)
Removes an access control entry for a given resource and principal.
|
void |
removeResourceFromOrgUnit(CmsRequestContext context,
CmsOrganizationalUnit orgUnit,
CmsResource resource)
Removes a resource from the given organizational unit.
|
void |
removeResourceFromProject(CmsRequestContext context,
CmsResource resource)
Removes a resource from the current project of the user.
|
void |
removeResourceFromUsersPubList(CmsRequestContext context,
java.util.Collection<CmsUUID> structureIds)
Removes the given resource to the given user's publish list.
|
void |
removeUserFromGroup(CmsRequestContext context,
java.lang.String username,
java.lang.String groupname,
boolean readRoles)
Removes a user from a group.
|
void |
replaceResource(CmsRequestContext context,
CmsResource resource,
int type,
byte[] content,
java.util.List<CmsProperty> properties)
Replaces the content, type and properties of a resource.
|
void |
resetPassword(CmsRequestContext context,
java.lang.String username,
java.lang.String oldPassword,
java.lang.String newPassword)
Resets the password for a specified user.
|
java.lang.String |
resourceOriginalPath(CmsRequestContext context,
CmsResource resource)
Returns the original path of given resource, that is the online path for the resource.
|
void |
restoreDeletedResource(CmsRequestContext context,
CmsUUID structureId)
Restores a deleted resource identified by its structure id from the historical archive.
|
void |
restoreResource(CmsRequestContext context,
CmsResource resource,
int version)
Restores a resource in the current project with the given version from the historical archive.
|
void |
saveAliases(CmsRequestContext context,
CmsResource resource,
java.util.List<CmsAlias> aliases)
Saves the aliases for a given resource.
|
void |
saveRewriteAliases(CmsRequestContext requestContext,
java.lang.String siteRoot,
java.util.List<CmsRewriteAlias> newAliases)
Replaces the rewrite aliases for a given site root.
|
java.util.List<CmsUser> |
searchUsers(CmsRequestContext requestContext,
CmsUserSearchParameters searchParams)
Searches users by search criteria.
|
void |
setDateExpired(CmsRequestContext context,
CmsResource resource,
long dateExpired)
Changes the "expire" date of a resource.
|
void |
setDateLastModified(CmsRequestContext context,
CmsResource resource,
long dateLastModified)
Changes the "last modified" time stamp of a resource.
|
void |
setDateReleased(CmsRequestContext context,
CmsResource resource,
long dateReleased)
Changes the "release" date of a resource.
|
void |
setParentGroup(CmsRequestContext context,
java.lang.String groupName,
java.lang.String parentGroupName)
Sets a new parent-group for an already existing group.
|
void |
setPassword(CmsRequestContext context,
java.lang.String username,
java.lang.String newPassword)
Sets the password for a user.
|
void |
setSubscribedResourceAsDeleted(CmsRequestContext context,
java.lang.String poolName,
CmsResource resource)
Marks a subscribed resource as deleted.
|
void |
setUsersOrganizationalUnit(CmsRequestContext context,
CmsOrganizationalUnit orgUnit,
CmsUser user)
Moves an user to the given organizational unit.
|
void |
subscribeResourceFor(CmsRequestContext context,
java.lang.String poolName,
CmsPrincipal principal,
CmsResource resource)
Subscribes the user or group to the resource.
|
void |
undelete(CmsRequestContext context,
CmsResource resource)
Undelete the resource by resetting it's state.
|
void |
undoChanges(CmsRequestContext context,
CmsResource resource,
CmsResource.CmsResourceUndoMode mode)
Undos all changes in the resource by restoring the version from the
online project to the current offline project.
|
void |
unlockProject(CmsRequestContext context,
CmsUUID projectId)
Unlocks all resources in this project.
|
void |
unlockResource(CmsRequestContext context,
CmsResource resource)
Unlocks a resource.
|
void |
unsubscribeAllDeletedResources(CmsRequestContext context,
java.lang.String poolName,
long deletedTo)
Unsubscribes all deleted resources that were deleted before the specified time stamp.
|
void |
unsubscribeAllResourcesFor(CmsRequestContext context,
java.lang.String poolName,
CmsPrincipal principal)
Unsubscribes the user or group from all resources.
|
void |
unsubscribeResourceFor(CmsRequestContext context,
java.lang.String poolName,
CmsPrincipal principal,
CmsResource resource)
Unsubscribes the principal from the resource.
|
void |
unsubscribeResourceForAll(CmsRequestContext context,
java.lang.String poolName,
CmsResource resource)
Unsubscribes all groups and users from the resource.
|
void |
updateLog()
Logs everything that has not been written to DB jet.
|
void |
updateRelationsForResource(CmsRequestContext context,
CmsResource resource,
java.util.List<CmsLink> relations)
Updates/Creates the relations for the given resource.
|
boolean |
userInGroup(CmsRequestContext context,
java.lang.String username,
java.lang.String groupname)
Tests if a user is member of the given group.
|
void |
validatePassword(java.lang.String password)
Checks if a new password follows the rules for
new passwords, which are defined by a Class implementing the
interface and configured in the opencms.properties file. |
java.util.Map<java.lang.String,java.util.List<CmsRelation>> |
validateRelations(CmsRequestContext context,
CmsPublishList publishList,
I_CmsReport report)
Validates the relations for the given resources.
|
void |
writeAccessControlEntry(CmsRequestContext context,
CmsResource resource,
CmsAccessControlEntry ace)
Writes an access control entries to a given resource.
|
CmsFile |
writeFile(CmsRequestContext context,
CmsFile resource)
Writes a resource to the OpenCms VFS, including it's content.
|
void |
writeGroup(CmsRequestContext context,
CmsGroup group)
Writes an already existing group.
|
void |
writeHistoryProject(CmsRequestContext context,
int publishTag,
long publishDate)
Creates a historical entry of the current project.
|
void |
writeLocks()
Writes the locks that are currently stored in-memory to the database to allow restoring them in
later startups.
|
void |
writeOrganizationalUnit(CmsRequestContext context,
CmsOrganizationalUnit organizationalUnit)
Writes an already existing organizational unit.
|
void |
writeProject(CmsRequestContext context,
CmsProject project)
Writes an already existing project.
|
void |
writePropertyObject(CmsRequestContext context,
CmsResource resource,
CmsProperty property)
Writes a property for a specified resource.
|
void |
writePropertyObjects(CmsRequestContext context,
CmsResource resource,
java.util.List<CmsProperty> properties)
Writes a list of properties for a specified resource.
|
void |
writeResource(CmsRequestContext context,
CmsResource resource)
Writes a resource to the OpenCms VFS.
|
void |
writeResourceProjectLastModified(CmsRequestContext context,
CmsResource resource,
CmsProject project)
Writes the 'projectlastmodified' field of a resource record.
|
void |
writeStaticExportPublishedResource(CmsRequestContext context,
java.lang.String resourceName,
int linkType,
java.lang.String linkParameter,
long timestamp)
Inserts an entry in the published resource table.
|
java.lang.String |
writeUrlNameMapping(CmsRequestContext context,
java.util.Iterator<java.lang.String> nameSeq,
CmsUUID structureId,
java.lang.String locale,
boolean replaceOnPublish)
Writes a new URL name mapping for a given resource.
|
void |
writeUser(CmsRequestContext context,
CmsUser user)
Updates the user information.
|
protected I_CmsDbContextFactory m_dbContextFactory
protected CmsDriverManager m_driverManager
public void addAlias(CmsRequestContext context, CmsAlias alias) throws CmsException
context
- the current request contextalias
- the alias to addCmsException
- if something goes wrongpublic void addRelationToResource(CmsRequestContext context, CmsResource resource, CmsResource target, CmsRelationType type, boolean importCase) throws CmsException
context
- the request contextresource
- the resource to add the relation totarget
- the target of the relationtype
- the type of the relationimportCase
- if importing relationsCmsException
- if something goes wrongdeleteRelationsForResource(CmsRequestContext, CmsResource, CmsRelationFilter)
,
CmsObject.addRelationToResource(String, String, String)
public void addResourceToOrgUnit(CmsRequestContext context, CmsOrganizationalUnit orgUnit, CmsResource resource) throws CmsException
context
- the current request contextorgUnit
- the organizational unit to add the resource toresource
- the resource that is to be added to the organizational unitCmsException
- if something goes wrongCmsOrgUnitManager.addResourceToOrgUnit(CmsObject, String, String)
,
CmsOrgUnitManager.removeResourceFromOrgUnit(CmsObject, String, String)
public void addUserToGroup(CmsRequestContext context, java.lang.String username, java.lang.String groupname, boolean readRoles) throws CmsException
context
- the current request contextusername
- the name of the user that is to be added to the groupgroupname
- the name of the groupreadRoles
- if reading roles or groupsCmsException
- if operation was not successfulpublic void changeLock(CmsRequestContext context, CmsResource resource) throws CmsException
context
- the current request contextresource
- the resource to change the lock forCmsException
- if something goes wrongI_CmsResourceType.changeLock(CmsObject, CmsSecurityManager, CmsResource)
public java.util.List<CmsResource> changeResourcesInFolderWithProperty(CmsRequestContext context, CmsResource resource, java.lang.String propertyDefinition, java.lang.String oldValue, java.lang.String newValue, boolean recursive) throws CmsException, CmsVfsException
context
- the current request contextresource
- the resource on which property definition values are changedpropertyDefinition
- the name of the property definition to change the valueoldValue
- the old value of the property definitionnewValue
- the new value of the property definitionrecursive
- if true, change recursively all property values on sub-resources (only for folders)CmsResource
's where the property value has been changedCmsVfsException
- for now only when the search for the old value failsCmsException
- if operation was not successfulpublic void checkManagerOfProjectRole(CmsDbContext dbc, CmsProject project) throws CmsRoleViolationException
dbc
- the current database contextproject
- the project to checkCmsRoleViolationException
- if the user does not have the required role permissionspublic void checkOfflineProject(CmsDbContext dbc) throws CmsVfsException
This is used to ensure a user is in an "Offline" project before write access to VFS resources is granted.
dbc
- the current OpenCms users database contextCmsVfsException
- if the project in the given database context is the "Online" projectprotected void checkPermissions(CmsDbContext dbc, CmsResource resource, CmsPermissionSet requiredPermissions, boolean checkLock, CmsResourceFilter filter) throws CmsException, CmsSecurityException
If the required permissions are not satisfied by the permissions the user has on the resource, an exception is thrown.
dbc
- the current database contextresource
- the resource on which permissions are requiredrequiredPermissions
- the set of permissions required to access the resourcecheckLock
- if true, the lock status of the resource is also checkedfilter
- the filter for the resourceCmsException
- in case of any i/o errorCmsSecurityException
- if the required permissions are not satisfiedhasPermissions(CmsRequestContext, CmsResource, CmsPermissionSet, boolean, CmsResourceFilter)
public void checkPermissions(CmsRequestContext context, CmsResource resource, CmsPermissionSet requiredPermissions, boolean checkLock, CmsResourceFilter filter) throws CmsException, CmsSecurityException
If the required permissions are not satisfied by the permissions the user has on the resource, an exception is thrown.
context
- the current request contextresource
- the resource on which permissions are requiredrequiredPermissions
- the set of permissions required to access the resourcecheckLock
- if true, the lock status of the resource is also checkedfilter
- the filter for the resourceCmsException
- in case of any i/o errorCmsSecurityException
- if the required permissions are not satisfiedcheckPermissions(CmsRequestContext, CmsResource, CmsPermissionSet, I_CmsPermissionHandler.CmsPermissionCheckResult)
protected void checkPermissions(CmsRequestContext context, CmsResource resource, CmsPermissionSet requiredPermissions, I_CmsPermissionHandler.CmsPermissionCheckResult permissions) throws CmsSecurityException, CmsLockException, CmsVfsResourceNotFoundException
hasPermissions(CmsRequestContext, CmsResource, CmsPermissionSet, boolean, CmsResourceFilter)
.context
- the current request contextresource
- the resource on which permissions are requiredrequiredPermissions
- the set of permissions required to access the resourcepermissions
- the permissions to checkCmsSecurityException
- if the required permissions are not satisfiedCmsLockException
- if the lock status is not as requiredCmsVfsResourceNotFoundException
- if the required resource has been filteredpublic void checkPublishPermissions(CmsDbContext dbc, CmsPublishList publishList) throws CmsException, CmsMultiException
dbc
- the current OpenCms users database contextpublishList
- the publish list to check (contains the information about the resources / project to publish)CmsException
- if the user does not have the required permissions because of project lock stateCmsMultiException
- if issues occur like a direct publish is attempted on a resource
whose parent folder is new or deleted in the offline project,
or if the current user has no management access to the current projectpublic void checkRole(CmsDbContext dbc, CmsRole role) throws CmsRoleViolationException
If the organizational unit is null
, this method will check if the
given user has the given role for at least one organizational unit.
dbc
- the current OpenCms users database contextrole
- the role to checkCmsRoleViolationException
- if the user does not have the required role permissionsCmsRoleManager.checkRole(CmsObject, CmsRole)
public void checkRole(CmsRequestContext context, CmsRole role) throws CmsRoleViolationException
If the organizational unit is null
, this method will check if the
given user has the given role for at least one organizational unit.
context
- the current request contextrole
- the role to checkCmsRoleViolationException
- if the user does not have the required role permissionspublic void checkRoleForResource(CmsDbContext dbc, CmsRole role, CmsResource resource) throws CmsRoleViolationException
dbc
- the current OpenCms users database contextrole
- the role to checkresource
- the resource to check the role forCmsRoleViolationException
- if the user does not have the required role permissionsCmsRoleManager.checkRole(CmsObject, CmsRole)
public void checkRoleForResource(CmsRequestContext context, CmsRole role, CmsResource resource) throws CmsRoleViolationException
context
- the current request contextrole
- the role to checkresource
- the resource to check the role forCmsRoleViolationException
- if the user does not have the required role permissionsprotected void checkRoleForUserModification(CmsDbContext dbc, java.lang.String username, CmsRole role) throws CmsDataAccessException, CmsRoleViolationException
dbc
- the database contextusername
- the name of the user to modifyrole
- the needed roleCmsDataAccessException
- if something goes wrong accessing the databaseCmsRoleViolationException
- if the user has not the needed permissionsprotected void checkSystemLocks(CmsDbContext dbc, CmsResource resource) throws CmsException
dbc
- the current database contextresource
- the resource to checkCmsException
- in case there is a system lock contained in the given resourcepublic void chflags(CmsRequestContext context, CmsResource resource, int flags) throws CmsException, CmsSecurityException
The resource flags are used to indicate various "special" conditions for a resource. Most notably, the "internal only" setting which signals that a resource can not be directly requested with it's URL.
context
- the current request contextresource
- the resource to change the flags forflags
- the new resource flags for this resourceCmsException
- if something goes wrongCmsSecurityException
- if the user has insufficient permission for the given resource ((CmsPermissionSet.ACCESS_WRITE
required)I_CmsResourceType.chflags(CmsObject, CmsSecurityManager, CmsResource, int)
public void chtype(CmsRequestContext context, CmsResource resource, int type) throws CmsException, CmsSecurityException
OpenCms handles resources according to the resource type, not the file suffix. This is e.g. why a JSP in OpenCms can have the suffix ".html" instead of ".jsp" only. Changing the resource type makes sense e.g. if you want to make a plain text file a JSP resource, or a binary file an image, etc.
context
- the current request contextresource
- the resource to change the type fortype
- the new resource type for this resourceCmsException
- if something goes wrongCmsSecurityException
- if the user has insufficient permission for the given resource ((CmsPermissionSet.ACCESS_WRITE
required))I_CmsResourceType.chtype(CmsObject, CmsSecurityManager, CmsResource, int)
,
CmsObject.chtype(String, int)
public void copyAccessControlEntries(CmsRequestContext context, CmsResource source, CmsResource destination) throws CmsException, CmsSecurityException
Already existing access control entries of the destination resource are removed.
context
- the current request contextsource
- the resource to copy the access control entries fromdestination
- the resource to which the access control entries are copiedCmsException
- if something goes wrongCmsSecurityException
- if the user has insufficient permission for the given resource (CmsPermissionSet.ACCESS_CONTROL
required)public void copyResource(CmsRequestContext context, CmsResource source, java.lang.String destination, CmsResource.CmsResourceCopyMode siblingMode) throws CmsException, CmsSecurityException
You must ensure that the destination path is an absolute, valid and existing VFS path. Relative paths from the source are currently not supported.
The copied resource will always be locked to the current user after the copy operation.
In case the target resource already exists, it is overwritten with the source resource.
The siblingMode
parameter controls how to handle siblings
during the copy operation.
Possible values for this parameter are:
context
- the current request contextsource
- the resource to copydestination
- the name of the copy destination with complete pathsiblingMode
- indicates how to handle siblings during copyCmsException
- if something goes wrongCmsSecurityException
- if resource could not be copiedCmsObject.copyResource(String, String, CmsResource.CmsResourceCopyMode)
,
I_CmsResourceType.copyResource(CmsObject, CmsSecurityManager, CmsResource, String, CmsResource.CmsResourceCopyMode)
public void copyResourceToProject(CmsRequestContext context, CmsResource resource) throws CmsException, CmsRoleViolationException
context
- the current request contextresource
- the resource to apply this operation toCmsException
- if something goes wrongCmsRoleViolationException
- if the current user does not have management access to the projectI_CmsResourceType.copyResourceToProject(CmsObject, CmsSecurityManager, CmsResource)
public int countLockedResources(CmsRequestContext context, CmsUUID id) throws CmsException, CmsRoleViolationException
context
- the current request contextid
- the id of the projectCmsException
- if something goes wrongCmsRoleViolationException
- if the current user does not have management access to the projectpublic long countUsers(CmsRequestContext requestContext, CmsUserSearchParameters searchParams) throws CmsException
requestContext
- the request contextsearchParams
- the search criteria objectCmsException
- if something goes wrongpublic CmsGroup createGroup(CmsRequestContext context, java.lang.String name, java.lang.String description, int flags, java.lang.String parent) throws CmsException, CmsRoleViolationException
context
- the current request contextname
- the name of the new groupdescription
- the description for the new groupflags
- the flags for the new groupparent
- the name of the parent group (or null
)CmsGroup
object representing the newly created groupCmsException
- if operation was not successful.CmsRoleViolationException
- if the role CmsRole.ACCOUNT_MANAGER
is not owned by the current userpublic CmsOrganizationalUnit createOrganizationalUnit(CmsRequestContext context, java.lang.String ouFqn, java.lang.String description, int flags, CmsResource resource) throws CmsException
context
- the current request contextouFqn
- the fully qualified name of the new organizational unitdescription
- the description of the new organizational unitflags
- the flags for the new organizational unitresource
- the first associated resourceCmsOrganizationalUnit
object representing
the newly created organizational unitCmsException
- if operation was not successfulCmsOrgUnitManager.createOrganizationalUnit(CmsObject, String, String, int, String)
public CmsProject createProject(CmsRequestContext context, java.lang.String name, java.lang.String description, java.lang.String groupname, java.lang.String managergroupname, CmsProject.CmsProjectType projecttype) throws CmsException, CmsRoleViolationException
context
- the current request contextname
- the name of the project to createdescription
- the description of the projectgroupname
- the project user group to be setmanagergroupname
- the project manager group to be setprojecttype
- the type of the projectCmsException
- if something goes wrongCmsRoleViolationException
- if the current user does not own the role CmsRole.PROJECT_MANAGER
public CmsPropertyDefinition createPropertyDefinition(CmsRequestContext context, java.lang.String name) throws CmsException, CmsSecurityException, CmsRoleViolationException
Property definitions are valid for all resource types.
context
- the current request contextname
- the name of the property definition to createCmsException
- if something goes wrongCmsSecurityException
- if the current project is online.CmsRoleViolationException
- if the current user does not own the role CmsRole.WORKPLACE_MANAGER
public CmsResource createResource(CmsRequestContext context, java.lang.String resourcePath, CmsResource resource, byte[] content, java.util.List<CmsProperty> properties) throws CmsVfsResourceAlreadyExistsException, CmsVfsException, CmsException
An exception is thrown if a resource with the given name already exists.
context
- the current request contextresourcePath
- the name of the resource to create (full path)resource
- the new resource to createcontent
- the content for the new resourceproperties
- the properties for the new resourceCmsVfsResourceAlreadyExistsException
- if a resource with the given name already existsCmsVfsException
- if the project in the given database context is the "Online" projectCmsException
- if something goes wrongpublic CmsResource createResource(CmsRequestContext context, java.lang.String resourcename, int type, byte[] content, java.util.List<CmsProperty> properties) throws CmsException
If the provided content is null and the resource is not a folder, the content will be set to an empty byte array.
context
- the current request contextresourcename
- the name of the resource to create (full path)type
- the type of the resource to createcontent
- the content for the new resourceproperties
- the properties for the new resourceCmsException
- if something goes wrongI_CmsResourceType.createResource(CmsObject, CmsSecurityManager, String, byte[], List)
public CmsResource createSibling(CmsRequestContext context, CmsResource source, java.lang.String destination, java.util.List<CmsProperty> properties) throws CmsException
context
- the current request contextsource
- the resource to create a sibling fordestination
- the name of the sibling to create with complete pathproperties
- the individual properties for the new siblingCmsException
- if something goes wrongI_CmsResourceType.createSibling(CmsObject, CmsSecurityManager, CmsResource, String, List)
public CmsProject createTempfileProject(CmsRequestContext context) throws CmsException
context
- the current request contextCmsException
- if something goes wrongpublic CmsUser createUser(CmsRequestContext context, java.lang.String name, java.lang.String password, java.lang.String description, java.util.Map<java.lang.String,java.lang.Object> additionalInfos) throws CmsException, CmsRoleViolationException
context
- the current request contextname
- the name for the new userpassword
- the password for the new userdescription
- the description for the new useradditionalInfos
- the additional infos for the userCmsException
- if something goes wrongCmsRoleViolationException
- if the current user does not own the rule CmsRole.ACCOUNT_MANAGER
CmsObject.createUser(String, String, String, Map)
public void deleteAliases(CmsRequestContext context, CmsAliasFilter filter) throws CmsException
context
- the request contextfilter
- the alias filterCmsException
- if something goes wrongpublic void deleteAllStaticExportPublishedResources(CmsRequestContext context, int linkType) throws CmsException
context
- the current request contextlinkType
- the type of resource deleted (0= non-parameter, 1=parameter)CmsException
- if something goes wrongpublic void deleteGroup(CmsRequestContext context, CmsUUID groupId, CmsUUID replacementId) throws CmsException, CmsRoleViolationException, CmsSecurityException
context
- the current request contextgroupId
- the id of the group to be deletedreplacementId
- the id of the group to be transfered, can be null
CmsException
- if operation was not successfulCmsSecurityException
- if the group is a default group.CmsRoleViolationException
- if the current user does not own the rule CmsRole.ACCOUNT_MANAGER
public void deleteGroup(CmsRequestContext context, java.lang.String name) throws CmsException, CmsRoleViolationException, CmsSecurityException
Only groups that contain no subgroups can be deleted.
context
- the current request contextname
- the name of the group that is to be deletedCmsException
- if operation was not successfulCmsSecurityException
- if the group is a default group.CmsRoleViolationException
- if the current user does not own the rule CmsRole.ACCOUNT_MANAGER
public void deleteHistoricalVersions(CmsRequestContext context, int versionsToKeep, int versionsDeleted, long timeDeleted, I_CmsReport report) throws CmsException, CmsRoleViolationException
context
- the current request contextversionsToKeep
- number of versions to keep, is ignored if negativeversionsDeleted
- number of versions to keep for deleted resources, is ignored if negativetimeDeleted
- deleted resources older than this will also be deleted, is ignored if negativereport
- the report for output loggingCmsException
- if operation was not successfulCmsRoleViolationException
- if the current user does not own the role CmsRole.WORKPLACE_MANAGER
public void deleteLogEntries(CmsRequestContext context, CmsLogFilter filter) throws CmsException
context
- the current user contextfilter
- the filter to use for deletionCmsException
- if something goes wronggetLogEntries(CmsRequestContext, CmsLogFilter)
,
CmsObject.deleteLogEntries(CmsLogFilter)
public void deleteOrganizationalUnit(CmsRequestContext context, CmsOrganizationalUnit organizationalUnit) throws CmsException
Only organizational units that contain no sub organizational unit can be deleted.
The organizational unit can not be delete if it is used in the request context, or if the current user belongs to it.
All users and groups in the given organizational unit will be deleted.
context
- the current request contextorganizationalUnit
- the organizational unit to deleteCmsException
- if operation was not successfulCmsOrgUnitManager.deleteOrganizationalUnit(CmsObject, String)
public void deleteProject(CmsRequestContext context, CmsUUID projectId) throws CmsException, CmsRoleViolationException
All modified resources currently inside this project will be reset to their online state.
context
- the current request contextprojectId
- the ID of the project to be deletedCmsException
- if something goes wrongCmsRoleViolationException
- if the current user does not own management access to the projectpublic void deletePropertyDefinition(CmsRequestContext context, java.lang.String name) throws CmsException, CmsSecurityException, CmsRoleViolationException
context
- the current request contextname
- the name of the property definition to deleteCmsException
- if something goes wrongCmsSecurityException
- if the project to delete is the "Online" projectCmsRoleViolationException
- if the current user does not own the role CmsRole.WORKPLACE_MANAGER
public void deleteRelationsForResource(CmsRequestContext context, CmsResource resource, CmsRelationFilter filter) throws CmsException
context
- the current user contextresource
- the resource to delete the relations forfilter
- the filter to use for deletionCmsException
- if something goes wrongaddRelationToResource(CmsRequestContext, CmsResource, CmsResource, CmsRelationType, boolean)
,
CmsObject.deleteRelationsFromResource(String, CmsRelationFilter)
protected void deleteResource(CmsDbContext dbc, CmsResource resource, CmsResource.CmsResourceDeleteMode siblingMode) throws CmsException
dbc
- the db contextresource
- the name of the resource to delete (full path)siblingMode
- indicates how to handle siblings of the deleted resourceCmsException
- if something goes wrongpublic void deleteResource(CmsRequestContext context, CmsResource resource, CmsResource.CmsResourceDeleteMode siblingMode) throws CmsException, CmsSecurityException
The siblingMode
parameter controls how to handle siblings
during the delete operation.
Possible values for this parameter are:
context
- the current request contextresource
- the name of the resource to delete (full path)siblingMode
- indicates how to handle siblings of the deleted resourceCmsException
- if something goes wrongCmsSecurityException
- if the user does not have CmsPermissionSet.ACCESS_WRITE
on the given resourceI_CmsResourceType.deleteResource(CmsObject, CmsSecurityManager, CmsResource, CmsResource.CmsResourceDeleteMode)
public void deleteStaticExportPublishedResource(CmsRequestContext context, java.lang.String resourceName, int linkType, java.lang.String linkParameter) throws CmsException
context
- the current request contextresourceName
- The name of the resource to be deleted in the static exportlinkType
- the type of resource deleted (0= non-parameter, 1=parameter)linkParameter
- the parameters of the resourceCmsException
- if something goes wrongprotected void deleteUser(CmsRequestContext context, CmsUser user, CmsUser replacement) throws CmsException, CmsSecurityException, CmsRoleViolationException
context
- the current request contextuser
- the user to be deletedreplacement
- the user to be transfered, can be null
CmsRoleViolationException
- if the current user does not own the rule CmsRole.ACCOUNT_MANAGER
CmsSecurityException
- in case the user is a default userCmsException
- if something goes wrongpublic void deleteUser(CmsRequestContext context, CmsUUID userId) throws CmsException
context
- the current request contextuserId
- the Id of the user to be deletedCmsException
- if something goes wrongpublic void deleteUser(CmsRequestContext context, CmsUUID userId, CmsUUID replacementId) throws CmsException
context
- the current request contextuserId
- the id of the user to be deletedreplacementId
- the id of the user to be transferedCmsException
- if operation was not successfulpublic void deleteUser(CmsRequestContext context, java.lang.String username) throws CmsException
context
- the current request contextusername
- the name of the user to be deletedCmsException
- if something goes wrongpublic void destroy() throws java.lang.Throwable
java.lang.Throwable
- if something goes wrongpublic boolean existsResource(CmsRequestContext context, CmsUUID structureId, CmsResourceFilter filter)
CmsResourceFilter.DEFAULT
filter.
A resource may be of type
or
CmsFile
.CmsFolder
The specified filter controls what kind of resources should be "found"
during the read operation. This will depend on the application. For example,
using
will only return currently
"valid" resources, while using CmsResourceFilter.DEFAULT
will ignore the date release / date expired information of the resource.CmsResourceFilter.IGNORE_EXPIRATION
This method also takes into account the user permissions, so if
the given resource exists, but the current user has not the required
permissions, then this method will return false
.
context
- the current request contextstructureId
- the structure id of the resource to checkfilter
- the resource filter to use while readingtrue
if the resource is availableCmsObject.existsResource(CmsUUID, CmsResourceFilter)
,
CmsObject.existsResource(CmsUUID)
public boolean existsResource(CmsRequestContext context, java.lang.String resourcePath, CmsResourceFilter filter)
CmsResourceFilter.DEFAULT
filter.
A resource may be of type
or
CmsFile
.CmsFolder
The specified filter controls what kind of resources should be "found"
during the read operation. This will depend on the application. For example,
using
will only return currently
"valid" resources, while using CmsResourceFilter.DEFAULT
will ignore the date release / date expired information of the resource.CmsResourceFilter.IGNORE_EXPIRATION
This method also takes into account the user permissions, so if
the given resource exists, but the current user has not the required
permissions, then this method will return false
.
context
- the current request contextresourcePath
- the name of the resource to read (full path)filter
- the resource filter to use while readingtrue
if the resource is availableCmsObject.existsResource(String, CmsResourceFilter)
,
CmsObject.existsResource(String)
public CmsPublishList fillPublishList(CmsRequestContext context, CmsPublishList publishList) throws CmsException
Please refer to the source code of this method for the rules on how to decide whether a
new/changed/deleted
object can be published or not.CmsResource
context
- the current request contextpublishList
- must be initialized with basic publish information (Project or direct publish operation)CmsException
- if something goes wrongCmsPublishList
public java.util.List<CmsAccessControlEntry> getAccessControlEntries(CmsRequestContext context, CmsResource resource, boolean getInherited) throws CmsException
context
- the current request contextresource
- the resource to read the access control entries forgetInherited
- true if the result should include all access control entries inherited by parent foldersCmsAccessControlEntry
objects defining all permissions for the given resourceCmsException
- if something goes wrongpublic CmsAccessControlList getAccessControlList(CmsRequestContext context, CmsResource resource, boolean inheritedOnly) throws CmsException
If inheritedOnly
is set, only inherited access control entries are returned.
context
- the current request contextresource
- the resourceinheritedOnly
- skip non-inherited entries if setCmsException
- if something goes wrongpublic java.util.List<CmsAlias> getAliasesForSite(CmsRequestContext requestContext, java.lang.String siteRoot) throws CmsException
requestContext
- the current request contextsiteRoot
- the site rootCmsException
- if something goes wrongpublic java.util.List<CmsAccessControlEntry> getAllAccessControlEntries(CmsRequestContext context) throws CmsException
context
- the current request contextCmsException
- if something goes wrongpublic java.util.List<CmsProject> getAllAccessibleProjects(CmsRequestContext context, CmsOrganizationalUnit orgUnit, boolean includeSubOus) throws CmsException
context
- the current request contextorgUnit
- the organizational unit to search project inincludeSubOus
- if to include sub organizational unitsCmsProject
CmsException
- if something goes wrongpublic java.util.List<CmsHistoryProject> getAllHistoricalProjects(CmsRequestContext context) throws CmsException
context
- the current request contextCmsHistoryProject
objects
with all projects from history.CmsException
- if operation was not successfulpublic java.util.List<CmsProject> getAllManageableProjects(CmsRequestContext context, CmsOrganizationalUnit orgUnit, boolean includeSubOus) throws CmsException
context
- the current request contextorgUnit
- the organizational unit to search project inincludeSubOus
- if to include sub organizational unitsCmsProject
CmsException
- if operation was not successfulpublic java.util.List<CmsGroup> getChildren(CmsRequestContext context, java.lang.String groupname, boolean includeSubChildren) throws CmsException
This method also returns all sub-child groups of the current group.
context
- the current request contextgroupname
- the name of the groupincludeSubChildren
- if set also returns all sub-child groups of the given groupCmsGroup
objects or null
CmsException
- if operation was not successfulpublic long getDateLastVisitedBy(CmsRequestContext context, java.lang.String poolName, CmsUser user, CmsResource resource) throws CmsException
context
- the request contextpoolName
- the name of the database pool to useuser
- the user to check the dateresource
- the resource to check the dateCmsException
- if something goes wrongpublic java.util.List<CmsGroup> getGroups(CmsRequestContext context, CmsOrganizationalUnit orgUnit, boolean includeSubOus, boolean readRoles) throws CmsException
context
- the current request contextorgUnit
- the organizational unit to get the groups forincludeSubOus
- if all groups of sub-organizational units should be retrieved tooreadRoles
- if to read roles or groupsCmsGroup
objects in the organizational unitCmsException
- if operation was not successfulCmsOrgUnitManager.getResourcesForOrganizationalUnit(CmsObject, String)
,
CmsOrgUnitManager.getGroups(CmsObject, String, boolean)
,
CmsOrgUnitManager.getUsers(CmsObject, String, boolean)
public java.util.List<CmsGroup> getGroupsOfUser(CmsRequestContext context, java.lang.String username, java.lang.String ouFqn, boolean includeChildOus, boolean readRoles, boolean directGroupsOnly, java.lang.String remoteAddress) throws CmsException
context
- the current request contextusername
- The name of the userouFqn
- the fully qualified name of the organizational unit to restrict the result set forincludeChildOus
- include groups of child organizational unitsreadRoles
- if to read roles or groupsdirectGroupsOnly
- if set only the direct assigned groups will be returned, if not also indirect rolesremoteAddress
- the IP address to filter the groups in the result listCmsGroup
objects filtered by the given IP addressCmsException
- if operation was not successfulpublic CmsLock getLock(CmsRequestContext context, CmsResource resource) throws CmsException
context
- the current request contextresource
- the resource to return the lock state forCmsException
- if something goes wrongpublic java.util.List<java.lang.String> getLockedResources(CmsRequestContext context, CmsResource resource, CmsLockFilter filter) throws CmsException
context
- the current request contextresource
- the folder to search infilter
- the lock filterCmsException
- if something goes wrongpublic java.util.List<CmsResource> getLockedResourcesObjects(CmsRequestContext context, CmsResource resource, CmsLockFilter filter) throws CmsException
context
- the current request contextresource
- the folder to search infilter
- the lock filterCmsException
- if something goes wrongpublic java.util.List<CmsResource> getLockedResourcesObjectsWithCache(CmsRequestContext context, CmsResource resource, CmsLockFilter filter, java.util.Map<java.lang.String,CmsResource> cache) throws CmsException
context
- the current request contextresource
- the folder to search infilter
- the lock filtercache
- the cache to useCmsException
- if something goes wrongpublic CmsLockManager getLockManager()
public java.util.List<CmsLogEntry> getLogEntries(CmsRequestContext context, CmsLogFilter filter) throws CmsException
context
- the current user contextfilter
- the filter to match the log entriesCmsException
- if something goes wrongCmsObject.getLogEntries(CmsLogFilter)
protected java.util.List<CmsResource> getManageableResources(CmsDbContext dbc, CmsRole role) throws CmsException
dbc
- the current database contextrole
- the role to checkCmsResource
objectsCmsException
- if something goes wrongpublic java.util.List<CmsResource> getManageableResources(CmsRequestContext context, CmsRole role) throws CmsException
context
- the current request contextrole
- the role to checkCmsResource
objectsCmsException
- if something goes wrongpublic java.util.List<CmsOrganizationalUnit> getOrganizationalUnits(CmsRequestContext context, CmsOrganizationalUnit parent, boolean includeChildren) throws CmsException
context
- the current request contextparent
- the parent organizational unitincludeChildren
- if hierarchical deeper organization units should also be returnedCmsOrganizationalUnit
objectsCmsException
- if operation was not successfulCmsOrgUnitManager.getOrganizationalUnits(CmsObject, String, boolean)
public java.util.List<CmsOrganizationalUnit> getOrgUnitsForRole(CmsRequestContext requestContext, CmsRole role, boolean includeSubOus) throws CmsException
requestContext
- the current request contextrole
- the role to checkincludeSubOus
- if sub organizational units should be included in the searchCmsOrganizationalUnit
objectsCmsException
- if something goes wrongpublic CmsGroup getParent(CmsRequestContext context, java.lang.String groupname) throws CmsException
context
- the current request contextgroupname
- the name of the groupnull
CmsException
- if operation was not successfulprotected java.lang.String getParentOrganizationalUnit(java.lang.String fqn)
fqn
- the fully qualified name to get the parent organizational unit forpublic CmsPermissionSetCustom getPermissions(CmsRequestContext context, CmsResource resource, CmsUser user) throws CmsException
context
- the current request contextresource
- the resourceuser
- the userCmsException
- if something goes wrongpublic CmsUUID getProjectId(CmsRequestContext context, int id) throws CmsException
context
- the current cms contextid
- the old project idCmsException
- if something goes wrongpublic CmsPublishList getRelatedResourcesToPublish(CmsRequestContext context, CmsPublishList publishList, CmsRelationFilter filter) throws CmsException
context
- the current cms contextpublishList
- the publish list to exclude from resultfilter
- the relation filter to use to get the related resourcesCmsException
- if something goes wrongCmsPublishManager.getRelatedResourcesToPublish(CmsObject, CmsPublishList)
public java.util.List<CmsRelation> getRelationsForResource(CmsRequestContext context, CmsResource resource, CmsRelationFilter filter) throws CmsException
context
- the current user contextresource
- the resource to retrieve the relations forfilter
- the filter to match the relationCmsRelation
objects for the given resource matching the given filterCmsException
- if something goes wrongCmsObject.getRelationsForResource(String, CmsRelationFilter)
public java.util.List<CmsResource> getResourcesForOrganizationalUnit(CmsRequestContext context, CmsOrganizationalUnit orgUnit) throws CmsException
context
- the current request contextorgUnit
- the organizational unit to get all resources forCmsResource
objects in the organizational unitCmsException
- if operation was not successfulCmsOrgUnitManager.getResourcesForOrganizationalUnit(CmsObject, String)
,
CmsOrgUnitManager.getGroups(CmsObject, String, boolean)
,
CmsOrgUnitManager.getUsers(CmsObject, String, boolean)
public java.util.Set<CmsResource> getResourcesForPrincipal(CmsRequestContext context, CmsUUID principalId, CmsPermissionSet permissions, boolean includeAttr) throws CmsException
If the includeAttr
flag is set it returns also all resources associated to
a given principal through some of following attributes.
context
- the current request contextprincipalId
- the id of the principalpermissions
- a set of permissions to match, can be null
for all ACEsincludeAttr
- a flag to include resources associated by attributesCmsResource
objectsCmsException
- if something goes wrongpublic java.util.List<CmsRewriteAlias> getRewriteAliases(CmsRequestContext requestContext, CmsRewriteAliasFilter filter) throws CmsException
requestContext
- the current request contextfilter
- the filter used for selecting the rewrite aliasesCmsException
- if something goes wrongpublic java.util.Set<CmsGroup> getRoleGroups(CmsRequestContext context, CmsRole role, boolean directUsersOnly) throws CmsException
context
- the request contextrole
- the roledirectUsersOnly
- if true, only direct users of the role group will be returnedCmsException
- if something goes wrongpublic java.util.List<CmsRole> getRolesForResource(CmsRequestContext context, CmsUser user, CmsResource resource) throws CmsException
context
- the current request contextuser
- the user to checkresource
- the resource to check the roles forCmsRole
objectsCmsException
- is something goes wrongpublic CmsSqlManager getSqlManager()
public java.util.List<CmsUser> getUsers(CmsRequestContext context, CmsOrganizationalUnit orgUnit, boolean recursive) throws CmsException
context
- the current request contextorgUnit
- the organizational unit to get the users forrecursive
- if all users of sub-organizational units should be retrieved tooCmsUser
objects in the organizational unitCmsException
- if operation was not successfulCmsOrgUnitManager.getResourcesForOrganizationalUnit(CmsObject, String)
,
CmsOrgUnitManager.getGroups(CmsObject, String, boolean)
,
CmsOrgUnitManager.getUsers(CmsObject, String, boolean)
public java.util.List<CmsUser> getUsersOfGroup(CmsRequestContext context, java.lang.String groupname, boolean includeOtherOuUsers, boolean directUsersOnly, boolean readRoles) throws CmsException
context
- the current request contextgroupname
- the name of the group to list users fromincludeOtherOuUsers
- include users of other organizational unitsdirectUsersOnly
- if set only the direct assigned users will be returned,
if not also indirect users, ie. members of child groupsreadRoles
- if to read roles or groupsCmsUser
objects in the groupCmsException
- if operation was not successfulpublic java.util.List<CmsResource> getUsersPubList(CmsRequestContext context) throws CmsException
context
- the request contextCmsException
- if something goes wrongpublic java.util.List<CmsUser> getUsersWithoutAdditionalInfo(CmsRequestContext context, CmsOrganizationalUnit orgUnit, boolean recursive) throws CmsException
context
- the current request contextorgUnit
- the organizational unit to get the users forrecursive
- if all users of sub-organizational units should be retrieved tooCmsUser
objects in the organizational unitCmsException
- if operation was not successfulCmsOrgUnitManager.getResourcesForOrganizationalUnit(CmsObject, String)
,
CmsOrgUnitManager.getGroups(CmsObject, String, boolean)
,
CmsOrgUnitManager.getUsers(CmsObject, String, boolean)
protected I_CmsPermissionHandler.CmsPermissionCheckResult hasPermissions(CmsDbContext dbc, CmsResource resource, CmsPermissionSet requiredPermissions, boolean checkLock, CmsResourceFilter filter) throws CmsException
This test will not throw an exception in case the required permissions are not available for the requested operation. Instead, it will return one of the following values:
dbc
- the current database contextresource
- the resource on which permissions are requiredrequiredPermissions
- the set of permissions required for the operationcheckLock
- if true, a lock for the current user is required for
all write operations, if false it's ok to write as long as the resource
is not locked by another userfilter
- the resource filter to useI_CmsPermissionHandler.PERM_ALLOWED
if the user has sufficient permissions on the resource
for the requested operationCmsException
- in case of i/o errors (NOT because of insufficient permissions)public I_CmsPermissionHandler.CmsPermissionCheckResult hasPermissions(CmsRequestContext context, CmsResource resource, CmsPermissionSet requiredPermissions, boolean checkLock, CmsResourceFilter filter) throws CmsException
This test will not throw an exception in case the required permissions are not available for the requested operation. Instead, it will return one of the following values:
context
- the current request contextresource
- the resource on which permissions are requiredrequiredPermissions
- the set of permissions required for the operationcheckLock
- if true, a lock for the current user is required for
all write operations, if false it's ok to write as long as the resource
is not locked by another userfilter
- the resource filter to useI_CmsPermissionHandler.PERM_ALLOWED
if the user has sufficient permissions on the resource
for the requested operationCmsException
- in case of i/o errors (NOT because of insufficient permissions)hasPermissions(CmsDbContext, CmsResource, CmsPermissionSet, boolean, CmsResourceFilter)
public boolean hasRole(CmsDbContext dbc, CmsUser user, CmsRole role)
If the organizational unit is null
, this method will check if the
given user has the given role for at least one organizational unit.
dbc
- the current OpenCms users database contextuser
- the user to check the role forrole
- the role to checktrue
if the given user has the given role in the given organizational unitpublic boolean hasRole(CmsRequestContext context, CmsUser user, CmsRole role)
If the organizational unit is null
, this method will check if the
given user has the given role for at least one organizational unit.
context
- the current request contextuser
- the user to check the role forrole
- the role to checktrue
if the given user has the given role in the given organizational unitprotected boolean hasRole(CmsRole role, java.util.List<CmsGroup> roles)
true
if at least one of the given group names is equal to a group name
of the given role in the given organizational unit.This checks the given list against the group of the given role as well as against the role group of all parent roles.
If the organizational unit is null
, this method will check if the
given user has the given role for at least one organizational unit.
role
- the role to checkroles
- the groups to match the role groups againsttrue
if at last one of the given group names is equal to a group name
of this rolepublic boolean hasRoleForResource(CmsDbContext dbc, CmsUser user, CmsRole role, CmsResource resource)
dbc
- the current OpenCms users database contextuser
- the user to check the role forrole
- the role to checkresource
- the resource to check the role fortrue
if the given user has the given role for the given resourcepublic boolean hasRoleForResource(CmsRequestContext context, CmsUser user, CmsRole role, CmsResource resource)
context
- the current request contextuser
- the user to checkrole
- the role to checkresource
- the resource to check the role fortrue
if the given user has the given role for the given resourcepublic void importAccessControlEntries(CmsRequestContext context, CmsResource resource, java.util.List<CmsAccessControlEntry> acEntries) throws CmsException, CmsSecurityException
Already existing access control entries of this resource are removed before.
Access is granted, if:
context
- the current request contextresource
- the resourceacEntries
- a list of CmsAccessControlEntry
objectsCmsException
- if something goes wrongCmsSecurityException
- if the required permissions are not satisfiedpublic CmsResource importResource(CmsRequestContext context, java.lang.String resourcePath, CmsResource resource, byte[] content, java.util.List<CmsProperty> properties, boolean importCase) throws CmsException
The content
parameter may be null if the resource id already exists.
If so, the created resource will be made a sibling of the existing resource,
the existing content will remain unchanged.
This is used during file import for import of siblings as the
manifest.xml
only contains one binary copy per file.
If the resource id exists but the content
is not null,
the created resource will be made a sibling of the existing resource,
and both will share the new content.
context
- the current request contextresourcePath
- the name of the resource to create (full path)resource
- the new resource to createcontent
- the content for the new resourceproperties
- the properties for the new resourceimportCase
- if true
, signals that this operation is done while importing resource,
causing different lock behavior and potential "lost and found" usageCmsException
- if something goes wrongpublic CmsAliasImportResult importRewriteAlias(CmsRequestContext requestContext, java.lang.String siteRoot, java.lang.String source, java.lang.String target, CmsAliasMode mode) throws CmsException
requestContext
- the current request contextsiteRoot
- the site rootsource
- the rewrite alias sourcetarget
- the rewrite alias targetmode
- the alias modeCmsException
- if something goes wrongpublic CmsUser importUser(CmsRequestContext context, java.lang.String id, java.lang.String name, java.lang.String password, java.lang.String firstname, java.lang.String lastname, java.lang.String email, int flags, long dateCreated, java.util.Map<java.lang.String,java.lang.Object> additionalInfos) throws CmsException, CmsRoleViolationException
context
- the current request contextid
- the id of the username
- the new name for the userpassword
- the new password for the userfirstname
- the first name of the userlastname
- the last name of the useremail
- the email of the userflags
- the flags for a user (for example I_CmsPrincipal.FLAG_ENABLED
)dateCreated
- the creation dateadditionalInfos
- the additional user infosCmsException
- if something goes wrongCmsRoleViolationException
- if the role CmsRole.ACCOUNT_MANAGER
is not owned by the current user.public int incrementCounter(CmsRequestContext context, java.lang.String name) throws CmsException
context
- the request contextname
- the name of the counterCmsException
- if something goes wrongpublic void init(CmsConfigurationManager configurationManager, I_CmsDbContextFactory dbContextFactory, CmsPublishEngine publishEngine) throws CmsInitException
configurationManager
- the configurationManagerdbContextFactory
- the initialized OpenCms runtime info factorypublishEngine
- the publish engineCmsInitException
- if the initialization failspublic void initializeOrgUnit(CmsRequestContext context, CmsOrganizationalUnit ou)
context
- the request contextou
- the organizational unitpublic boolean isInsideCurrentProject(CmsRequestContext context, java.lang.String resourcename)
The project "view" is determined by a set of path prefixes. If the resource starts with any one of this prefixes, it is considered to be "inside" the project.
context
- the current request contextresourcename
- the specified resource name (full path)true
, if the specified resource is inside the current projectpublic boolean isManagerOfProject(CmsRequestContext context)
context
- the current request contexttrue
, if the user has management access to the current projectpublic boolean isSubscriptionDriverAvailable()
public void lockResource(CmsRequestContext context, CmsResource resource, CmsLockType type) throws CmsException
The type
parameter controls what kind of lock is used.
Possible values for this parameter are:
context
- the current request contextresource
- the resource to locktype
- type of the lockCmsException
- if something goes wrongCmsObject.lockResource(String)
,
CmsObject.lockResourceTemporary(String)
,
I_CmsResourceType.lockResource(CmsObject, CmsSecurityManager, CmsResource, CmsLockType)
public CmsUser loginUser(CmsRequestContext context, java.lang.String username, java.lang.String password, java.lang.String remoteAddress) throws CmsException
context
- the current request contextusername
- the name of the user to be logged inpassword
- the password of the userremoteAddress
- the ip address of the requestCmsException
- if the login was not successfulpublic I_CmsPrincipal lookupPrincipal(CmsRequestContext context, CmsUUID principalId)
context
- the current request contextprincipalId
- the UUID of the principal to lookupnull
public I_CmsPrincipal lookupPrincipal(CmsRequestContext context, java.lang.String principalName)
context
- the current request contextprincipalName
- the name of the principal to lookupnull
public void markResourceAsVisitedBy(CmsRequestContext context, java.lang.String poolName, CmsResource resource, CmsUser user) throws CmsException
context
- the request contextpoolName
- the name of the database pool to useresource
- the resource to mark as visiteduser
- the user that visited the resourceCmsException
- if something goes wrongpublic CmsPublishList mergePublishLists(CmsRequestContext context, CmsPublishList pubList1, CmsPublishList pubList2) throws CmsException
context
- the current request contextpubList1
- the first publish listpubList2
- the second publish listCmsException
- if something goes wrongCmsPublishManager.mergePublishLists(CmsObject, CmsPublishList, CmsPublishList)
protected void moveResource(CmsDbContext dbc, CmsResource source, java.lang.String destination) throws CmsException
dbc
- the db contextsource
- the source resourcedestination
- the destination pathCmsException
- if something goes wrongpublic void moveResource(CmsRequestContext context, CmsResource source, java.lang.String destination) throws CmsException, CmsSecurityException
You must ensure that the destination path is an absolute, valid and existing VFS path. Relative paths from the source are currently not supported.
The moved resource will always be locked to the current user after the move operation.
In case the target resource already exists, it is overwritten with the source resource.
context
- the current request contextsource
- the resource to copydestination
- the name of the copy destination with complete pathCmsException
- if something goes wrongCmsSecurityException
- if resource could not be copiedCmsObject.moveResource(String, String)
,
I_CmsResourceType.moveResource(CmsObject, CmsSecurityManager, CmsResource, String)
public java.lang.String moveToLostAndFound(CmsRequestContext context, CmsResource resource, boolean returnNameOnly) throws CmsException
The method can also be used to check get the name of a resource
in the "lost and found" folder only without actually moving the
the resource. To do this, the returnNameOnly
flag
must be set to true
.
In general, it is the same name as the given resource has, the only exception is if a resource in the "lost and found" folder with the same name already exists. In such case, a counter is added to the resource name.
context
- the current request contextresource
- the resource to apply this operation toreturnNameOnly
- if true
, only the name of the resource in the "lost and found"
folder is returned, the move operation is not really performedCmsException
- if something goes wrongCmsObject.moveToLostAndFound(String)
,
CmsObject.getLostAndFoundName(String)
public static CmsSecurityManager newInstance(CmsConfigurationManager configurationManager, I_CmsDbContextFactory runtimeInfoFactory, CmsPublishEngine publishEngine) throws CmsInitException
configurationManager
- the configuration managerruntimeInfoFactory
- the initialized OpenCms runtime info factorypublishEngine
- the publish engineCmsInitException
- if the security manager could not be initializedpublic CmsUUID publishProject(CmsObject cms, CmsPublishList publishList, I_CmsReport report) throws CmsException
cms
- the current request contextpublishList
- a publish listreport
- an instance of I_CmsReport
to print messagesCmsException
- if something goes wrongfillPublishList(CmsRequestContext, CmsPublishList)
public CmsAlias readAliasByPath(CmsRequestContext context, java.lang.String siteRoot, java.lang.String path) throws CmsException
context
- the current request contextsiteRoot
- the site rootpath
- the site relative alias pathCmsException
- if something goes wrongpublic java.util.List<CmsAlias> readAliasesById(CmsRequestContext context, CmsUUID structureId) throws CmsException
context
- the current request contextstructureId
- the structure id for which the aliases should be readCmsException
- if something goes wrongpublic java.util.List<I_CmsHistoryResource> readAllAvailableVersions(CmsRequestContext context, CmsResource resource) throws CmsException
The reading excludes the file content, if the resource is a file.
context
- the current request contextresource
- the resource to be readI_CmsHistoryResource
objectsCmsException
- if something goes wrongpublic java.util.List<CmsPropertyDefinition> readAllPropertyDefinitions(CmsRequestContext context) throws CmsException
context
- the current request contextCmsPropertyDefinition
objects (may be empty)CmsException
- if something goes wrongpublic java.util.List<CmsResource> readAllSubscribedResources(CmsRequestContext context, java.lang.String poolName, CmsPrincipal principal) throws CmsException
context
- the request contextpoolName
- the name of the database pool to useprincipal
- the principal to read the subscribed resourcesCmsException
- if something goes wrongpublic java.util.List<java.lang.String> readAllUrlNameMappingEntries(CmsRequestContext context, CmsUUID id) throws CmsException
context
- the request contextid
- the structure idCmsException
- if something goes wrongpublic CmsFolder readAncestor(CmsRequestContext context, CmsResource resource, CmsResourceFilter filter) throws CmsException
If no folder matching the filter criteria is found, null is returned.
context
- the context of the current requestresource
- the resource to startfilter
- the resource filter to match while reading the ancestorsnull
if no folder was foundCmsException
- if something goes wrongpublic java.lang.String readBestUrlName(CmsRequestContext context, CmsUUID id, java.util.Locale locale, java.util.List<java.util.Locale> defaultLocales) throws CmsException
If the structure id is not mapped to any name, null will be returned.
context
- the request contextid
- the structure id for which the newest mapped name should be returnedlocale
- the locale for the mappingdefaultLocales
- the default locales to use if there is no URL name mapping for the requested localeCmsException
- if something goes wrongpublic java.util.List<CmsResource> readChildResources(CmsRequestContext context, CmsResource resource, CmsResourceFilter filter, boolean getFolders, boolean getFiles) throws CmsException, CmsSecurityException
With the parameters getFolders
and getFiles
you can control what type of resources you want in the result list:
files, folders, or both.
This method is mainly used by the workplace explorer.
context
- the current request contextresource
- the resource to return the child resources forfilter
- the resource filter to usegetFolders
- if true the child folders are included in the resultgetFiles
- if true the child files are included in the resultCmsException
- if something goes wrongCmsSecurityException
- if the user has insufficient permission for the given resource (read is required)public CmsResource readDefaultFile(CmsRequestContext context, CmsResource resource, CmsResourceFilter resourceFilter) throws CmsSecurityException
If the given resource is a file, then this file is returned.
Otherwise, in case of a folder:
CmsPropertyDefinition.PROPERTY_DEFAULT_FILE
is checked, and
opencms-vfs.xml
configuration are iterated until a match is
found, and
null
is returned
context
- the request contextresource
- the folder to get the default file forresourceFilter
- the resource filterCmsSecurityException
- if the user has no permissions to read the resulting fileCmsObject.readDefaultFile(String)
public java.util.List<I_CmsHistoryResource> readDeletedResources(CmsRequestContext context, CmsResource resource, boolean readTree) throws CmsException
context
- the current request contextresource
- the parent resource to read the resources fromreadTree
- true
to read all subresourcesI_CmsHistoryResource
objectsCmsException
- if something goes wrongCmsObject.readResource(CmsUUID, int)
,
CmsObject.readResources(String, CmsResourceFilter, boolean)
,
CmsObject.readDeletedResources(String, boolean)
public CmsFile readFile(CmsRequestContext context, CmsResource resource) throws CmsException
In case you do not need the file content,
use
instead.readResource(CmsRequestContext, String, CmsResourceFilter)
context
- the current request contextresource
- the resource to be readCmsException
- if something goes wrongprotected CmsFolder readFolder(CmsDbContext dbc, java.lang.String resourcename, CmsResourceFilter filter) throws CmsException
dbc
- the current database contextresourcename
- the name of the folder to read (full path)filter
- the resource filter to use while readingCmsException
- if something goes wrongpublic CmsFolder readFolder(CmsRequestContext context, java.lang.String resourcename, CmsResourceFilter filter) throws CmsException
The specified filter controls what kind of resources should be "found"
during the read operation. This will depend on the application. For example,
using
will only return currently
"valid" resources, while using CmsResourceFilter.DEFAULT
will ignore the date release / date expired information of the resource.CmsResourceFilter.IGNORE_EXPIRATION
context
- the current request contextresourcename
- the name of the folder to read (full path)filter
- the resource filter to use while readingCmsException
- if something goes wrongpublic CmsGroup readGroup(CmsRequestContext context, CmsProject project)
context
- the current request contextproject
- the project to read frompublic CmsGroup readGroup(CmsRequestContext context, CmsUUID groupId) throws CmsException
context
- the current request contextgroupId
- the id of the group that is to be readCmsException
- if operation was not successfulpublic CmsGroup readGroup(CmsRequestContext context, java.lang.String groupname) throws CmsException
context
- the current request contextgroupname
- the name of the group that is to be readCmsException
- if operation was not successfulpublic CmsHistoryPrincipal readHistoricalPrincipal(CmsRequestContext context, CmsUUID principalId) throws CmsException
context
- the current request contextprincipalId
- the id of the principal to readCmsException
- if something goes wrong, ie. CmsDbEntryNotFoundException
CmsObject.readUser(CmsUUID)
,
CmsObject.readGroup(CmsUUID)
,
CmsObject.readHistoryPrincipal(CmsUUID)
public CmsHistoryProject readHistoryProject(CmsRequestContext context, CmsUUID projectId) throws CmsException
context
- the current request contextprojectId
- the project idCmsException
- if something goes wrongpublic CmsHistoryProject readHistoryProject(CmsRequestContext context, int publishTag) throws CmsException
context
- the current request contextpublishTag
- the publish tag of the projectCmsException
- if something goes wrongpublic java.util.List<CmsProperty> readHistoryPropertyObjects(CmsRequestContext context, I_CmsHistoryResource resource) throws CmsException
CmsProperty
objects that belong to the given historical resource.context
- the current request contextresource
- the historical resource entry to read the properties forCmsProperty
objectsCmsException
- if something goes wrongpublic CmsUUID readIdForUrlName(CmsRequestContext context, java.lang.String name) throws CmsException
context
- the request contextname
- an URL nameCmsException
- if something goes wrongpublic void readLocks() throws CmsException
CmsException
- if something goes wrongpublic CmsGroup readManagerGroup(CmsRequestContext context, CmsProject project)
context
- the current request contextproject
- the project to read frompublic CmsOrganizationalUnit readOrganizationalUnit(CmsRequestContext context, java.lang.String ouFqn) throws CmsException
context
- the current request contextouFqn
- the fully qualified name of the organizational Unit to be readCmsException
- if something goes wrongpublic CmsUser readOwner(CmsRequestContext context, CmsProject project) throws CmsException
context
- the current request contextproject
- the project to get the owner fromCmsException
- if something goes wrongpublic CmsResource readParentFolder(CmsRequestContext context, CmsUUID structureId) throws CmsException
context
- the current request contextstructureId
- the child structure idCmsResource
CmsException
- if something goes wrongpublic java.util.List<CmsResource> readPath(CmsRequestContext context, java.lang.String path, CmsResourceFilter filter) throws CmsException
context
- the current request contextpath
- the requested pathfilter
- a filter object (only "includeDeleted" information is used!)CmsResource
sCmsException
- if something goes wrongpublic CmsProject readProject(CmsUUID id) throws CmsException
id
- the id of the projectCmsException
- if something goes wrongpublic CmsProject readProject(java.lang.String name) throws CmsException
Important: Since a project name can be used multiple times, this is NOT the most efficient
way to read the project. This is only a convenience for front end developing.
Reading a project by name will return the first project with that name.
All core classes must use the id version readProject(CmsUUID)
to ensure the right project is read.
name
- the name of the projectCmsException
- if something goes wrongpublic java.util.List<java.lang.String> readProjectResources(CmsRequestContext context, CmsProject project) throws CmsException
context
- the current request contextproject
- the project to get the project resources forString
objects
that define the "view" of the given projectCmsException
- if something goes wrongpublic java.util.List<CmsResource> readProjectView(CmsRequestContext context, CmsUUID projectId, CmsResourceState state) throws CmsException
Possible values for the state
parameter are:
CmsResource.STATE_CHANGED
: Read all "changed" resources in the projectCmsResource.STATE_NEW
: Read all "new" resources in the projectCmsResource.STATE_DELETED
: Read all "deleted" resources in the projectCmsResource.STATE_KEEP
: Read all resources either "changed", "new" or "deleted" in the projectcontext
- the current request contextprojectId
- the id of the project to read the file resources forstate
- the resource state to matchCmsResource
objects matching the filter criteriaCmsException
- if something goes wrongCmsObject.readProjectView(CmsUUID, CmsResourceState)
public CmsPropertyDefinition readPropertyDefinition(CmsRequestContext context, java.lang.String name) throws CmsException
If no property definition with the given name is found,
null
is returned.
context
- the current request contextname
- the name of the property definition to readCmsException
- a CmsDbEntryNotFoundException is thrown if the property definition does not existpublic CmsProperty readPropertyObject(CmsRequestContext context, CmsResource resource, java.lang.String key, boolean search) throws CmsException
Returns
if the property is not found.CmsProperty.getNullProperty()
context
- the context of the current requestresource
- the resource where the property is mapped tokey
- the property key namesearch
- if true
, the property is searched on all parent folders of the resource.
if it's not found attached directly to the resource.CmsProperty.getNullProperty()
if the property was not foundCmsException
- if something goes wrongpublic java.util.List<CmsProperty> readPropertyObjects(CmsRequestContext context, CmsResource resource, boolean search) throws CmsException
Returns an empty list if no properties are found.
If the search
parameter is true
, the properties of all
parent folders of the resource are also read. The results are merged with the
properties directly attached to the resource. While merging, a property
on a parent folder that has already been found will be ignored.
So e.g. if a resource has a property "Title" attached, and it's parent folder
has the same property attached but with a different value, the result list will
contain only the property with the value from the resource, not form the parent folder(s).
context
- the context of the current requestresource
- the resource where the property is mapped tosearch
- true
, if the properties should be searched on all parent folders if not found on the resourceCmsProperty
objectsCmsException
- if something goes wrongpublic java.util.List<CmsPublishedResource> readPublishedResources(CmsRequestContext context, CmsUUID publishHistoryId) throws CmsException
context
- the current request contextpublishHistoryId
- unique ID to identify each publish task in the publish historyCmsPublishedResource
objectsCmsException
- if something goes wrongprotected CmsResource readResource(CmsDbContext dbc, CmsUUID structureID, CmsResourceFilter filter) throws CmsException
dbc
- the current database contextstructureID
- the ID of the structure to readfilter
- the resource filter to use while readingCmsException
- if something goes wrongCmsObject.readResource(CmsUUID, CmsResourceFilter)
,
CmsObject.readResource(CmsUUID)
,
CmsObject.readFile(CmsResource)
protected CmsResource readResource(CmsDbContext dbc, java.lang.String resourcePath, CmsResourceFilter filter) throws CmsException
dbc
- the current database contextresourcePath
- the name of the resource to read (full path)filter
- the resource filter to use while readingCmsException
- if something goes wrongCmsObject.readResource(String, CmsResourceFilter)
,
CmsObject.readResource(String)
,
CmsObject.readFile(CmsResource)
public I_CmsHistoryResource readResource(CmsRequestContext context, CmsResource resource, int version) throws CmsException
context
- the current request contextresource
- the resource to be read the version forversion
- the version number to retrieveCmsException
- if the resource could not be read for any reasonCmsObject.readFile(CmsResource)
,
CmsObject.restoreResourceVersion(CmsUUID, int)
,
CmsObject.readResource(CmsUUID, int)
public CmsResource readResource(CmsRequestContext context, CmsUUID structureID, CmsResourceFilter filter) throws CmsException
A resource may be of type
or
CmsFile
. In case of
a file, the resource will not contain the binary file content. Since reading
the binary content is a cost-expensive database operation, it's recommended
to work with resources if possible, and only read the file content when absolutely
required. To "upgrade" a resource to a file,
use CmsFolder
.CmsObject.readFile(CmsResource)
The specified filter controls what kind of resources should be "found"
during the read operation. This will depend on the application. For example,
using
will only return currently
"valid" resources, while using CmsResourceFilter.DEFAULT
will ignore the date release / date expired information of the resource.CmsResourceFilter.IGNORE_EXPIRATION
context
- the current request contextstructureID
- the ID of the structure which will be used)filter
- the resource filter to use while readingCmsException
- if the resource could not be read for any reasonCmsObject.readResource(CmsUUID, CmsResourceFilter)
,
CmsObject.readResource(CmsUUID)
,
CmsObject.readFile(CmsResource)
public CmsResource readResource(CmsRequestContext context, java.lang.String resourcePath, CmsResourceFilter filter) throws CmsException
A resource may be of type
or
CmsFile
. In case of
a file, the resource will not contain the binary file content. Since reading
the binary content is a cost-expensive database operation, it's recommended
to work with resources if possible, and only read the file content when absolutely
required. To "upgrade" a resource to a file,
use CmsFolder
.CmsObject.readFile(CmsResource)
The specified filter controls what kind of resources should be "found"
during the read operation. This will depend on the application. For example,
using
will only return currently
"valid" resources, while using CmsResourceFilter.DEFAULT
will ignore the date release / date expired information of the resource.CmsResourceFilter.IGNORE_EXPIRATION
context
- the current request contextresourcePath
- the name of the resource to read (full path)filter
- the resource filter to use while readingCmsException
- if the resource could not be read for any reasonCmsObject.readResource(String, CmsResourceFilter)
,
CmsObject.readResource(String)
,
CmsObject.readFile(CmsResource)
public java.util.List<CmsResource> readResources(CmsRequestContext context, CmsResource parent, CmsResourceFilter filter, boolean readTree) throws CmsException, CmsSecurityException
readTree
parameter is true
.context
- the current request contextparent
- the parent path to read the resources fromfilter
- the filterreadTree
- true
to read all subresourcesCmsResource
objects matching the filter criteriaCmsSecurityException
- if the user has insufficient permission for the given resource (read is required)CmsException
- if something goes wrongpublic java.util.List<CmsResource> readResourcesVisitedBy(CmsRequestContext context, java.lang.String poolName, CmsVisitedByFilter filter) throws CmsException
context
- the request contextpoolName
- the name of the database pool to usefilter
- the filter that is used to get the visited resourcesCmsException
- if something goes wrongpublic java.util.List<CmsResource> readResourcesWithProperty(CmsRequestContext context, CmsResource folder, java.lang.String propertyDefinition, java.lang.String value, CmsResourceFilter filter) throws CmsException
If the value
parameter is null
, all resources having the
given property set are returned.
Both individual and shared properties of a resource are checked.
context
- the current request contextfolder
- the folder to get the resources with the property frompropertyDefinition
- the name of the property (definition) to check forvalue
- the string to search in the value of the propertyfilter
- the resource filter to apply to the result setCmsResource
objects
that have a value set for the specified property.CmsException
- if something goes wrongpublic java.util.Set<I_CmsPrincipal> readResponsiblePrincipals(CmsRequestContext context, CmsResource resource) throws CmsException
context
- the current request contextresource
- the resource to get the responsible users fromCmsException
- if something goes wrongpublic java.util.Set<CmsUser> readResponsibleUsers(CmsRequestContext context, CmsResource resource) throws CmsException
context
- the current request contextresource
- the resource to get the responsible users fromCmsException
- if something goes wrongpublic java.util.List<CmsResource> readSiblings(CmsRequestContext context, CmsResource resource, CmsResourceFilter filter) throws CmsException
context
- the request contextresource
- the specified resourcefilter
- a filter objectCmsResource
s that
are siblings to the specified resource,
including the specified resource itselfCmsException
- if something goes wrongpublic java.lang.String readStaticExportPublishedResourceParameters(CmsRequestContext context, java.lang.String rfsName) throws CmsException
context
- the current request contextrfsName
- the rfs name of the resourceCmsException
- if something goes wrongpublic java.util.List<java.lang.String> readStaticExportResources(CmsRequestContext context, int parameterResources, long timestamp) throws CmsException
context
- the current request contextparameterResources
- flag for reading resources with parameters (1) or without (0)timestamp
- for reading the data from the dbString
objectsCmsException
- if something goes wrongpublic java.util.List<I_CmsHistoryResource> readSubscribedDeletedResources(CmsRequestContext context, java.lang.String poolName, CmsUser user, java.util.List<CmsGroup> groups, CmsResource parent, boolean includeSubFolders, long deletedFrom) throws CmsException
context
- the request contextpoolName
- the name of the database pool to useuser
- the user that subscribed to the resourcegroups
- the groups to check subscribed resources forparent
- the parent resource (folder) of the deleted resources, if null
all deleted resources will be returnedincludeSubFolders
- indicates if the sub folders of the specified folder path should be considered, toodeletedFrom
- the time stamp from which the resources should have been deletedCmsException
- if something goes wrongpublic java.util.List<CmsResource> readSubscribedResources(CmsRequestContext context, java.lang.String poolName, CmsSubscriptionFilter filter) throws CmsException
context
- the request contextpoolName
- the name of the database pool to usefilter
- the filter that is used to get the subscribed resourcesCmsException
- if something goes wrongpublic java.util.List<CmsUrlNameMappingEntry> readUrlNameMappings(CmsRequestContext context, CmsUrlNameMappingFilter filter) throws CmsException
context
- the current request contextfilter
- the filter to matchCmsException
- if something goes wrongpublic java.util.List<java.lang.String> readUrlNamesForAllLocales(CmsRequestContext context, CmsUUID id) throws CmsException
context
- the current contextid
- a structure idCmsException
- if something goes wrongpublic CmsUser readUser(CmsRequestContext context, CmsUUID id) throws CmsException
context
- the current request contextid
- the id of the user to readCmsException
- if something goes wrongpublic CmsUser readUser(CmsRequestContext context, java.lang.String username) throws CmsException
context
- the current request contextusername
- the name of the user that is to be readCmsException
- if operation was not successfulpublic CmsUser readUser(CmsRequestContext context, java.lang.String username, java.lang.String password) throws CmsException
If the user/password pair is not valid a
is thrown.CmsException
context
- the current request contextusername
- the user name of the user that is to be readpassword
- the password of the user that is to be readCmsException
- if operation was not successfulpublic void removeAccessControlEntry(CmsRequestContext context, CmsResource resource, CmsUUID principal) throws CmsException, CmsSecurityException
context
- the current request contextresource
- the resourceprincipal
- the id of the principal to remove the the access control entry forCmsException
- if something goes wrongCmsSecurityException
- if the user has insufficient permission for the given resource (control of access control is required).public void removeResourceFromOrgUnit(CmsRequestContext context, CmsOrganizationalUnit orgUnit, CmsResource resource) throws CmsException
context
- the current request contextorgUnit
- the organizational unit to remove the resource fromresource
- the resource that is to be removed from the organizational unitCmsException
- if something goes wrongCmsOrgUnitManager.addResourceToOrgUnit(CmsObject, String, String)
,
CmsOrgUnitManager.addResourceToOrgUnit(CmsObject, String, String)
public void removeResourceFromProject(CmsRequestContext context, CmsResource resource) throws CmsException, CmsRoleViolationException
context
- the current request contextresource
- the resource to apply this operation toCmsException
- if something goes wrongCmsRoleViolationException
- if the current user does not have management access to the projectI_CmsResourceType.copyResourceToProject(CmsObject, CmsSecurityManager, CmsResource)
public void removeResourceFromUsersPubList(CmsRequestContext context, java.util.Collection<CmsUUID> structureIds) throws CmsException
context
- the request contextstructureIds
- the collection of structure IDs to removeCmsException
- if something goes wrongpublic void removeUserFromGroup(CmsRequestContext context, java.lang.String username, java.lang.String groupname, boolean readRoles) throws CmsException, CmsRoleViolationException
context
- the current request contextusername
- the name of the user that is to be removed from the groupgroupname
- the name of the groupreadRoles
- if to read roles or groupsCmsException
- if operation was not successfulCmsRoleViolationException
- if the current user does not own the rule CmsRole.ACCOUNT_MANAGER
public void replaceResource(CmsRequestContext context, CmsResource resource, int type, byte[] content, java.util.List<CmsProperty> properties) throws CmsException, CmsSecurityException
context
- the current request contextresource
- the name of the resource to apply this operation totype
- the new type of the resourcecontent
- the new content of the resourceproperties
- the new properties of the resourceCmsException
- if something goes wrongCmsSecurityException
- if the user has insufficient permission for the given resource (write access permission is required)CmsObject.replaceResource(String, int, byte[], List)
,
I_CmsResourceType.replaceResource(CmsObject, CmsSecurityManager, CmsResource, int, byte[], List)
public void resetPassword(CmsRequestContext context, java.lang.String username, java.lang.String oldPassword, java.lang.String newPassword) throws CmsException, CmsSecurityException
context
- the current request contextusername
- the name of the useroldPassword
- the old passwordnewPassword
- the new passwordCmsException
- if the user data could not be read from the databaseCmsSecurityException
- if the specified user name and old password could not be verifiedpublic java.lang.String resourceOriginalPath(CmsRequestContext context, CmsResource resource) throws CmsException
If it differs from the offline path, the resource has been moved.
context
- the current request contextresource
- the resource to get the path forCmsException
- if something goes wrongorg.opencms.workplace.commons.CmsUndoChanges#resourceOriginalPath(CmsObject, String)
public void restoreDeletedResource(CmsRequestContext context, CmsUUID structureId) throws CmsException
context
- the current request contextstructureId
- the structure id of the resource to restoreCmsException
- if something goes wrongCmsObject.restoreDeletedResource(CmsUUID)
public void restoreResource(CmsRequestContext context, CmsResource resource, int version) throws CmsException, CmsSecurityException
context
- the current request contextresource
- the resource to restore from the archiveversion
- the version number to restoreCmsException
- if something goes wrongCmsSecurityException
- if the user has insufficient permission for the given resource (write access permission is required)CmsObject.restoreResourceVersion(CmsUUID, int)
,
I_CmsResourceType.restoreResource(CmsObject, CmsSecurityManager, CmsResource, int)
public void saveAliases(CmsRequestContext context, CmsResource resource, java.util.List<CmsAlias> aliases) throws CmsException
This method completely replaces any existing aliases for the same structure id.
context
- the request contextresource
- the resource for which the aliases should be writtenaliases
- the list of aliases to write, where all aliases must have the same structure id as the resourceCmsException
- if something goes wrongpublic void saveRewriteAliases(CmsRequestContext requestContext, java.lang.String siteRoot, java.util.List<CmsRewriteAlias> newAliases) throws CmsException
requestContext
- the current request contextsiteRoot
- the site root for which the rewrite aliases should be replacednewAliases
- the new list of aliases for the given site rootCmsException
- if something goes wrongpublic java.util.List<CmsUser> searchUsers(CmsRequestContext requestContext, CmsUserSearchParameters searchParams) throws CmsException
requestContext
- the request contextsearchParams
- the search criteria objectCmsException
- if something goes wrongpublic void setDateExpired(CmsRequestContext context, CmsResource resource, long dateExpired) throws CmsException, CmsSecurityException
context
- the current request contextresource
- the resource to touchdateExpired
- the new expire date of the changed resourceCmsException
- if something goes wrongCmsSecurityException
- if the user has insufficient permission for the given resource (write access permission is required)CmsObject.setDateExpired(String, long, boolean)
,
I_CmsResourceType.setDateExpired(CmsObject, CmsSecurityManager, CmsResource, long, boolean)
public void setDateLastModified(CmsRequestContext context, CmsResource resource, long dateLastModified) throws CmsException, CmsSecurityException
context
- the current request contextresource
- the resource to touchdateLastModified
- the new time stamp of the changed resourceCmsException
- if something goes wrongCmsSecurityException
- if the user has insufficient permission for the given resource (write access permission is required)CmsObject.setDateLastModified(String, long, boolean)
,
I_CmsResourceType.setDateLastModified(CmsObject, CmsSecurityManager, CmsResource, long, boolean)
public void setDateReleased(CmsRequestContext context, CmsResource resource, long dateReleased) throws CmsException, CmsSecurityException
context
- the current request contextresource
- the resource to touchdateReleased
- the new release date of the changed resourceCmsException
- if something goes wrongCmsSecurityException
- if the user has insufficient permission for the given resource (write access permission is required)CmsObject.setDateReleased(String, long, boolean)
,
I_CmsResourceType.setDateReleased(CmsObject, CmsSecurityManager, CmsResource, long, boolean)
public void setParentGroup(CmsRequestContext context, java.lang.String groupName, java.lang.String parentGroupName) throws CmsException, CmsRoleViolationException
context
- the current request contextgroupName
- the name of the group that should be writtenparentGroupName
- the name of the parent group to set,
or null
if the parent
group should be deleted.CmsException
- if operation was not successfulCmsRoleViolationException
- if the current user does not own the rule CmsRole.ACCOUNT_MANAGER
public void setPassword(CmsRequestContext context, java.lang.String username, java.lang.String newPassword) throws CmsException, CmsRoleViolationException
context
- the current request contextusername
- the name of the usernewPassword
- the new passwordCmsException
- if operation was not successfulCmsRoleViolationException
- if the current user does not own the rule CmsRole.ACCOUNT_MANAGER
public void setSubscribedResourceAsDeleted(CmsRequestContext context, java.lang.String poolName, CmsResource resource) throws CmsException
context
- the request contextpoolName
- the name of the database pool to useresource
- the subscribed resource to mark as deletedCmsException
- if something goes wrongpublic void setUsersOrganizationalUnit(CmsRequestContext context, CmsOrganizationalUnit orgUnit, CmsUser user) throws CmsException
context
- the current request contextorgUnit
- the organizational unit to add the principal touser
- the user that is to be move to the organizational unitCmsException
- if something goes wrongCmsOrgUnitManager.setUsersOrganizationalUnit(CmsObject, String, String)
public void subscribeResourceFor(CmsRequestContext context, java.lang.String poolName, CmsPrincipal principal, CmsResource resource) throws CmsException
context
- the request contextpoolName
- the name of the database pool to useprincipal
- the principal that subscribes to the resourceresource
- the resource to subscribe toCmsException
- if something goes wrongpublic void undelete(CmsRequestContext context, CmsResource resource) throws CmsException
context
- the current request contextresource
- the name of the resource to apply this operation toCmsException
- if something goes wrongCmsObject.undeleteResource(String, boolean)
,
I_CmsResourceType.undelete(CmsObject, CmsSecurityManager, CmsResource, boolean)
public void undoChanges(CmsRequestContext context, CmsResource resource, CmsResource.CmsResourceUndoMode mode) throws CmsException, CmsSecurityException
context
- the current request contextresource
- the name of the resource to apply this operation tomode
- the undo mode, one of the CmsResource
#UNDO_XXX
constantsCmsException
- if something goes wrongCmsSecurityException
- if the user has insufficient permission for the given resource (write access permission is required)CmsObject.undoChanges(String, CmsResource.CmsResourceUndoMode)
,
I_CmsResourceType.undoChanges(CmsObject, CmsSecurityManager, CmsResource, CmsResource.CmsResourceUndoMode)
public void unlockProject(CmsRequestContext context, CmsUUID projectId) throws CmsException, CmsRoleViolationException
context
- the current request contextprojectId
- the id of the project to be publishedCmsException
- if something goes wrongCmsRoleViolationException
- if the current user does not own the required permissionspublic void unlockResource(CmsRequestContext context, CmsResource resource) throws CmsException, CmsSecurityException
context
- the current request contextresource
- the resource to unlockCmsException
- if something goes wrongCmsSecurityException
- if the user has insufficient permission for the given resource (write access permission is required)CmsObject.unlockResource(String)
,
I_CmsResourceType.unlockResource(CmsObject, CmsSecurityManager, CmsResource)
public void unsubscribeAllDeletedResources(CmsRequestContext context, java.lang.String poolName, long deletedTo) throws CmsException
context
- the request contextpoolName
- the name of the database pool to usedeletedTo
- the time stamp to which the resources have been deletedCmsException
- if something goes wrongpublic void unsubscribeAllResourcesFor(CmsRequestContext context, java.lang.String poolName, CmsPrincipal principal) throws CmsException
context
- the request contextpoolName
- the name of the database pool to useprincipal
- the principal that unsubscribes from all resourcesCmsException
- if something goes wrongpublic void unsubscribeResourceFor(CmsRequestContext context, java.lang.String poolName, CmsPrincipal principal, CmsResource resource) throws CmsException
context
- the request contextpoolName
- the name of the database pool to useprincipal
- the principal that unsubscribes from the resourceresource
- the resource to unsubscribe fromCmsException
- if something goes wrongpublic void unsubscribeResourceForAll(CmsRequestContext context, java.lang.String poolName, CmsResource resource) throws CmsException
context
- the request contextpoolName
- the name of the database pool to useresource
- the resource to unsubscribe all groups and users fromCmsException
- if something goes wrongpublic void updateLog() throws CmsException
CmsException
- if something goes wrongpublic void updateRelationsForResource(CmsRequestContext context, CmsResource resource, java.util.List<CmsLink> relations) throws CmsException
context
- the current user contextresource
- the resource to update the relations forrelations
- the relations to updateCmsException
- if something goes wrongCmsDriverManager.updateRelationsForResource(CmsDbContext, CmsResource, List)
public boolean userInGroup(CmsRequestContext context, java.lang.String username, java.lang.String groupname) throws CmsException
context
- the current request contextusername
- the name of the user to checkgroupname
- the name of the group to checktrue
, if the user is in the group; or false
otherwiseCmsException
- if operation was not successfulpublic void validatePassword(java.lang.String password) throws CmsSecurityException
I_CmsPasswordHandler
interface and configured in the opencms.properties file.If this method throws no exception the password is valid.
password
- the new password that has to be checkedCmsSecurityException
- if the password is not validpublic java.util.Map<java.lang.String,java.util.List<CmsRelation>> validateRelations(CmsRequestContext context, CmsPublishList publishList, I_CmsReport report) throws java.lang.Exception
context
- the current request contextpublishList
- the resources to validate during publishingreport
- a report to write the messages toCmsRelation
}
objects)
keyed by root pathsjava.lang.Exception
- if something goes wrongpublic void writeAccessControlEntry(CmsRequestContext context, CmsResource resource, CmsAccessControlEntry ace) throws CmsException, CmsSecurityException
context
- the current request contextresource
- the resourceace
- the entry to writeCmsSecurityException
- if the user has insufficient permission for the given resource (CmsPermissionSet.ACCESS_CONTROL
required)CmsException
- if something goes wrongpublic CmsFile writeFile(CmsRequestContext context, CmsFile resource) throws CmsException, CmsSecurityException
Applies only to resources of type
i.e. resources that have a binary content attached.CmsFile
Certain resource types might apply content validation or transformation rules before the resource is actually written to the VFS. The returned result might therefore be a modified version from the provided original.
context
- the current request contextresource
- the resource to apply this operation toCmsSecurityException
- if the user has insufficient permission for the given resource (CmsPermissionSet.ACCESS_WRITE
required)CmsException
- if something goes wrongCmsObject.writeFile(CmsFile)
,
I_CmsResourceType.writeFile(CmsObject, CmsSecurityManager, CmsFile)
public void writeGroup(CmsRequestContext context, CmsGroup group) throws CmsException, CmsRoleViolationException
The group id has to be a valid OpenCms group id.
The group with the given id will be completely overridden
by the given data.
context
- the current request contextgroup
- the group that should be writtenCmsRoleViolationException
- if the current user does not own the role CmsRole.ACCOUNT_MANAGER
for the current projectCmsException
- if operation was not successfulpublic void writeHistoryProject(CmsRequestContext context, int publishTag, long publishDate) throws CmsException
context
- the current request contextpublishTag
- the correlative publish tagpublishDate
- the date of publishingCmsException
- if operation was not successfulpublic void writeLocks() throws CmsException
This overwrites the locks previously stored in the underlying database table.
CmsException
- if something goes wrongpublic void writeOrganizationalUnit(CmsRequestContext context, CmsOrganizationalUnit organizationalUnit) throws CmsException
The organizational unit id has to be a valid OpenCms organizational unit id.
The organizational unit with the given id will be completely overridden by the given data.
context
- the current request contextorganizationalUnit
- the organizational unit that should be writtenCmsException
- if operation was not successfulCmsOrgUnitManager.writeOrganizationalUnit(CmsObject, CmsOrganizationalUnit)
public void writeProject(CmsRequestContext context, CmsProject project) throws CmsRoleViolationException, CmsException
The project id has to be a valid OpenCms project id.
The project with the given id will be completely overridden
by the given data.
project
- the project that should be writtencontext
- the current request contextCmsRoleViolationException
- if the current user does not own the required permissionsCmsException
- if operation was not successfulpublic void writePropertyObject(CmsRequestContext context, CmsResource resource, CmsProperty property) throws CmsException, CmsSecurityException
context
- the current request contextresource
- the resource to write the property forproperty
- the property to writeCmsException
- if something goes wrongCmsSecurityException
- if the user has insufficient permission for the given resource (CmsPermissionSet.ACCESS_WRITE
required)CmsObject.writePropertyObject(String, CmsProperty)
,
I_CmsResourceType.writePropertyObject(CmsObject, CmsSecurityManager, CmsResource, CmsProperty)
public void writePropertyObjects(CmsRequestContext context, CmsResource resource, java.util.List<CmsProperty> properties) throws CmsException, CmsSecurityException
Code calling this method has to ensure that the no properties
a, b
are contained in the specified list so that a.equals(b)
,
otherwise an exception is thrown.
context
- the current request contextresource
- the resource to write the properties forproperties
- the list of properties to writeCmsException
- if something goes wrongCmsSecurityException
- if the user has insufficient permission for the given resource (CmsPermissionSet.ACCESS_WRITE
required)CmsObject.writePropertyObjects(String, List)
,
I_CmsResourceType.writePropertyObjects(CmsObject, CmsSecurityManager, CmsResource, List)
public void writeResource(CmsRequestContext context, CmsResource resource) throws CmsException, CmsSecurityException
context
- the current request contextresource
- the resource to writeCmsSecurityException
- if the user has insufficient permission for the given resource (CmsPermissionSet.ACCESS_WRITE
required)CmsException
- if something goes wrongpublic void writeResourceProjectLastModified(CmsRequestContext context, CmsResource resource, CmsProject project) throws CmsException
context
- the current database contextresource
- the resource which should be modifiedproject
- the project whose project id should be written into the resource recordCmsException
- if something goes wrongpublic void writeStaticExportPublishedResource(CmsRequestContext context, java.lang.String resourceName, int linkType, java.lang.String linkParameter, long timestamp) throws CmsException
This is done during static export.
context
- the current request contextresourceName
- The name of the resource to be added to the static exportlinkType
- the type of resource exported (0= non-parameter, 1=parameter)linkParameter
- the parameters added to the resourcetimestamp
- a time stamp for writing the data into the dbCmsException
- if something goes wrongpublic java.lang.String writeUrlNameMapping(CmsRequestContext context, java.util.Iterator<java.lang.String> nameSeq, CmsUUID structureId, java.lang.String locale, boolean replaceOnPublish) throws CmsException
The first name from the given sequence which is not already mapped to another resource will be used for the URL name mapping.
context
- the request contextnameSeq
- the sequence of URL name candidatesstructureId
- the structure id which should be mapped to the namelocale
- the locale for the mappingreplaceOnPublish
- mappings for which this is set will replace all other mappings for the same resource on publishingCmsException
- if something goes wrongpublic void writeUser(CmsRequestContext context, CmsUser user) throws CmsException, CmsRoleViolationException
The user id has to be a valid OpenCms user id.
The user with the given id will be completely overridden
by the given data.
context
- the current request contextuser
- the user to be updatedCmsRoleViolationException
- if the current user does not own the rule CmsRole.ACCOUNT_MANAGER
for the current projectCmsException
- if operation was not successful