org.opencms.db
Class CmsSecurityManager

java.lang.Object
  extended byorg.opencms.db.CmsSecurityManager

public final class CmsSecurityManager
extends java.lang.Object

The OpenCms security manager.

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.

Since:
6.0.0
Author:
Thomas Weckert, Michael Moossen

Field Summary
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.
static int PERM_ALLOWED
          Indicates allowed permissions.
static int PERM_DENIED
          Indicates denied permissions.
static int PERM_FILTERED
          Indicates a resource was filtered during permission check.
static int PERM_NOTLOCKED
          Indicates a resource was not locked for a write / control operation.
 
Method Summary
 void acceptTask(CmsRequestContext context, int taskId)
          Updates the state of the given task as accepted by the current user.
 void addUserToGroup(CmsRequestContext context, java.lang.String username, java.lang.String groupname)
          Adds a user to a group.
 CmsUser addWebUser(CmsRequestContext context, java.lang.String name, java.lang.String password, java.lang.String group, java.lang.String description, java.util.Map additionalInfos)
          Creates a new web user.
 CmsUser addWebUser(CmsRequestContext context, java.lang.String name, java.lang.String password, java.lang.String group, java.lang.String additionalGroup, java.lang.String description, java.util.Map additionalInfos)
          Adds a web user to the Cms.
 void backupProject(CmsRequestContext context, int tagId, long publishDate)
          Creates a backup of the current project.
 void changeLastModifiedProjectId(CmsRequestContext context, CmsResource resource)
          Changes the project id of the resource to the current project, indicating that the resource was last modified in this project.
 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 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 changeUserType(CmsRequestContext context, CmsUUID userId, int userType)
          Changes the user type of the user.
 void changeUserType(CmsRequestContext context, java.lang.String username, int userType)
          Changes the user type of the user.
 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, int 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 checkPublishPermissions(CmsRequestContext context, 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.
 void checkRole(CmsRequestContext context, CmsRole role)
          Checks if the user of the current database context has permissions to impersonate the given role.
 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.
protected  void clearPermissionCache()
          Clears the permission cache.
 void copyAccessControlEntries(CmsRequestContext context, CmsResource source, CmsResource destination)
          Copies the access control entries of a given resource to a destination resorce.
 void copyResource(CmsRequestContext context, CmsResource source, java.lang.String destination, int siblingMode)
          Copies a resource.
 void copyResourceToProject(CmsRequestContext context, CmsResource resource)
          Copies a resource to the current project of the user.
 int countLockedResources(CmsRequestContext context, int id)
          Counts the locked resources in this project.
 int countLockedResources(CmsRequestContext context, java.lang.String foldername)
          Counts the locked resources in a given folder.
 CmsGroup createGroup(CmsRequestContext context, java.lang.String name, java.lang.String description, int flags, java.lang.String parent)
          Creates a new user group.
 CmsProject createProject(CmsRequestContext context, java.lang.String name, java.lang.String description, java.lang.String groupname, java.lang.String managergroupname, int projecttype)
          Creates a project.
 CmsPropertyDefinition createPropertyDefinition(CmsRequestContext context, java.lang.String name)
          Creates a property definition.
 CmsResource createResource(CmsRequestContext context, java.lang.String resourcename, int type, byte[] content, java.util.List properties)
          Creates a new resource of the given resource type with the provided content and properties.
 void createSibling(CmsRequestContext context, CmsResource source, java.lang.String destination, java.util.List properties)
          Creates a new sibling of the source resource.
 CmsTask createTask(CmsRequestContext context, CmsUser currentUser, int projectid, java.lang.String agentName, java.lang.String roleName, java.lang.String taskName, java.lang.String taskComment, int taskType, long timeout, int priority)
          Creates a new task.
 CmsTask createTask(CmsRequestContext context, java.lang.String agentName, java.lang.String roleName, java.lang.String taskname, long timeout, int priority)
          Creates a new task.
 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 additionalInfos)
          Creates a new user.
 void deleteAllStaticExportPublishedResources(CmsRequestContext context, int linkType)
          Deletes all entries in the published resource table.
 void deleteBackups(CmsRequestContext context, long timestamp, int versions, I_CmsReport report)
          Deletes the versions from the backup tables that are older then the given timestamp and/or number of remaining versions.
 void deleteGroup(CmsRequestContext context, CmsUUID groupId, CmsUUID replacementId)
          Deletes a group, where all permissions, users and childs of the group are transfered to a replacement group.
 void deleteGroup(CmsRequestContext context, java.lang.String name)
          Delete a user group.
 void deleteProject(CmsRequestContext context, int projectId)
          Deletes a project.
 void deletePropertyDefinition(CmsRequestContext context, java.lang.String name)
          Deletes a property definition.
 void deleteResource(CmsRequestContext context, CmsResource resource, int 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.
 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 deleteWebUser(CmsRequestContext context, CmsUUID userId)
          Deletes a web user.
 void destroy()
          Destroys this security manager.
 void endTask(CmsRequestContext context, int taskid)
          Ends a task.
 boolean existsResource(CmsRequestContext context, java.lang.String resourcePath, CmsResourceFilter filter)
          Checks the availability of a resource in the VFS, using the CmsResourceFilter.DEFAULT filter.
 CmsPublishList fillPublishList(CmsRequestContext context, CmsPublishList publishList)
          Fills the given publish list with the the VFS resources that actually get published.
protected  void finalize()
           
 void forwardTask(CmsRequestContext context, int taskid, java.lang.String newRoleName, java.lang.String newUserName)
          Forwards a task to a new user.
 java.util.List 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 getAllAccessibleProjects(CmsRequestContext context)
          Returns all projects which are owned by the current user or which are accessible for the group of the user.
 java.util.List getAllBackupProjects(CmsRequestContext context)
          Returns a list with all projects from history.
 java.util.List getAllManageableProjects(CmsRequestContext context)
          Returns all projects which are owned by the current user or which are manageable for the group of the user.
 int getBackupTagId(CmsRequestContext context)
          Returns the next version id for the published backup resources.
 java.util.List getChild(CmsRequestContext context, java.lang.String groupname)
          Returns all child groups of a group.
 java.util.List getChilds(CmsRequestContext context, java.lang.String groupname)
          Returns all child groups of a group.
 java.util.Map getConfigurations()
          Gets the configurations of the OpenCms properties file.
 java.util.List getDirectGroupsOfUser(CmsRequestContext context, java.lang.String username)
          Returns the list of groups to which the user directly belongs to.
 java.util.List getGroups(CmsRequestContext context)
          Returns all available groups.
 java.util.List getGroupsOfUser(CmsRequestContext context, java.lang.String username)
          Returns the groups of a user.
 java.util.List getGroupsOfUser(CmsRequestContext context, java.lang.String username, java.lang.String remoteAddress)
          Returns the groups of a Cms user filtered by the specified IP address.
 CmsLock getLock(CmsRequestContext context, CmsResource resource)
          Returns the lock state of a resource.
 CmsGroup getParent(CmsRequestContext context, java.lang.String groupname)
          Returns the parent group of a group.
 CmsPermissionSetCustom getPermissions(CmsRequestContext context, CmsResource resource, CmsUser user)
          Returns the set of permissions of the current user for a given resource.
 java.util.List 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 getResourcesInTimeRange(CmsRequestContext context, java.lang.String folder, long starttime, long endtime)
          Returns a list with all sub resources of the given parent folder (and all of it's subfolders) that have been modified in the given time range.
 CmsSqlManager getSqlManager()
          Returns an instance of the common sql manager.
 java.lang.String getTaskPar(CmsRequestContext context, int taskId, java.lang.String parName)
          Returns the value of the given parameter for the given task.
 int getTaskType(CmsRequestContext context, java.lang.String taskName)
          Get the template task id for a given taskname.
 java.util.List getUsers(CmsRequestContext context)
          Returns all available users.
 java.util.List getUsers(CmsRequestContext context, int type)
          Returns all users from a given type.
 java.util.List getUsersOfGroup(CmsRequestContext context, java.lang.String groupname)
          Returns a list of users in a group.
 boolean hasManagerOfProjectRole(CmsDbContext dbc, CmsProject project)
          Checks if the current user has management access to the given project.
protected  int hasPermissions(CmsDbContext dbc, CmsResource resource, CmsPermissionSet requiredPermissions, boolean checkLock, CmsResourceFilter filter)
          Performs a non-blocking permission check on a resource.
 int hasPermissions(CmsRequestContext context, CmsResource resource, CmsPermissionSet requiredPermissions, boolean checkLock, CmsResourceFilter filter)
          Performs a non-blocking permission check on a resource.
 boolean hasRole(CmsDbContext dbc, CmsRole role)
          Checks if the user of the current database context is a member of the given role.
 boolean hasRole(CmsDbContext dbc, CmsUser user, CmsRole role)
          Checks if the given user is a member of the given role.
 boolean hasRole(CmsRequestContext context, CmsRole role)
          Checks if the user of the given request context is a member of at last one of the roles in the given role set.
 void importAccessControlEntries(CmsRequestContext context, CmsResource resource, java.util.List 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 properties, boolean importCase)
          Creates a new resource with the provided content and properties.
 CmsUser importUser(CmsRequestContext context, java.lang.String id, java.lang.String name, java.lang.String password, java.lang.String description, java.lang.String firstname, java.lang.String lastname, java.lang.String email, java.lang.String address, int flags, int type, java.util.Map additionalInfos)
          Creates a new user by import.
 void init(CmsConfigurationManager configurationManager, I_CmsDbContextFactory dbContextFactory)
          Initializes this security manager with a given runtime info factory.
 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.
 void lockResource(CmsRequestContext context, CmsResource resource, int mode)
          Locks a resource.
 CmsUser loginUser(CmsRequestContext context, java.lang.String username, java.lang.String password, java.lang.String remoteAddress, int userType)
          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.
 java.lang.String moveToLostAndFound(CmsRequestContext context, java.lang.String resourcename, boolean returnNameOnly)
          Moves a resource to the "lost and found" folder.
static CmsSecurityManager newInstance(CmsConfigurationManager configurationManager, I_CmsDbContextFactory runtimeInfoFactory)
          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.
 void reactivateTask(CmsRequestContext context, int taskId)
          Reactivates a task.
 CmsUser readAgent(CmsRequestContext context, CmsTask task)
          Reads the agent of a task.
 java.util.List readAllBackupFileHeaders(CmsRequestContext context, CmsResource resource)
          Reads all file headers of a file.
 java.util.List readAllPropertyDefinitions(CmsRequestContext context)
          Reads all propertydefinitions for the given mapping type.
 CmsFolder readAncestor(CmsRequestContext context, CmsResource resource, CmsResourceFilter filter)
          Returns the first ancestor folder matching the filter criteria.
 CmsBackupResource readBackupFile(CmsRequestContext context, int tagId, CmsResource resource)
          Returns a file from the history.
 CmsBackupProject readBackupProject(CmsRequestContext context, int tagId)
          Returns a backup project.
 java.util.List readBackupPropertyObjects(CmsRequestContext context, CmsBackupResource resource)
          Reads the list of CmsProperty objects that belong the the given backup resource.
 java.util.List 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.
 CmsFile readFile(CmsRequestContext context, CmsResource resource, CmsResourceFilter filter)
          Reads a file resource (including it's binary content) from the VFS, using the specified resource filter.
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.
 java.util.List readGivenTasks(CmsRequestContext context, int projectId, java.lang.String ownerName, int taskType, java.lang.String orderBy, java.lang.String sort)
          Reads all given tasks from a user for a project.
 CmsGroup readGroup(CmsRequestContext context, CmsProject project)
          Reads the group of a project.
 CmsGroup readGroup(CmsRequestContext context, CmsTask task)
          Reads the group (role) of a task from the OpenCms.
 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.
 CmsGroup readManagerGroup(CmsRequestContext context, CmsProject project)
          Reads the manager group of a project.
 CmsUser readOriginalAgent(CmsRequestContext context, CmsTask task)
          Reads the original agent of a task.
 CmsUser readOwner(CmsRequestContext context, CmsProject project)
          Reads the owner of a project from the OpenCms.
 CmsUser readOwner(CmsRequestContext context, CmsTask task)
          Reads the owner (initiator) of a task.
 CmsUser readOwner(CmsRequestContext context, CmsTaskLog log)
          Reads the owner of a tasklog.
 java.util.List readPath(CmsRequestContext context, int projectId, java.lang.String path, CmsResourceFilter filter)
          Builds a list of resources for a given path.
 CmsProject readProject(CmsRequestContext context, CmsTask task)
          Reads a project of a given task.
 CmsProject readProject(int id)
          Reads a project given the projects id.
 CmsProject readProject(java.lang.String name)
          Reads a project.
 java.util.List readProjectLogs(CmsRequestContext context, int projectId)
          Reads all task log entries for a project.
 java.util.List readProjectResources(CmsRequestContext context, CmsProject project)
          Returns the list of all resource names that define the "view" of the given project.
 java.util.List readProjectView(CmsRequestContext context, int projectId, int 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 readPropertyObjects(CmsRequestContext context, CmsResource resource, boolean search)
          Reads all property objects from a resource.
 java.util.List 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, java.lang.String resourcePath, CmsResourceFilter filter)
          Reads a resource from the OpenCms 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 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 readResourcesWithProperty(CmsRequestContext context, java.lang.String path, java.lang.String propertyDefinition)
          Reads all resources that have a value set for the specified property (definition) in the given path.
 java.util.List readResourcesWithProperty(CmsRequestContext context, java.lang.String path, java.lang.String propertyDefinition, java.lang.String value)
          Reads all resources that have a value (containing the specified value) set for the specified property (definition) in the given path.
 java.util.Set readResponsiblePrincipals(CmsRequestContext context, CmsResource resource)
          Returns a set of users that are responsible for a specific resource.
 java.util.Set readResponsibleUsers(CmsRequestContext context, CmsResource resource)
          Returns a set of users that are responsible for a specific resource.
 java.util.List 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 readStaticExportResources(CmsRequestContext context, int parameterResources, long timestamp)
          Returns a list of all template resources which must be processed during a static export.
 CmsTask readTask(CmsRequestContext context, int id)
          Reads the task with the given id.
 java.util.List readTaskLogs(CmsRequestContext context, int taskid)
          Reads log entries for a task.
 java.util.List readTasksForProject(CmsRequestContext context, int projectId, int tasktype, java.lang.String orderBy, java.lang.String sort)
          Reads all tasks for a project.
 java.util.List readTasksForRole(CmsRequestContext context, int projectId, java.lang.String roleName, int tasktype, java.lang.String orderBy, java.lang.String sort)
          Reads all tasks for a role in a project.
 java.util.List readTasksForUser(CmsRequestContext context, int projectId, java.lang.String userName, int taskType, java.lang.String orderBy, java.lang.String sort)
          Reads all tasks for a user in a project.
 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, int type)
          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.
 CmsUser readUser(java.lang.String username)
          Returns a user object.
 CmsUser readWebUser(CmsRequestContext context, java.lang.String username)
          Read a web user from the database.
 CmsUser readWebUser(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 removeResourceFromProject(CmsRequestContext context, CmsResource resource)
          Removes a resource from the current project of the user.
 void removeUserFromGroup(CmsRequestContext context, java.lang.String username, java.lang.String groupname)
          Removes a user from a group.
 void replaceResource(CmsRequestContext context, CmsResource resource, int type, byte[] content, java.util.List 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.
 void restoreResource(CmsRequestContext context, CmsResource resource, int tag)
          Restores a file in the current project with a version from the backup archive.
 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" timestamp of a resource.
 void setDateReleased(CmsRequestContext context, CmsResource resource, long dateReleased)
          Changes the "release" date of a resource.
 void setName(CmsRequestContext context, int taskId, java.lang.String name)
          Set a new name for a task.
 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 setPriority(CmsRequestContext context, int taskId, int priority)
          Set priority of a task.
 void setTaskPar(CmsRequestContext context, int taskId, java.lang.String parName, java.lang.String parValue)
          Set a Parameter for a task.
 void setTimeout(CmsRequestContext context, int taskId, long timeout)
          Set timeout of a task.
 void undoChanges(CmsRequestContext context, CmsResource resource)
          Undos all changes in the resource by restoring the version from the online project to the current offline project.
 void unlockProject(CmsRequestContext context, int projectId)
          Unlocks all resources in this project.
 void unlockResource(CmsRequestContext context, CmsResource resource)
          Unlocks a resource.
 boolean userInGroup(CmsRequestContext context, java.lang.String username, java.lang.String groupname)
          Tests if a user is member of the given group.
 java.util.Map validateHtmlLinks(CmsObject cms, CmsPublishList publishList, I_CmsReport report)
          Validates the HTML links in the unpublished files of the specified publish list, if a file resource type implements the interface I_CmsXmlDocumentLinkValidatable.
 void validatePassword(java.lang.String password)
          This method checks if a new password follows the rules for new passwords, which are defined by a Class implementing the I_CmsPasswordHandler interface and configured in the opencms.properties file.
 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 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 properties)
          Writes a list of properties for a specified resource.
 void writeResource(CmsRequestContext context, CmsResource resource)
          Writes a resource to the OpenCms VFS.
 void writeStaticExportPublishedResource(CmsRequestContext context, java.lang.String resourceName, int linkType, java.lang.String linkParameter, long timestamp)
          Inserts an entry in the published resource table.
 void writeTaskLog(CmsRequestContext context, int taskid, java.lang.String comment)
          Writes a new user tasklog for a task.
 void writeTaskLog(CmsRequestContext context, int taskId, java.lang.String comment, int type)
          Writes a new user tasklog for a task.
 void writeUser(CmsRequestContext context, CmsUser user)
          Updates the user information.
 void writeWebUser(CmsRequestContext context, CmsUser user)
          Updates the user information of a web user.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PERM_ALLOWED

public static final int PERM_ALLOWED
Indicates allowed permissions.

See Also:
Constant Field Values

PERM_DENIED

public static final int PERM_DENIED
Indicates denied permissions.

See Also:
Constant Field Values

PERM_FILTERED

public static final int PERM_FILTERED
Indicates a resource was filtered during permission check.

See Also:
Constant Field Values

PERM_NOTLOCKED

public static final int PERM_NOTLOCKED
Indicates a resource was not locked for a write / control operation.

See Also:
Constant Field Values

m_dbContextFactory

protected I_CmsDbContextFactory m_dbContextFactory
The factory to create runtime info objects.


m_driverManager

protected CmsDriverManager m_driverManager
The initialized OpenCms driver manager to access the database.

Method Detail

newInstance

public static CmsSecurityManager newInstance(CmsConfigurationManager configurationManager,
                                             I_CmsDbContextFactory runtimeInfoFactory)
                                      throws CmsInitException
Creates a new instance of the OpenCms security manager.

Parameters:
configurationManager - the configuation manager
runtimeInfoFactory - the initialized OpenCms runtime info factory
Returns:
a new instance of the OpenCms security manager
Throws:
CmsInitException - if the securtiy manager could not be initialized

acceptTask

public void acceptTask(CmsRequestContext context,
                       int taskId)
                throws CmsException
Updates the state of the given task as accepted by the current user.

Parameters:
context - the current request context
taskId - the Id of the task to accept
Throws:
CmsException - if something goes wrong

addUserToGroup

public void addUserToGroup(CmsRequestContext context,
                           java.lang.String username,
                           java.lang.String groupname)
                    throws CmsException
Adds a user to a group.

Parameters:
context - the current request context
username - the name of the user that is to be added to the group
groupname - the name of the group
Throws:
CmsException - if operation was not succesfull

addWebUser

public CmsUser addWebUser(CmsRequestContext context,
                          java.lang.String name,
                          java.lang.String password,
                          java.lang.String group,
                          java.lang.String description,
                          java.util.Map additionalInfos)
                   throws CmsException
Creates a new web user.

A web user has no access to the workplace but is able to access personalized functions controlled by the OpenCms.
Moreover, a web user can be created by any user, the intention being that a "Guest" user can create a personalized account for himself.

Parameters:
context - the current request context
name - the new name for the user
password - the new password for the user
group - the default groupname for the user
description - the description for the user
additionalInfos - a Map with additional infos for the user
Returns:
the new user will be returned
Throws:
CmsException - if operation was not succesfull

addWebUser

public CmsUser addWebUser(CmsRequestContext context,
                          java.lang.String name,
                          java.lang.String password,
                          java.lang.String group,
                          java.lang.String additionalGroup,
                          java.lang.String description,
                          java.util.Map additionalInfos)
                   throws CmsException
Adds a web user to the Cms.

A web user has no access to the workplace but is able to access personalized functions controlled by the OpenCms.

Parameters:
context - the current request context
name - the new name for the user
password - the new password for the user
group - the default groupname for the user
additionalGroup - an additional group for the user
description - the description for the user
additionalInfos - a Hashtable with additional infos for the user, these infos may be stored into the Usertables (depending on the implementation)
Returns:
the new user will be returned
Throws:
CmsException - if operation was not succesfull

backupProject

public void backupProject(CmsRequestContext context,
                          int tagId,
                          long publishDate)
                   throws CmsException
Creates a backup of the current project.

Parameters:
context - the current request context
tagId - the version of the backup
publishDate - the date of publishing
Throws:
CmsException - if operation was not succesful

changeLastModifiedProjectId

public void changeLastModifiedProjectId(CmsRequestContext context,
                                        CmsResource resource)
                                 throws CmsException
Changes the project id of the resource to the current project, indicating that the resource was last modified in this project.

Parameters:
context - the current request context
resource - theresource to apply this operation to
Throws:
CmsException - if something goes wrong
See Also:
I_CmsResourceType.changeLastModifiedProjectId(CmsObject, CmsSecurityManager, CmsResource)

changeLock

public void changeLock(CmsRequestContext context,
                       CmsResource resource)
                throws CmsException
Changes the lock of a resource to the current user, that is "steals" the lock from another user.

Parameters:
context - the current request context
resource - the resource to change the lock for
Throws:
CmsException - if something goes wrong
See Also:
I_CmsResourceType.changeLock(CmsObject, CmsSecurityManager, CmsResource)

changeResourcesInFolderWithProperty

public java.util.List changeResourcesInFolderWithProperty(CmsRequestContext context,
                                                          CmsResource resource,
                                                          java.lang.String propertyDefinition,
                                                          java.lang.String oldValue,
                                                          java.lang.String newValue,
                                                          boolean recursive)
                                                   throws CmsException,
                                                          CmsVfsException
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.

Parameters:
context - the current request context
resource - the resource on which property definition values are changed
propertyDefinition - the name of the propertydefinition to change the value
oldValue - the old value of the propertydefinition
newValue - the new value of the propertydefinition
recursive - if true, change recursively all property values on sub-resources (only for folders)
Returns:
a list with the CmsResource's where the property value has been changed
Throws:
CmsVfsException - for now only when the search for the oldvalue failed.
CmsException - if operation was not successful

changeUserType

public void changeUserType(CmsRequestContext context,
                           CmsUUID userId,
                           int userType)
                    throws CmsException
Changes the user type of the user.

Parameters:
context - the current request context
userId - the id of the user to change
userType - the new usertype of the user
Throws:
CmsException - if something goes wrong

changeUserType

public void changeUserType(CmsRequestContext context,
                           java.lang.String username,
                           int userType)
                    throws CmsException
Changes the user type of the user.

Only the administrator can change the type.

Parameters:
context - the current request context
username - the name of the user to change
userType - the new usertype of the user
Throws:
CmsException - if something goes wrong

checkManagerOfProjectRole

public void checkManagerOfProjectRole(CmsDbContext dbc,
                                      CmsProject project)
                               throws CmsRoleViolationException
Checks if the current user has management access to the given project.

Parameters:
dbc - the current database context
project - the project to check
Throws:
CmsRoleViolationException - if the user does not have the required role permissions

checkOfflineProject

public void checkOfflineProject(CmsDbContext dbc)
                         throws CmsVfsException
Checks if the project in the given database context is not the "Online" project, and throws an Exception if this is the case.

This is used to ensure a user is in an "Offline" project before write access to VFS resources is granted.

Parameters:
dbc - the current OpenCms users database context
Throws:
CmsVfsException - if the project in the given database context is the "Online" project

checkPermissions

public void checkPermissions(CmsRequestContext context,
                             CmsResource resource,
                             CmsPermissionSet requiredPermissions,
                             boolean checkLock,
                             CmsResourceFilter filter)
                      throws CmsException,
                             CmsSecurityException
Performs a blocking permission check on a resource.

If the required permissions are not satisfied by the permissions the user has on the resource, an exception is thrown.

Parameters:
context - the current request context
resource - the resource on which permissions are required
requiredPermissions - the set of permissions required to access the resource
checkLock - if true, the lock status of the resource is also checked
filter - the filter for the resource
Throws:
CmsException - in case of any i/o error
CmsSecurityException - if the required permissions are not satisfied
See Also:
checkPermissions(CmsRequestContext, CmsResource, CmsPermissionSet, int)

checkPublishPermissions

public void checkPublishPermissions(CmsDbContext dbc,
                                    CmsPublishList publishList)
                             throws CmsException,
                                    CmsMultiException
Checks if the current user has the permissions to publish the given publish list (which contains the information about the resources / project to publish).

Parameters:
dbc - the current OpenCms users database context
publishList - the publish list to check (contains the information about the resources / project to publish)
Throws:
CmsException - if the user does not have the required permissions becasue of project lock state
CmsMultiException - 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 project

checkPublishPermissions

public void checkPublishPermissions(CmsRequestContext context,
                                    CmsPublishList publishList)
                             throws CmsException,
                                    CmsMultiException
Checks if the current user has the permissions to publish the given publish list (which contains the information about the resources / project to publish).

Parameters:
context - the current request context
publishList - the publish list to check (contains the information about the resources / project to publish)
Throws:
CmsException - if the user does not have the required permissions becasue of project lock state
CmsMultiException - 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 project

checkRole

public void checkRole(CmsDbContext dbc,
                      CmsRole role)
               throws CmsRoleViolationException
Checks if the user of the current database context has permissions to impersonate the given role.

Parameters:
dbc - the current OpenCms users database context
role - the role to check
Throws:
CmsRoleViolationException - if the user does not have the required role permissions

checkRole

public void checkRole(CmsRequestContext context,
                      CmsRole role)
               throws CmsRoleViolationException
Checks if the user of the current database context has permissions to impersonate the given role.

Parameters:
context - the current request context
role - the role to check
Throws:
CmsRoleViolationException - if the user does not have the required role permissions

chflags

public void chflags(CmsRequestContext context,
                    CmsResource resource,
                    int flags)
             throws CmsException,
                    CmsSecurityException
Changes the resource flags of a resource.

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.

Parameters:
context - the current request context
resource - the resource to change the flags for
flags - the new resource flags for this resource
Throws:
CmsException - if something goes wrong
CmsSecurityException - if the user has insufficient permission for the given resource ((CmsPermissionSet.ACCESS_WRITE required).
See Also:
I_CmsResourceType.chflags(CmsObject, CmsSecurityManager, CmsResource, int)

chtype

public void chtype(CmsRequestContext context,
                   CmsResource resource,
                   int type)
            throws CmsException,
                   CmsSecurityException
Changes the resource type of a resource.

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.

Parameters:
context - the current request context
resource - the resource to change the type for
type - the new resource type for this resource
Throws:
CmsException - if something goes wrong
CmsSecurityException - if the user has insufficient permission for the given resource ((CmsPermissionSet.ACCESS_WRITE required)).
See Also:
I_CmsResourceType.chtype(CmsObject, CmsSecurityManager, CmsResource, int), CmsObject.chtype(String, int)

copyAccessControlEntries

public void copyAccessControlEntries(CmsRequestContext context,
                                     CmsResource source,
                                     CmsResource destination)
                              throws CmsException,
                                     CmsSecurityException
Copies the access control entries of a given resource to a destination resorce.

Already existing access control entries of the destination resource are removed.

Parameters:
context - the current request context
source - the resource to copy the access control entries from
destination - the resource to which the access control entries are copied
Throws:
CmsException - if something goes wrong
CmsSecurityException - if the user has insufficient permission for the given resource (CmsPermissionSet.ACCESS_CONTROL required).

copyResource

public void copyResource(CmsRequestContext context,
                         CmsResource source,
                         java.lang.String destination,
                         int siblingMode)
                  throws CmsException,
                         CmsSecurityException
Copies a resource.

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:

Parameters:
context - the current request context
source - the resource to copy
destination - the name of the copy destination with complete path
siblingMode - indicates how to handle siblings during copy
Throws:
CmsException - if something goes wrong
CmsSecurityException - if resource could not be copied
See Also:
CmsObject.copyResource(String, String, int), I_CmsResourceType.copyResource(CmsObject, CmsSecurityManager, CmsResource, String, int)

copyResourceToProject

public void copyResourceToProject(CmsRequestContext context,
                                  CmsResource resource)
                           throws CmsException,
                                  CmsRoleViolationException
Copies a resource to the current project of the user.

Parameters:
context - the current request context
resource - the resource to apply this operation to
Throws:
CmsException - if something goes wrong
CmsRoleViolationException - if the current user does not have management access to the project.
See Also:
I_CmsResourceType.copyResourceToProject(CmsObject, CmsSecurityManager, CmsResource)

countLockedResources

public int countLockedResources(CmsRequestContext context,
                                int id)
                         throws CmsException,
                                CmsRoleViolationException
Counts the locked resources in this project.

Parameters:
context - the current request context
id - the id of the project
Returns:
the amount of locked resources in this project
Throws:
CmsException - if something goes wrong
CmsRoleViolationException - if the current user does not have management access to the project.

countLockedResources

public int countLockedResources(CmsRequestContext context,
                                java.lang.String foldername)
                         throws CmsException
Counts the locked resources in a given folder.

Parameters:
context - the current request context
foldername - the folder to search in
Returns:
the amount of locked resources in this project
Throws:
CmsException - if something goes wrong

createGroup

public CmsGroup createGroup(CmsRequestContext context,
                            java.lang.String name,
                            java.lang.String description,
                            int flags,
                            java.lang.String parent)
                     throws CmsException,
                            CmsRoleViolationException
Creates a new user group.

Parameters:
context - the current request context
name - the name of the new group
description - the description for the new group
flags - the flags for the new group
parent - the name of the parent group (or null)
Returns:
a CmsGroup object representing the newly created group
Throws:
CmsException - if operation was not successful.
CmsRoleViolationException - if the role CmsRole.ACCOUNT_MANAGER is not owned by the current user.

createProject

public CmsProject createProject(CmsRequestContext context,
                                java.lang.String name,
                                java.lang.String description,
                                java.lang.String groupname,
                                java.lang.String managergroupname,
                                int projecttype)
                         throws CmsException,
                                CmsRoleViolationException
Creates a project.

Parameters:
context - the current request context
name - the name of the project to create
description - the description of the project
groupname - the project user group to be set
managergroupname - the project manager group to be set
projecttype - the type of the project
Returns:
the created project
Throws:
CmsException - if something goes wrong
CmsRoleViolationException - if the current user does not own the role CmsRole.PROJECT_MANAGER.

createPropertyDefinition

public CmsPropertyDefinition createPropertyDefinition(CmsRequestContext context,
                                                      java.lang.String name)
                                               throws CmsException,
                                                      CmsSecurityException,
                                                      CmsRoleViolationException
Creates a property definition.

Property definitions are valid for all resource types.

Parameters:
context - the current request context
name - the name of the property definition to create
Returns:
the created property definition
Throws:
CmsException - if something goes wrong
CmsSecurityException - if the current project is online.
CmsRoleViolationException - if the current user does not own the role CmsRole.PROPERTY_MANAGER.

createResource

public CmsResource createResource(CmsRequestContext context,
                                  java.lang.String resourcename,
                                  int type,
                                  byte[] content,
                                  java.util.List properties)
                           throws CmsException
Creates a new resource of the given resource type with the provided content and properties.

If the provided content is null and the resource is not a folder, the content will be set to an empty byte array.

Parameters:
context - the current request context
resourcename - the name of the resource to create (full path)
type - the type of the resource to create
content - the content for the new resource
properties - the properties for the new resource
Returns:
the created resource
Throws:
CmsException - if something goes wrong
See Also:
I_CmsResourceType.createResource(CmsObject, CmsSecurityManager, String, byte[], List)

createSibling

public void createSibling(CmsRequestContext context,
                          CmsResource source,
                          java.lang.String destination,
                          java.util.List properties)
                   throws CmsException
Creates a new sibling of the source resource.

Parameters:
context - the current request context
source - the resource to create a sibling for
destination - the name of the sibling to create with complete path
properties - the individual properties for the new sibling
Throws:
CmsException - if something goes wrong
See Also:
I_CmsResourceType.createSibling(CmsObject, CmsSecurityManager, CmsResource, String, List)

createTask

public CmsTask createTask(CmsRequestContext context,
                          CmsUser currentUser,
                          int projectid,
                          java.lang.String agentName,
                          java.lang.String roleName,
                          java.lang.String taskName,
                          java.lang.String taskComment,
                          int taskType,
                          long timeout,
                          int priority)
                   throws CmsException
Creates a new task.

Parameters:
context - the current request context
currentUser - the current user
projectid - the current project id
agentName - user who will edit the task
roleName - usergroup for the task
taskName - name of the task
taskType - type of the task
taskComment - description of the task
timeout - time when the task must finished
priority - Id for the priority
Returns:
a new task object
Throws:
CmsException - if something goes wrong

createTask

public CmsTask createTask(CmsRequestContext context,
                          java.lang.String agentName,
                          java.lang.String roleName,
                          java.lang.String taskname,
                          long timeout,
                          int priority)
                   throws CmsException
Creates a new task.

This is just a more limited version of the createTask(CmsRequestContext, CmsUser, int, String, String, String, String, int, long, int) method, where:

Parameters:
context - the current request context
agentName - the user who will edit the task
roleName - a usergroup for the task
taskname - the name of the task
timeout - the time when the task must finished
priority - the id for the priority of the task
Returns:
the created task
Throws:
CmsException - if something goes wrong

createTempfileProject

public CmsProject createTempfileProject(CmsRequestContext context)
                                 throws CmsException
Creates the project for the temporary workplace files.

Parameters:
context - the current request context
Returns:
the created project for the temporary workplace files
Throws:
CmsException - if something goes wrong

createUser

public CmsUser createUser(CmsRequestContext context,
                          java.lang.String name,
                          java.lang.String password,
                          java.lang.String description,
                          java.util.Map additionalInfos)
                   throws CmsException,
                          CmsRoleViolationException
Creates a new user.

Parameters:
context - the current request context
name - the name for the new user
password - the password for the new user
description - the description for the new user
additionalInfos - the additional infos for the user
Returns:
the created user
Throws:
CmsException - if something goes wrong
CmsRoleViolationException - if the current user does not own the rule CmsRole.ACCOUNT_MANAGER
See Also:
CmsObject.createUser(String, String, String, Map)

deleteAllStaticExportPublishedResources

public void deleteAllStaticExportPublishedResources(CmsRequestContext context,
                                                    int linkType)
                                             throws CmsException
Deletes all entries in the published resource table.

Parameters:
context - the current request context
linkType - the type of resource deleted (0= non-paramter, 1=parameter)
Throws:
CmsException - if something goes wrong

deleteBackups

public void deleteBackups(CmsRequestContext context,
                          long timestamp,
                          int versions,
                          I_CmsReport report)
                   throws CmsException,
                          CmsRoleViolationException
Deletes the versions from the backup tables that are older then the given timestamp and/or number of remaining versions.

The number of verions always wins, i.e. if the given timestamp would delete more versions than given in the versions parameter, the timestamp will be ignored.

Deletion will delete file header, content and properties.

Parameters:
context - the current request context
timestamp - timestamp which defines the date after which backup resources must be deleted
versions - the number of versions per file which should kept in the system
report - the report for output logging
Throws:
CmsException - if operation was not succesful
CmsRoleViolationException - if the current user does not own the rule CmsRole.HISTORY_MANAGER

deleteGroup

public void deleteGroup(CmsRequestContext context,
                        CmsUUID groupId,
                        CmsUUID replacementId)
                 throws CmsException,
                        CmsRoleViolationException,
                        CmsSecurityException
Deletes a group, where all permissions, users and childs of the group are transfered to a replacement group.

Parameters:
context - the current request context
groupId - the id of the group to be deleted
replacementId - the id of the group to be transfered, can be null
Throws:
CmsException - if operation was not succesful
CmsSecurityException - if the group is a default group.
CmsRoleViolationException - if the current user does not own the rule CmsRole.ACCOUNT_MANAGER

deleteGroup

public void deleteGroup(CmsRequestContext context,
                        java.lang.String name)
                 throws CmsException,
                        CmsRoleViolationException,
                        CmsSecurityException
Delete a user group.

Only groups that contain no subgroups can be deleted.

Parameters:
context - the current request context
name - the name of the group that is to be deleted
Throws:
CmsException - if operation was not succesful
CmsSecurityException - if the group is a default group.
CmsRoleViolationException - if the current user does not own the rule CmsRole.ACCOUNT_MANAGER

deleteProject

public void deleteProject(CmsRequestContext context,
                          int projectId)
                   throws CmsException,
                          CmsRoleViolationException
Deletes a project.

All modified resources currently inside this project will be reset to their online state.

Parameters:
context - the current request context
projectId - the ID of the project to be deleted
Throws:
CmsException - if something goes wrong
CmsRoleViolationException - if the current user does not own management access to the project

deletePropertyDefinition

public void deletePropertyDefinition(CmsRequestContext context,
                                     java.lang.String name)
                              throws CmsException,
                                     CmsSecurityException,
                                     CmsRoleViolationException
Deletes a property definition.

Parameters:
context - the current request context
name - the name of the property definition to delete
Throws:
CmsException - if something goes wrong
CmsSecurityException - if the project to delete is the "Online" project
CmsRoleViolationException - if the current user does not own the role CmsRole.PROPERTY_MANAGER

deleteResource

public void deleteResource(CmsRequestContext context,
                           CmsResource resource,
                           int siblingMode)
                    throws CmsException,
                           CmsSecurityException
Deletes a resource given its name.

The siblingMode parameter controls how to handle siblings during the delete operation.
Possible values for this parameter are:

Parameters:
context - the current request context
resource - the name of the resource to delete (full path)
siblingMode - indicates how to handle siblings of the deleted resource
Throws:
CmsException - if something goes wrong
CmsSecurityException - if the user does not have CmsPermissionSet.ACCESS_WRITE on the given resource.
See Also:
I_CmsResourceType.deleteResource(CmsObject, CmsSecurityManager, CmsResource, int)

deleteStaticExportPublishedResource

public void deleteStaticExportPublishedResource(CmsRequestContext context,
                                                java.lang.String resourceName,
                                                int linkType,
                                                java.lang.String linkParameter)
                                         throws CmsException
Deletes an entry in the published resource table.

Parameters:
context - the current request context
resourceName - The name of the resource to be deleted in the static export
linkType - the type of resource deleted (0= non-paramter, 1=parameter)
linkParameter - the parameters ofthe resource
Throws:
CmsException - if something goes wrong

deleteUser

public void deleteUser(CmsRequestContext context,
                       CmsUUID userId)
                throws CmsException
Deletes a user.

Parameters:
context - the current request context
userId - the Id of the user to be deleted
Throws:
CmsException - if something goes wrong

deleteUser

public void deleteUser(CmsRequestContext context,
                       CmsUUID userId,
                       CmsUUID replacementId)
                throws CmsException
Deletes a user, where all permissions and resources attributes of the user were transfered to a replacement user.

Parameters:
context - the current request context
userId - the id of the user to be deleted
replacementId - the id of the user to be transfered
Throws:
CmsException - if operation was not successful

deleteUser

public void deleteUser(CmsRequestContext context,
                       java.lang.String username)
                throws CmsException
Deletes a user.

Parameters:
context - the current request context
username - the name of the user to be deleted
Throws:
CmsException - if something goes wrong

deleteWebUser

public void deleteWebUser(CmsRequestContext context,
                          CmsUUID userId)
                   throws CmsException
Deletes a web user.

Parameters:
context - the current request context
userId - the Id of the web user to be deleted
Throws:
CmsException - if something goes wrong

destroy

public void destroy()
             throws java.lang.Throwable
Destroys this security manager.

Throws:
java.lang.Throwable - if something goes wrong

endTask

public void endTask(CmsRequestContext context,
                    int taskid)
             throws CmsException
Ends a task.

Parameters:
context - the current request context
taskid - the ID of the task to end
Throws:
CmsException - if something goes wrong

existsResource

public boolean existsResource(CmsRequestContext context,
                              java.lang.String resourcePath,
                              CmsResourceFilter filter)
Checks the availability of a resource in the VFS, using the CmsResourceFilter.DEFAULT filter.

A resource may be of type CmsFile or 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 CmsResourceFilter.DEFAULT will only return currently "valid" resources, while using CmsResourceFilter.IGNORE_EXPIRATION will ignore the date release / date expired information of the resource.

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.

Parameters:
context - the current request context
resourcePath - the name of the resource to read (full path)
filter - the resource filter to use while reading
Returns:
true if the resource is available
See Also:
CmsObject.existsResource(String, CmsResourceFilter), CmsObject.existsResource(String)

fillPublishList

public CmsPublishList fillPublishList(CmsRequestContext context,
                                      CmsPublishList publishList)
                               throws CmsException
Fills the given publish list with the the VFS resources that actually get published.

Please refer to the source code of this method for the rules on how to decide whether a new/changed/deleted CmsResource object can be published or not.

Parameters:
context - the current request context
publishList - must be initialized with basic publish information (Project or direct publish operation)
Returns:
the given publish list filled with all new/changed/deleted files from the current (offline) project that will be published actually
Throws:
CmsException - if something goes wrong
See Also:
CmsPublishList

forwardTask

public void forwardTask(CmsRequestContext context,
                        int taskid,
                        java.lang.String newRoleName,
                        java.lang.String newUserName)
                 throws CmsException
Forwards a task to a new user.

Parameters:
context - the current request context
taskid - the Id of the task to forward
newRoleName - the new group name for the task
newUserName - the new user who gets the task. if it is empty, a new agent will automatic selected
Throws:
CmsException - if something goes wrong

getAccessControlEntries

public java.util.List getAccessControlEntries(CmsRequestContext context,
                                              CmsResource resource,
                                              boolean getInherited)
                                       throws CmsException
Returns the list of access control entries of a resource given its name.

Parameters:
context - the current request context
resource - the resource to read the access control entries for
getInherited - true if the result should include all access control entries inherited by parent folders
Returns:
a list of CmsAccessControlEntry objects defining all permissions for the given resource
Throws:
CmsException - if something goes wrong

getAccessControlList

public CmsAccessControlList getAccessControlList(CmsRequestContext context,
                                                 CmsResource resource,
                                                 boolean inheritedOnly)
                                          throws CmsException
Returns the access control list (summarized access control entries) of a given resource.

If inheritedOnly is set, only inherited access control entries are returned.

Parameters:
context - the current request context
resource - the resource
inheritedOnly - skip non-inherited entries if set
Returns:
the access control list of the resource
Throws:
CmsException - if something goes wrong

getAllAccessibleProjects

public java.util.List getAllAccessibleProjects(CmsRequestContext context)
                                        throws CmsException
Returns all projects which are owned by the current user or which are accessible for the group of the user.

Parameters:
context - the current request context
Returns:
a list of objects of type CmsProject
Throws:
CmsException - if something goes wrong

getAllBackupProjects

public java.util.List getAllBackupProjects(CmsRequestContext context)
                                    throws CmsException
Returns a list with all projects from history.

Parameters:
context - the current request context
Returns:
list of CmsBackupProject objects with all projects from history.
Throws:
CmsException - if operation was not succesful

getAllManageableProjects

public java.util.List getAllManageableProjects(CmsRequestContext context)
                                        throws CmsException
Returns all projects which are owned by the current user or which are manageable for the group of the user.

Parameters:
context - the current request context
Returns:
a list of objects of type CmsProject
Throws:
CmsException - if operation was not succesful

getBackupTagId

public int getBackupTagId(CmsRequestContext context)
Returns the next version id for the published backup resources.

Parameters:
context - the current request context
Returns:
the new version id

getChild

public java.util.List getChild(CmsRequestContext context,
                               java.lang.String groupname)
                        throws CmsException
Returns all child groups of a group.

Parameters:
context - the current request context
groupname - the name of the group
Returns:
a list of all child CmsGroup objects or null
Throws:
CmsException - if operation was not succesful

getChilds

public java.util.List getChilds(CmsRequestContext context,
                                java.lang.String groupname)
                         throws CmsException
Returns all child groups of a group.

This method also returns all sub-child groups of the current group.

Parameters:
context - the current request context
groupname - the name of the group
Returns:
a list of all child CmsGroup objects or null
Throws:
CmsException - if operation was not succesful

getConfigurations

public java.util.Map getConfigurations()
Gets the configurations of the OpenCms properties file.

Returns:
the configurations of the properties file

getDirectGroupsOfUser

public java.util.List getDirectGroupsOfUser(CmsRequestContext context,
                                            java.lang.String username)
                                     throws CmsException
Returns the list of groups to which the user directly belongs to.

Parameters:
context - the current request context
username - The name of the user
Returns:
a list of CmsGroup objects
Throws:
CmsException - if operation was not succesful

getGroups

public java.util.List getGroups(CmsRequestContext context)
                         throws CmsException
Returns all available groups.

Parameters:
context - the current request context
Returns:
a list of all available CmsGroup objects
Throws:
CmsException - if operation was not succesful

getGroupsOfUser

public java.util.List getGroupsOfUser(CmsRequestContext context,
                                      java.lang.String username)
                               throws CmsException
Returns the groups of a user.

Parameters:
context - the current request context
username - the name of the user
Returns:
a list of CmsGroup objects
Throws:
CmsException - if operation was not succesful

getGroupsOfUser

public java.util.List getGroupsOfUser(CmsRequestContext context,
                                      java.lang.String username,
                                      java.lang.String remoteAddress)
                               throws CmsException
Returns the groups of a Cms user filtered by the specified IP address.

Parameters:
context - the current request context
username - the name of the user
remoteAddress - the IP address to filter the groups in the result list
Returns:
a list of CmsGroup objects filtered by the specified IP address
Throws:
CmsException - if operation was not succesful

getLock

public CmsLock getLock(CmsRequestContext context,
                       CmsResource resource)
                throws CmsException
Returns the lock state of a resource.

Parameters:
context - the current request context
resource - the resource to return the lock state for
Returns:
the lock state of the resource
Throws:
CmsException - if something goes wrong

getParent

public CmsGroup getParent(CmsRequestContext context,
                          java.lang.String groupname)
                   throws CmsException
Returns the parent group of a group.

Parameters:
context - the current request context
groupname - the name of the group
Returns:
group the parent group or null
Throws:
CmsException - if operation was not succesful

getPermissions

public CmsPermissionSetCustom getPermissions(CmsRequestContext context,
                                             CmsResource resource,
                                             CmsUser user)
                                      throws CmsException
Returns the set of permissions of the current user for a given resource.

Parameters:
context - the current request context
resource - the resource
user - the user
Returns:
bitset with allowed permissions
Throws:
CmsException - if something goes wrong

getResourcesForPrincipal

public java.util.List getResourcesForPrincipal(CmsRequestContext context,
                                               CmsUUID principalId,
                                               CmsPermissionSet permissions,
                                               boolean includeAttr)
                                        throws CmsException
Returns all resources associated to a given principal via an ACE with the given permissions.

If the includeAttr flag is set it returns also all resources associated to a given principal through some of following attributes.

Parameters:
context - the current request context
principalId - the id of the principal
permissions - a set of permissions to match, can be null for all ACEs
includeAttr - a flag to include resources associated by attributes
Returns:
a list of CmsResource objects
Throws:
CmsException - if something goes wrong

getResourcesInTimeRange

public java.util.List getResourcesInTimeRange(CmsRequestContext context,
                                              java.lang.String folder,
                                              long starttime,
                                              long endtime)
                                       throws CmsException
Returns a list with all sub resources of the given parent folder (and all of it's subfolders) that have been modified in the given time range.

The result list is descending sorted (newest resource first).

Parameters:
context - the current request context
folder - the folder to get the subresources from
starttime - the begin of the time range
endtime - the end of the time range
Returns:
a list with all CmsResource objects that have been modified in the given time range.
Throws:
CmsException - if operation was not succesful

getSqlManager

public CmsSqlManager getSqlManager()
Returns an instance of the common sql manager.

Returns:
an instance of the common sql manager

getTaskPar

public java.lang.String getTaskPar(CmsRequestContext context,
                                   int taskId,
                                   java.lang.String parName)
                            throws CmsException
Returns the value of the given parameter for the given task.

Parameters:
context - the current request context
taskId - the Id of the task
parName - name of the parameter
Returns:
task parameter value
Throws:
CmsException - if something goes wrong

getTaskType

public int getTaskType(CmsRequestContext context,
                       java.lang.String taskName)
                throws CmsException
Get the template task id for a given taskname.

Parameters:
context - the current request context
taskName - name of the task
Returns:
id from the task template
Throws:
CmsException - if something goes wrong

getUsers

public java.util.List getUsers(CmsRequestContext context)
                        throws CmsException
Returns all available users.

Parameters:
context - the current request context
Returns:
a list of all available CmsUser objects
Throws:
CmsException - if operation was not succesful

getUsers

public java.util.List getUsers(CmsRequestContext context,
                               int type)
                        throws CmsException
Returns all users from a given type.

Parameters:
context - the current request context
type - the type of the users
Returns:
a list of all CmsUser objects of the given type
Throws:
CmsException - if operation was not succesful

getUsersOfGroup

public java.util.List getUsersOfGroup(CmsRequestContext context,
                                      java.lang.String groupname)
                               throws CmsException
Returns a list of users in a group.

Parameters:
context - the current request context
groupname - the name of the group to list users from
Returns:
all CmsUser objects in the group
Throws:
CmsException - if operation was not succesful

hasManagerOfProjectRole

public boolean hasManagerOfProjectRole(CmsDbContext dbc,
                                       CmsProject project)
Checks if the current user has management access to the given project.

Parameters:
dbc - the current database context
project - the project to check
Returns:
true, if the user has management access to the project

hasPermissions

public int hasPermissions(CmsRequestContext context,
                          CmsResource resource,
                          CmsPermissionSet requiredPermissions,
                          boolean checkLock,
                          CmsResourceFilter filter)
                   throws CmsException
Performs a non-blocking permission check on a resource.

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:

Parameters:
context - the current request context
resource - the resource on which permissions are required
requiredPermissions - the set of permissions required for the operation
checkLock - 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 user
filter - the resource filter to use
Returns:
PERM_ALLOWED if the user has sufficient permissions on the resource for the requested operation
Throws:
CmsException - in case of i/o errors (NOT because of insufficient permissions)
See Also:
hasPermissions(CmsDbContext, CmsResource, CmsPermissionSet, boolean, CmsResourceFilter)

hasRole

public boolean hasRole(CmsDbContext dbc,
                       CmsRole role)
Checks if the user of the current database context is a member of the given role.

Parameters:
dbc - the current OpenCms users database context
role - the role to check
Returns:
true if the user of the current database context is at a member of at last one of the roles in the given role set

hasRole

public boolean hasRole(CmsDbContext dbc,
                       CmsUser user,
                       CmsRole role)
Checks if the given user is a member of the given role.

Parameters:
dbc - the current OpenCms users database context
user - the user to check the role for
role - the role to check
Returns:
true if the user of the current database context is at a member of at last one of the roles in the given role set

hasRole

public boolean hasRole(CmsRequestContext context,
                       CmsRole role)
Checks if the user of the given request context is a member of at last one of the roles in the given role set.

Parameters:
context - the current request context
role - the role to check
Returns:
true if the user of given request context is at a member of at last one of the roles in the given role set

importAccessControlEntries

public void importAccessControlEntries(CmsRequestContext context,
                                       CmsResource resource,
                                       java.util.List acEntries)
                                throws CmsException,
                                       CmsSecurityException
Writes a list of access control entries as new access control entries of a given resource.

Already existing access control entries of this resource are removed before.

Access is granted, if:

Parameters:
context - the current request context
resource - the resource
acEntries - a list of CmsAccessControlEntry objects
Throws:
CmsException - if something goes wrong
CmsSecurityException - if the required permissions are not satisfied

importResource

public CmsResource importResource(CmsRequestContext context,
                                  java.lang.String resourcePath,
                                  CmsResource resource,
                                  byte[] content,
                                  java.util.List properties,
                                  boolean importCase)
                           throws CmsException
Creates a new resource with the provided content and properties.

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.

Note: the id used to identify the content record (pk of the record) is generated on each call of this method (with valid content) !

Parameters:
context - the current request context
resourcePath - the name of the resource to create (full path)
resource - the new resource to create
content - the content for the new resource
properties - the properties for the new resource
importCase - if true, signals that this operation is done while importing resource, causing different lock behaviour and potential "lost and found" usage
Returns:
the created resource
Throws:
CmsException - if something goes wrong

importUser

public CmsUser importUser(CmsRequestContext context,
                          java.lang.String id,
                          java.lang.String name,
                          java.lang.String password,
                          java.lang.String description,
                          java.lang.String firstname,
                          java.lang.String lastname,
                          java.lang.String email,
                          java.lang.String address,
                          int flags,
                          int type,
                          java.util.Map additionalInfos)
                   throws CmsException,
                          CmsRoleViolationException
Creates a new user by import.

Parameters:
context - the current request context
id - the id of the user
name - the new name for the user
password - the new password for the user
description - the description for the user
firstname - the firstname of the user
lastname - the lastname of the user
email - the email of the user
address - the address of the user
flags - the flags for a user (for example I_CmsPrincipal.FLAG_ENABLED)
type - the type of the user
additionalInfos - the additional user infos
Returns:
the imported user
Throws:
CmsException - if something goes wrong
CmsRoleViolationException - if the role CmsRole.ACCOUNT_MANAGER is not owned by the current user.

init

public void init(CmsConfigurationManager configurationManager,
                 I_CmsDbContextFactory dbContextFactory)
          throws CmsInitException
Initializes this security manager with a given runtime info factory.

Parameters:
configurationManager - the configurationManager
dbContextFactory - the initialized OpenCms runtime info factory
Throws:
CmsInitException - if the initialization fails

isInsideCurrentProject

public boolean isInsideCurrentProject(CmsRequestContext context,
                                      java.lang.String resourcename)
Checks if the specified resource is inside the current project.

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.

Parameters:
context - the current request context
resourcename - the specified resource name (full path)
Returns:
true, if the specified resource is inside the current project

isManagerOfProject

public boolean isManagerOfProject(CmsRequestContext context)
Checks if the current user has management access to the current project.

Parameters:
context - the current request context
Returns:
true, if the user has management access to the current project

lockResource

public void lockResource(CmsRequestContext context,
                         CmsResource resource,
                         int mode)
                  throws CmsException
Locks a resource.

The mode parameter controls what kind of lock is used.
Possible values for this parameter are:

Parameters:
context - the current request context
resource - the resource to lock
mode - flag indicating the mode for the lock
Throws:
CmsException - if something goes wrong
See Also:
CmsObject.lockResource(String, int), I_CmsResourceType.lockResource(CmsObject, CmsSecurityManager, CmsResource, int)

loginUser

public CmsUser loginUser(CmsRequestContext context,
                         java.lang.String username,
                         java.lang.String password,
                         java.lang.String remoteAddress,
                         int userType)
                  throws CmsException
Attempts to authenticate a user into OpenCms with the given password.

Parameters:
context - the current request context
username - the name of the user to be logged in
password - the password of the user
remoteAddress - the ip address of the request
userType - the user type to log in (System user or Web user)
Returns:
the logged in user
Throws:
CmsException - if the login was not succesful

lookupPrincipal

public I_CmsPrincipal lookupPrincipal(CmsRequestContext context,
                                      CmsUUID principalId)
Lookup and read the user or group with the given UUID.

Parameters:
context - the current request context
principalId - the UUID of the principal to lookup
Returns:
the principal (group or user) if found, otherwise null

lookupPrincipal

public I_CmsPrincipal lookupPrincipal(CmsRequestContext context,
                                      java.lang.String principalName)
Lookup and read the user or group with the given name.

Parameters:
context - the current request context
principalName - the name of the principal to lookup
Returns:
the principal (group or user) if found, otherwise null

moveToLostAndFound

public java.lang.String moveToLostAndFound(CmsRequestContext context,
                                           java.lang.String resourcename,
                                           boolean returnNameOnly)
                                    throws CmsException
Moves a resource to the "lost and found" folder.

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.

Parameters:
context - the current request context
resourcename - the name of the resource to apply this operation to
returnNameOnly - if true, only the name of the resource in the "lost and found" folder is returned, the move operation is not really performed
Returns:
the name of the resource inside the "lost and found" folder
Throws:
CmsException - if something goes wrong
See Also:
CmsObject.moveToLostAndFound(String), CmsObject.getLostAndFoundName(String)

publishProject

public CmsUUID publishProject(CmsObject cms,
                              CmsPublishList publishList,
                              I_CmsReport report)
                       throws CmsException
Publishes the resources of a specified publish list.

Parameters:
cms - the current request context
publishList - a publish list
report - an instance of I_CmsReport to print messages
Returns:
the publish history id of the published project
Throws:
CmsException - if something goes wrong
See Also:
fillPublishList(CmsRequestContext, CmsPublishList)

reactivateTask

public void reactivateTask(CmsRequestContext context,
                           int taskId)
                    throws CmsException
Reactivates a task.

Setting its state to CmsTaskService.TASK_STATE_STARTED and the percentage to zero.

Parameters:
context - the current request context
taskId - the id of the task to reactivate
Throws:
CmsException - if something goes wrong

readAgent

public CmsUser readAgent(CmsRequestContext context,
                         CmsTask task)
                  throws CmsException
Reads the agent of a task.

Parameters:
context - the current request context
task - the task to read the agent from
Returns:
the owner of a task
Throws:
CmsException - if something goes wrong

readAllBackupFileHeaders

public java.util.List readAllBackupFileHeaders(CmsRequestContext context,
                                               CmsResource resource)
                                        throws CmsException
Reads all file headers of a file.
This method returns a list with the history of all file headers, i.e. the file headers of a file, independent of the project they were attached to.
The reading excludes the file content.

Parameters:
context - the current request context
resource - the resource to be read
Returns:
a list of file headers, as CmsBackupResource objects, read from the Cms
Throws:
CmsException - if something goes wrong

readAllPropertyDefinitions

public java.util.List readAllPropertyDefinitions(CmsRequestContext context)
                                          throws CmsException
Reads all propertydefinitions for the given mapping type.

Parameters:
context - the current request context
Returns:
a list with the CmsPropertyDefinition objects (may be empty)
Throws:
CmsException - if something goes wrong

readAncestor

public CmsFolder readAncestor(CmsRequestContext context,
                              CmsResource resource,
                              CmsResourceFilter filter)
                       throws CmsException
Returns the first ancestor folder matching the filter criteria.

If no folder matching the filter criteria is found, null is returned.

Parameters:
context - the context of the current request
resource - the resource to start
filter - the resource filter to match while reading the ancestors
Returns:
the first ancestor folder matching the filter criteria or null if no folder was found
Throws:
CmsException - if something goes wrong

readBackupFile

public CmsBackupResource readBackupFile(CmsRequestContext context,
                                        int tagId,
                                        CmsResource resource)
                                 throws CmsException
Returns a file from the history.
The reading includes the file content.

Parameters:
context - the current request context
tagId - the id of the tag of the file
resource - the resource to be read
Returns:
the file read
Throws:
CmsException - if operation was not succesful

readBackupProject

public CmsBackupProject readBackupProject(CmsRequestContext context,
                                          int tagId)
                                   throws CmsException
Returns a backup project.

Parameters:
context - the current request context
tagId - the tagId of the project
Returns:
the requested backup project
Throws:
CmsException - if something goes wrong

readBackupPropertyObjects

public java.util.List readBackupPropertyObjects(CmsRequestContext context,
                                                CmsBackupResource resource)
                                         throws CmsException
Reads the list of CmsProperty objects that belong the the given backup resource.

Parameters:
context - the current request context
resource - the backup resource to read the properties from
Returns:
the list of CmsProperty objects that belong the the given backup resource
Throws:
CmsException - if something goes wrong

readChildResources

public java.util.List readChildResources(CmsRequestContext context,
                                         CmsResource resource,
                                         CmsResourceFilter filter,
                                         boolean getFolders,
                                         boolean getFiles)
                                  throws CmsException,
                                         CmsSecurityException
Returns the child resources of a resource, that is the resources contained in a folder.

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.

Parameters:
context - the current request context
resource - the resource to return the child resources for
filter - the resource filter to use
getFolders - if true the child folders are included in the result
getFiles - if true the child files are included in the result
Returns:
a list of all child resources
Throws:
CmsException - if something goes wrong
CmsSecurityException - if the user has insufficient permission for the given resource (read is required).

readFile

public CmsFile readFile(CmsRequestContext context,
                        CmsResource resource,
                        CmsResourceFilter filter)
                 throws CmsException
Reads a file resource (including it's binary content) from the VFS, using the specified resource filter.

In case you do not need the file content, use readResource(CmsRequestContext, String, CmsResourceFilter) instead.

The specified filter controls what kind of resources should be "found" during the read operation. This will depend on the application. For example, using CmsResourceFilter.DEFAULT will only return currently "valid" resources, while using CmsResourceFilter.IGNORE_EXPIRATION will ignore the date release / date expired information of the resource.

Parameters:
context - the current request context
resource - the resource to be read
filter - the filter object
Returns:
the file read from the VFS
Throws:
CmsException - if something goes wrong

readFolder

public CmsFolder readFolder(CmsRequestContext context,
                            java.lang.String resourcename,
                            CmsResourceFilter filter)
                     throws CmsException
Reads a folder resource from the VFS, using the specified resource filter.

The specified filter controls what kind of resources should be "found" during the read operation. This will depend on the application. For example, using CmsResourceFilter.DEFAULT will only return currently "valid" resources, while using CmsResourceFilter.IGNORE_EXPIRATION will ignore the date release / date expired information of the resource.

Parameters:
context - the current request context
resourcename - the name of the folder to read (full path)
filter - the resource filter to use while reading
Returns:
the folder that was read
Throws:
CmsException - if something goes wrong

readGivenTasks

public java.util.List readGivenTasks(CmsRequestContext context,
                                     int projectId,
                                     java.lang.String ownerName,
                                     int taskType,
                                     java.lang.String orderBy,
                                     java.lang.String sort)
                              throws CmsException
Reads all given tasks from a user for a project.

The tasktype parameter will filter the tasks. The possible values for this parameter are:

Parameters:
context - the current request context
projectId - the id of the project in which the tasks are defined
ownerName - the owner of the task
taskType - the type of task you want to read
orderBy - specifies how to order the tasks
sort - sorting of the tasks
Returns:
a list of given CmsTask objects for a user for a project
Throws:
CmsException - if operation was not successful

readGroup

public CmsGroup readGroup(CmsRequestContext context,
                          CmsProject project)
Reads the group of a project.

Parameters:
context - the current request context
project - the project to read from
Returns:
the group of a resource

readGroup

public CmsGroup readGroup(CmsRequestContext context,
                          CmsTask task)
                   throws CmsException
Reads the group (role) of a task from the OpenCms.

Parameters:
context - the current request context
task - the task to read from
Returns:
the group of a resource
Throws:
CmsException - if operation was not succesful

readGroup

public CmsGroup readGroup(CmsRequestContext context,
                          CmsUUID groupId)
                   throws CmsException
Reads a group based on its id.

Parameters:
context - the current request context
groupId - the id of the group that is to be read
Returns:
the requested group
Throws:
CmsException - if operation was not succesful

readGroup

public CmsGroup readGroup(CmsRequestContext context,
                          java.lang.String groupname)
                   throws CmsException
Reads a group based on its name.

Parameters:
context - the current request context
groupname - the name of the group that is to be read
Returns:
the requested group
Throws:
CmsException - if operation was not succesful

readManagerGroup

public CmsGroup readManagerGroup(CmsRequestContext context,
                                 CmsProject project)
Reads the manager group of a project.

Parameters:
context - the current request context
project - the project to read from
Returns:
the group of a resource

readOriginalAgent

public CmsUser readOriginalAgent(CmsRequestContext context,
                                 CmsTask task)
                          throws CmsException
Reads the original agent of a task.

Parameters:
context - the current request context
task - the task to read the original agent from
Returns:
the owner of a task
Throws:
CmsException - if something goes wrong

readOwner

public CmsUser readOwner(CmsRequestContext context,
                         CmsProject project)
                  throws CmsException
Reads the owner of a project from the OpenCms.

Parameters:
context - the current request context
project - the project to get the owner from
Returns:
the owner of a resource
Throws:
CmsException - if something goes wrong

readOwner

public CmsUser readOwner(CmsRequestContext context,
                         CmsTask task)
                  throws CmsException
Reads the owner (initiator) of a task.

Parameters:
context - the current request context
task - the task to read the owner from
Returns:
the owner of a task
Throws:
CmsException - if something goes wrong

readOwner

public CmsUser readOwner(CmsRequestContext context,
                         CmsTaskLog log)
                  throws CmsException
Reads the owner of a tasklog.

Parameters:
context - the current request context
log - the tasklog
Returns:
the owner of a resource
Throws:
CmsException - if something goes wrong

readPath

public java.util.List readPath(CmsRequestContext context,
                               int projectId,
                               java.lang.String path,
                               CmsResourceFilter filter)
                        throws CmsException
Builds a list of resources for a given path.

Parameters:
context - the current request context
projectId - the project to lookup the resource
path - the requested path
filter - a filter object (only "includeDeleted" information is used!)
Returns:
list of CmsResources
Throws:
CmsException - if something goes wrong

readProject

public CmsProject readProject(CmsRequestContext context,
                              CmsTask task)
                       throws CmsException
Reads a project of a given task.

Parameters:
context - the current request context
task - the task to read the project of
Returns:
the project of the task
Throws:
CmsException - if something goes wrong

readProject

public CmsProject readProject(int id)
                       throws CmsException
Reads a project given the projects id.

Parameters:
id - the id of the project
Returns:
the project read
Throws:
CmsException - if something goes wrong

readProject

public CmsProject readProject(java.lang.String name)
                       throws CmsException
Reads a project.

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(int) to ensure the right project is read.

Parameters:
name - the name of the project
Returns:
the project read
Throws:
CmsException - if something goes wrong

readProjectLogs

public java.util.List readProjectLogs(CmsRequestContext context,
                                      int projectId)
                               throws CmsException
Reads all task log entries for a project.

Parameters:
context - the current request context
projectId - the id of the project for which the tasklog will be read
Returns:
a list of CmsTaskLog objects
Throws:
CmsException - if something goes wrong

readProjectResources

public java.util.List readProjectResources(CmsRequestContext context,
                                           CmsProject project)
                                    throws CmsException
Returns the list of all resource names that define the "view" of the given project.

Parameters:
context - the current request context
project - the project to get the project resources for
Returns:
the list of all resources, as String objects that define the "view" of the given project.
Throws:
CmsException - if something goes wrong

readProjectView

public java.util.List readProjectView(CmsRequestContext context,
                                      int projectId,
                                      int state)
                               throws CmsException
Reads all resources of a project that match a given state from the VFS.

Possible values for the state parameter are:

Parameters:
context - the current request context
projectId - the id of the project to read the file resources for
state - the resource state to match
Returns:
a list of CmsResource objects matching the filter criteria
Throws:
CmsException - if something goes wrong
See Also:
CmsObject.readProjectView(int, int)

readPropertyDefinition

public CmsPropertyDefinition readPropertyDefinition(CmsRequestContext context,
                                                    java.lang.String name)
                                             throws CmsException
Reads a property definition.

If no property definition with the given name is found, null is returned.

Parameters:
context - the current request context
name - the name of the property definition to read
Returns:
the property definition that was read, or null if there is no property definition with the given name.
Throws:
CmsException - if something goes wrong

readPropertyObject

public CmsProperty readPropertyObject(CmsRequestContext context,
                                      CmsResource resource,
                                      java.lang.String key,
                                      boolean search)
                               throws CmsException
Reads a property object from a resource specified by a property name.

Returns CmsProperty.getNullProperty() if the property is not found.

Parameters:
context - the context of the current request
resource - the resource where the property is mapped to
key - the property key name
search - if true, the property is searched on all parent folders of the resource. if it's not found attached directly to the resource.
Returns:
the required property, or CmsProperty.getNullProperty() if the property was not found
Throws:
CmsException - if something goes wrong

readPropertyObjects

public java.util.List readPropertyObjects(CmsRequestContext context,
                                          CmsResource resource,
                                          boolean search)
                                   throws CmsException
Reads all property objects from a resource.

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 differrent value, the result list will contain only the property with the value from the resource, not form the parent folder(s).

Parameters:
context - the context of the current request
resource - the resource where the property is mapped to
search - true, if the properties should be searched on all parent folders if not found on the resource
Returns:
a list of CmsProperty objects
Throws:
CmsException - if something goes wrong

readPublishedResources

public java.util.List readPublishedResources(CmsRequestContext context,
                                             CmsUUID publishHistoryId)
                                      throws CmsException
Reads the resources that were published in a publish task for a given publish history ID.

Parameters:
context - the current request context
publishHistoryId - unique int ID to identify each publish task in the publish history
Returns:
a list of CmsPublishedResource objects
Throws:
CmsException - if something goes wrong

readResource

public CmsResource readResource(CmsRequestContext context,
                                java.lang.String resourcePath,
                                CmsResourceFilter filter)
                         throws CmsException
Reads a resource from the VFS, using the specified resource filter.

A resource may be of type CmsFile or CmsFolder. 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 absolutly required. To "upgrade" a resource to a file, use CmsFile.upgrade(CmsResource, CmsObject).

The specified filter controls what kind of resources should be "found" during the read operation. This will depend on the application. For example, using CmsResourceFilter.DEFAULT will only return currently "valid" resources, while using CmsResourceFilter.IGNORE_EXPIRATION will ignore the date release / date expired information of the resource.

Parameters:
context - the current request context
resourcePath - the name of the resource to read (full path)
filter - the resource filter to use while reading
Returns:
the resource that was read
Throws:
CmsException - if the resource could not be read for any reason
See Also:
CmsObject.readResource(String, CmsResourceFilter), CmsObject.readResource(String), CmsFile.upgrade(CmsResource, CmsObject)

readResources

public java.util.List readResources(CmsRequestContext context,
                                    CmsResource parent,
                                    CmsResourceFilter filter,
                                    boolean readTree)
                             throws CmsException,
                                    CmsSecurityException
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.

Parameters:
context - the current request context
parent - the parent path to read the resources from
filter - the filter
readTree - true to read all subresources
Returns:
a list of CmsResource objects matching the filter criteria
Throws:
CmsSecurityException - if the user has insufficient permission for the given resource (read is required).
CmsException - if something goes wrong

readResourcesWithProperty

public java.util.List readResourcesWithProperty(CmsRequestContext context,
                                                java.lang.String path,
                                                java.lang.String propertyDefinition)
                                         throws CmsException
Reads all resources that have a value set for the specified property (definition) in the given path.

Both individual and shared properties of a resource are checked.

Parameters:
context - the current request context
path - the folder to get the resources with the property from
propertyDefinition - the name of the property (definition) to check for
Returns:
a list of all CmsResource objects that have a value set for the specified property.
Throws:
CmsException - if something goes wrong

readResourcesWithProperty

public java.util.List readResourcesWithProperty(CmsRequestContext context,
                                                java.lang.String path,
                                                java.lang.String propertyDefinition,
                                                java.lang.String value)
                                         throws CmsException
Reads all resources that have a value (containing the specified value) set for the specified property (definition) in the given path.

Both individual and shared properties of a resource are checked.

Parameters:
context - the current request context
path - the folder to get the resources with the property from
propertyDefinition - the name of the property (definition) to check for
value - the string to search in the value of the property
Returns:
a list of all CmsResource objects that have a value set for the specified property.
Throws:
CmsException - if something goes wrong

readResponsiblePrincipals

public java.util.Set readResponsiblePrincipals(CmsRequestContext context,
                                               CmsResource resource)
                                        throws CmsException
Returns a set of users that are responsible for a specific resource.

Parameters:
context - the current request context
resource - the resource to get the responsible users from
Returns:
the set of users that are responsible for a specific resource
Throws:
CmsException - if something goes wrong

readResponsibleUsers

public java.util.Set readResponsibleUsers(CmsRequestContext context,
                                          CmsResource resource)
                                   throws CmsException
Returns a set of users that are responsible for a specific resource.

Parameters:
context - the current request context
resource - the resource to get the responsible users from
Returns:
the set of users that are responsible for a specific resource
Throws:
CmsException - if something goes wrong

readSiblings

public java.util.List readSiblings(CmsRequestContext context,
                                   CmsResource resource,
                                   CmsResourceFilter filter)
                            throws CmsException
Returns a List of all siblings of the specified resource, the specified resource being always part of the result set.

Parameters:
context - the request context
resource - the specified resource
filter - a filter object
Returns:
a list of CmsResources that are siblings to the specified resource, including the specified resource itself.
Throws:
CmsException - if something goes wrong

readStaticExportPublishedResourceParameters

public java.lang.String readStaticExportPublishedResourceParameters(CmsRequestContext context,
                                                                    java.lang.String rfsName)
                                                             throws CmsException
Returns the parameters of a resource in the table of all published template resources.

Parameters:
context - the current request context
rfsName - the rfs name of the resource
Returns:
the paramter string of the requested resource
Throws:
CmsException - if something goes wrong

readStaticExportResources

public java.util.List readStaticExportResources(CmsRequestContext context,
                                                int parameterResources,
                                                long timestamp)
                                         throws CmsException
Returns a list of all template resources which must be processed during a static export.

Parameters:
context - the current request context
parameterResources - flag for reading resources with parameters (1) or without (0)
timestamp - for reading the data from the db
Returns:
a list of template resources as String objects
Throws:
CmsException - if something goes wrong

readTask

public CmsTask readTask(CmsRequestContext context,
                        int id)
                 throws CmsException
Reads the task with the given id.

Parameters:
context - the current request context
id - the id for the task to read
Returns:
the task with the given id
Throws:
CmsException - if something goes wrong

readTaskLogs

public java.util.List readTaskLogs(CmsRequestContext context,
                                   int taskid)
                            throws CmsException
Reads log entries for a task.

Parameters:
context - the current request context
taskid - the task for the tasklog to read
Returns:
a list of CmsTaskLog objects
Throws:
CmsException - if something goes wrong

readTasksForProject

public java.util.List readTasksForProject(CmsRequestContext context,
                                          int projectId,
                                          int tasktype,
                                          java.lang.String orderBy,
                                          java.lang.String sort)
                                   throws CmsException
Reads all tasks for a project.

The tasktype parameter will filter the tasks. The possible values are:

Parameters:
context - the current request context
projectId - the id of the project in which the tasks are defined. Can be null to select all tasks
tasktype - the type of task you want to read
orderBy - specifies how to order the tasks
sort - sort order: C_SORT_ASC, C_SORT_DESC, or null
Returns:
a list of CmsTask objects for the project
Throws:
CmsException - if operation was not successful

readTasksForRole

public java.util.List readTasksForRole(CmsRequestContext context,
                                       int projectId,
                                       java.lang.String roleName,
                                       int tasktype,
                                       java.lang.String orderBy,
                                       java.lang.String sort)
                                throws CmsException
Reads all tasks for a role in a project.

The tasktype parameter will filter the tasks. The possible values for this parameter are:

Parameters:
context - the current request context
projectId - the id of the Project in which the tasks are defined
roleName - the role who has to process the task
tasktype - the type of task you want to read
orderBy - specifies how to order the tasks
sort - sort order C_SORT_ASC, C_SORT_DESC, or null
Returns:
list of CmsTask objects for the role
Throws:
CmsException - if operation was not successful

readTasksForUser

public java.util.List readTasksForUser(CmsRequestContext context,
                                       int projectId,
                                       java.lang.String userName,
                                       int taskType,
                                       java.lang.String orderBy,
                                       java.lang.String sort)
                                throws CmsException
Reads all tasks for a user in a project.

The tasktype parameter will filter the tasks. The possible values for this parameter are:

Parameters:
context - the current request context
projectId - the id of the Project in which the tasks are defined
userName - the user who has to process the task
taskType - the type of task you want to read
orderBy - specifies how to order the tasks
sort - sort order C_SORT_ASC, C_SORT_DESC, or null
Returns:
a list of CmsTask objects for the user
Throws:
CmsException - if operation was not successful

readUser

public CmsUser readUser(CmsRequestContext context,
                        CmsUUID id)
                 throws CmsException
Returns a user object based on the id of a user.

Parameters:
context - the current request context
id - the id of the user to read
Returns:
the user read
Throws:
CmsException - if something goes wrong

readUser

public CmsUser readUser(CmsRequestContext context,
                        java.lang.String username,
                        int type)
                 throws CmsException
Returns a user object.

Parameters:
context - the current request context
username - the name of the user that is to be read
type - the type of the user
Returns:
user read
Throws:
CmsException - if operation was not succesful

readUser

public CmsUser readUser(CmsRequestContext context,
                        java.lang.String username,
                        java.lang.String password)
                 throws CmsException
Returns a user object if the password for the user is correct.

If the user/pwd pair is not valid a CmsException is thrown.

Parameters:
context - the current request context
username - the username of the user that is to be read
password - the password of the user that is to be read
Returns:
user read
Throws:
CmsException - if operation was not succesful

readUser

public CmsUser readUser(java.lang.String username)
                 throws CmsException
Returns a user object.

Parameters:
username - the name of the user that is to be read
Returns:
user read form the cms
Throws:
CmsException - if operation was not succesful

readWebUser

public CmsUser readWebUser(CmsRequestContext context,
                           java.lang.String username)
                    throws CmsException
Read a web user from the database.

Parameters:
context - the current request context
username - the web user to read
Returns:
the read web user
Throws:
CmsException - if the user could not be read.

readWebUser

public CmsUser readWebUser(CmsRequestContext context,
                           java.lang.String username,
                           java.lang.String password)
                    throws CmsException
Returns a user object if the password for the user is correct.

If the user/pwd pair is not valid a CmsException is thrown.

Parameters:
context - the current request context
username - the username of the user that is to be read
password - the password of the user that is to be read
Returns:
the webuser read
Throws:
CmsException - if operation was not succesful

removeAccessControlEntry

public void removeAccessControlEntry(CmsRequestContext context,
                                     CmsResource resource,
                                     CmsUUID principal)
                              throws CmsException,
                                     CmsSecurityException
Removes an access control entry for a given resource and principal.

Parameters:
context - the current request context
resource - the resource
principal - the id of the principal to remove the the access control entry for
Throws:
CmsException - if something goes wrong
CmsSecurityException - if the user has insufficient permission for the given resource (conrol of access control is required).

removeResourceFromProject

public void removeResourceFromProject(CmsRequestContext context,
                                      CmsResource resource)
                               throws CmsException,
                                      CmsRoleViolationException
Removes a resource from the current project of the user.

Parameters:
context - the current request context
resource - the resource to apply this operation to
Throws:
CmsException - if something goes wrong
CmsRoleViolationException - if the current user does not have management access to the project.
See Also:
I_CmsResourceType.copyResourceToProject(CmsObject, CmsSecurityManager, CmsResource)

removeUserFromGroup

public void removeUserFromGroup(CmsRequestContext context,
                                java.lang.String username,
                                java.lang.String groupname)
                         throws CmsException,
                                CmsRoleViolationException
Removes a user from a group.

Parameters:
context - the current request context
username - the name of the user that is to be removed from the group
groupname - the name of the group
Throws:
CmsException - if operation was not succesful
CmsRoleViolationException - if the current user does not own the rule CmsRole.ACCOUNT_MANAGER

replaceResource

public void replaceResource(CmsRequestContext context,
                            CmsResource resource,
                            int type,
                            byte[] content,
                            java.util.List properties)
                     throws CmsException,
                            CmsSecurityException
Replaces the content, type and properties of a resource.

Parameters:
context - the current request context
resource - the name of the resource to apply this operation to
type - the new type of the resource
content - the new content of the resource
properties - the new properties of the resource
Throws:
CmsException - if something goes wrong
CmsSecurityException - if the user has insufficient permission for the given resource (write access permission is required).
See Also:
CmsObject.replaceResource(String, int, byte[], List), I_CmsResourceType.replaceResource(CmsObject, CmsSecurityManager, CmsResource, int, byte[], List)

resetPassword

public void resetPassword(CmsRequestContext context,
                          java.lang.String username,
                          java.lang.String oldPassword,
                          java.lang.String newPassword)
                   throws CmsException,
                          CmsSecurityException
Resets the password for a specified user.

Parameters:
context - the current request context
username - the name of the user
oldPassword - the old password
newPassword - the new password
Throws:
CmsException - if the user data could not be read from the database
CmsSecurityException - if the specified username and old password could not be verified

restoreResource

public void restoreResource(CmsRequestContext context,
                            CmsResource resource,
                            int tag)
                     throws CmsException,
                            CmsSecurityException
Restores a file in the current project with a version from the backup archive.

Parameters:
context - the current request context
resource - the resource to restore from the archive
tag - the tag (version) id to resource form the archive
Throws:
CmsException - if something goes wrong
CmsSecurityException - if the user has insufficient permission for the given resource (write access permission is required).
See Also:
CmsObject.restoreResourceBackup(String, int), I_CmsResourceType.restoreResourceBackup(CmsObject, CmsSecurityManager, CmsResource, int)

setDateExpired

public void setDateExpired(CmsRequestContext context,
                           CmsResource resource,
                           long dateExpired)
                    throws CmsException,
                           CmsSecurityException
Changes the "expire" date of a resource.

Parameters:
context - the current request context
resource - the resource to touch
dateExpired - the new expire date of the changed resource
Throws:
CmsException - if something goes wrong
CmsSecurityException - if the user has insufficient permission for the given resource (write access permission is required).
See Also:
CmsObject.setDateExpired(String, long, boolean), I_CmsResourceType.setDateExpired(CmsObject, CmsSecurityManager, CmsResource, long, boolean)

setDateLastModified

public void setDateLastModified(CmsRequestContext context,
                                CmsResource resource,
                                long dateLastModified)
                         throws CmsException,
                                CmsSecurityException
Changes the "last modified" timestamp of a resource.

Parameters:
context - the current request context
resource - the resource to touch
dateLastModified - timestamp the new timestamp of the changed resource
Throws:
CmsException - if something goes wrong
CmsSecurityException - if the user has insufficient permission for the given resource (write access permission is required).
See Also:
CmsObject.setDateLastModified(String, long, boolean), I_CmsResourceType.setDateLastModified(CmsObject, CmsSecurityManager, CmsResource, long, boolean)

setDateReleased

public void setDateReleased(CmsRequestContext context,
                            CmsResource resource,
                            long dateReleased)
                     throws CmsException,
                            CmsSecurityException
Changes the "release" date of a resource.

Parameters:
context - the current request context
resource - the resource to touch
dateReleased - the new release date of the changed resource
Throws:
CmsException - if something goes wrong
CmsSecurityException - if the user has insufficient permission for the given resource (write access permission is required).
See Also:
CmsObject.setDateReleased(String, long, boolean), I_CmsResourceType.setDateReleased(CmsObject, CmsSecurityManager, CmsResource, long, boolean)

setName

public void setName(CmsRequestContext context,
                    int taskId,
                    java.lang.String name)
             throws CmsException
Set a new name for a task.

Parameters:
context - the current request context
taskId - the Id of the task to set the percentage
name - the new name value
Throws:
CmsException - if something goes wrong

setParentGroup

public void setParentGroup(CmsRequestContext context,
                           java.lang.String groupName,
                           java.lang.String parentGroupName)
                    throws CmsException,
                           CmsRoleViolationException
Sets a new parent-group for an already existing group.

Parameters:
context - the current request context
groupName - the name of the group that should be written
parentGroupName - the name of the parent group to set, or null if the parent group should be deleted.
Throws:
CmsException - if operation was not succesful
CmsRoleViolationException - if the current user does not own the rule CmsRole.ACCOUNT_MANAGER

setPassword

public void setPassword(CmsRequestContext context,
                        java.lang.String username,
                        java.lang.String newPassword)
                 throws CmsException,
                        CmsRoleViolationException
Sets the password for a user.

Parameters:
context - the current request context
username - the name of the user
newPassword - the new password
Throws:
CmsException - if operation was not succesfull
CmsRoleViolationException - if the current user does not own the rule CmsRole.ACCOUNT_MANAGER

setPriority

public void setPriority(CmsRequestContext context,
                        int taskId,
                        int priority)
                 throws CmsException
Set priority of a task.

Parameters:
context - the current request context
taskId - the Id of the task to set the percentage
priority - the priority value
Throws:
CmsException - if something goes wrong

setTaskPar

public void setTaskPar(CmsRequestContext context,
                       int taskId,
                       java.lang.String parName,
                       java.lang.String parValue)
                throws CmsException
Set a Parameter for a task.

Parameters:
context - the current request context
taskId - the Id of the task
parName - name of the parameter
parValue - value if the parameter
Throws:
CmsException - if something goes wrong

setTimeout

public void setTimeout(CmsRequestContext context,
                       int taskId,
                       long timeout)
                throws CmsException
Set timeout of a task.

Parameters:
context - the current request context
taskId - the Id of the task to set the percentage
timeout - new timeout value
Throws:
CmsException - if something goes wrong

undoChanges

public void undoChanges(CmsRequestContext context,
                        CmsResource resource)
                 throws CmsException,
                        CmsSecurityException
Undos all changes in the resource by restoring the version from the online project to the current offline project.

Parameters:
context - the current request context
resource - the name of the resource to apply this operation to
Throws:
CmsException - if something goes wrong
CmsSecurityException - if the user has insufficient permission for the given resource (write access permission is required).
See Also:
CmsObject.undoChanges(String, boolean), I_CmsResourceType.undoChanges(CmsObject, CmsSecurityManager, CmsResource, boolean)

unlockProject

public void unlockProject(CmsRequestContext context,
                          int projectId)
                   throws CmsException,
                          CmsRoleViolationException
Unlocks all resources in this project.

Parameters:
context - the current request context
projectId - the id of the project to be published
Throws:
CmsException - if something goes wrong
CmsRoleViolationException - if the current user does not own the rule CmsRole.PROJECT_MANAGER for the current project.

unlockResource

public void unlockResource(CmsRequestContext context,
                           CmsResource resource)
                    throws CmsException,
                           CmsSecurityException
Unlocks a resource.

Parameters:
context - the current request context
resource - the resource to unlock
Throws:
CmsException - if something goes wrong
CmsSecurityException - if the user has insufficient permission for the given resource (write access permission is required).
See Also:
CmsObject.unlockResource(String), I_CmsResourceType.unlockResource(CmsObject, CmsSecurityManager, CmsResource)

userInGroup

public boolean userInGroup(CmsRequestContext context,
                           java.lang.String username,
                           java.lang.String groupname)
                    throws CmsException
Tests if a user is member of the given group.

Parameters:
context - the current request context
username - the name of the user to check
groupname - the name of the group to check
Returns:
true, if the user is in the group; or false otherwise
Throws:
CmsException - if operation was not succesful

validateHtmlLinks

public java.util.Map validateHtmlLinks(CmsObject cms,
                                       CmsPublishList publishList,
                                       I_CmsReport report)
                                throws java.lang.Exception
Validates the HTML links in the unpublished files of the specified publish list, if a file resource type implements the interface I_CmsXmlDocumentLinkValidatable.

Parameters:
cms - the current user's Cms object
publishList - an OpenCms publish list
report - a report to write the messages to
Returns:
a map with lists of invalid links (String objects) keyed by resource names
Throws:
java.lang.Exception - if something goes wrong
See Also:
fillPublishList(CmsRequestContext, CmsPublishList)

validatePassword

public void validatePassword(java.lang.String password)
                      throws CmsSecurityException
This method checks if a new password follows the rules for new passwords, which are defined by a Class implementing the I_CmsPasswordHandler interface and configured in the opencms.properties file.

If this method throws no exception the password is valid.

Parameters:
password - the new password that has to be checked
Throws:
CmsSecurityException - if the password is not valid

writeAccessControlEntry

public void writeAccessControlEntry(CmsRequestContext context,
                                    CmsResource resource,
                                    CmsAccessControlEntry ace)
                             throws CmsException,
                                    CmsSecurityException
Writes an access control entries to a given resource.

Parameters:
context - the current request context
resource - the resource
ace - the entry to write
Throws:
CmsSecurityException - if the user has insufficient permission for the given resource (CmsPermissionSet.ACCESS_CONTROL required).
CmsException - if something goes wrong

writeFile

public CmsFile writeFile(CmsRequestContext context,
                         CmsFile resource)
                  throws CmsException,
                         CmsSecurityException
Writes a resource to the OpenCms VFS, including it's content.

Applies only to resources of type CmsFile i.e. resources that have a binary content attached.

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.

Parameters:
context - the current request context
resource - the resource to apply this operation to
Returns:
the written resource (may have been modified)
Throws:
CmsSecurityException - if the user has insufficient permission for the given resource (CmsPermissionSet.ACCESS_WRITE required).
CmsException - if something goes wrong
See Also:
CmsObject.writeFile(CmsFile), I_CmsResourceType.writeFile(CmsObject, CmsSecurityManager, CmsFile)

writeGroup

public void writeGroup(CmsRequestContext context,
                       CmsGroup group)
                throws CmsException,
                       CmsRoleViolationException
Writes an already existing group.

The group id has to be a valid OpenCms group id.
The group with the given id will be completely overriden by the given data.

Parameters:
context - the current request context
group - the group that should be written
Throws:
CmsRoleViolationException - if the current user does not own the role CmsRole.ACCOUNT_MANAGER for the current project.
CmsException - if operation was not succesfull

writeProject

public void writeProject(CmsRequestContext context,
                         CmsProject project)
                  throws CmsRoleViolationException,
                         CmsException
Writes an already existing project.

The project id has to be a valid OpenCms project id.
The project with the given id will be completely overriden by the given data.

Parameters:
project - the project that should be written
context - the current request context
Throws:
CmsRoleViolationException - if the current user does not own the role CmsRole.PROJECT_MANAGER for the current project.
CmsException - if operation was not successful

writePropertyObject

public void writePropertyObject(CmsRequestContext context,
                                CmsResource resource,
                                CmsProperty property)
                         throws CmsException,
                                CmsSecurityException
Writes a property for a specified resource.

Parameters:
context - the current request context
resource - the resource to write the property for
property - the property to write
Throws:
CmsException - if something goes wrong
CmsSecurityException - if the user has insufficient permission for the given resource (CmsPermissionSet.ACCESS_WRITE required).
See Also:
CmsObject.writePropertyObject(String, CmsProperty), I_CmsResourceType.writePropertyObject(CmsObject, CmsSecurityManager, CmsResource, CmsProperty)

writePropertyObjects

public void writePropertyObjects(CmsRequestContext context,
                                 CmsResource resource,
                                 java.util.List properties)
                          throws CmsException,
                                 CmsSecurityException
Writes a list of properties for a specified resource.

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.

Parameters:
context - the current request context
resource - the resource to write the properties for
properties - the list of properties to write
Throws:
CmsException - if something goes wrong
CmsSecurityException - if the user has insufficient permission for the given resource (CmsPermissionSet.ACCESS_WRITE required).
See Also:
CmsObject.writePropertyObjects(String, List), I_CmsResourceType.writePropertyObjects(CmsObject, CmsSecurityManager, CmsResource, List)

writeResource

public void writeResource(CmsRequestContext context,
                          CmsResource resource)
                   throws CmsException,
                          CmsSecurityException
Writes a resource to the OpenCms VFS.

Parameters:
context - the current request context
resource - the resource to write
Throws:
CmsSecurityException - if the user has insufficient permission for the given resource (CmsPermissionSet.ACCESS_WRITE required).
CmsException - if something goes wrong

writeStaticExportPublishedResource

public void writeStaticExportPublishedResource(CmsRequestContext context,
                                               java.lang.String resourceName,
                                               int linkType,
                                               java.lang.String linkParameter,
                                               long timestamp)
                                        throws CmsException
Inserts an entry in the published resource table.

This is done during static export.

Parameters:
context - the current request context
resourceName - The name of the resource to be added to the static export
linkType - the type of resource exported (0= non-paramter, 1=parameter)
linkParameter - the parameters added to the resource
timestamp - a timestamp for writing the data into the db
Throws:
CmsException - if something goes wrong

writeTaskLog

public void writeTaskLog(CmsRequestContext context,
                         int taskid,
                         java.lang.String comment)
                  throws CmsException
Writes a new user tasklog for a task.

Parameters:
context - the current request context
taskid - the Id of the task
comment - description for the log
Throws:
CmsException - if something goes wrong

writeTaskLog

public void writeTaskLog(CmsRequestContext context,
                         int taskId,
                         java.lang.String comment,
                         int type)
                  throws CmsException
Writes a new user tasklog for a task.

Parameters:
context - the current request context
taskId - the Id of the task
comment - description for the log
type - type of the tasklog. User tasktypes must be greater than 100
Throws:
CmsException - something goes wrong

writeUser

public void writeUser(CmsRequestContext context,
                      CmsUser user)
               throws CmsException,
                      CmsRoleViolationException
Updates the user information.

The user id has to be a valid OpenCms user id.
The user with the given id will be completely overriden by the given data.

Parameters:
context - the current request context
user - the user to be updated
Throws:
CmsRoleViolationException - if the current user does not own the rule CmsRole.ACCOUNT_MANAGER for the current project.
CmsException - if operation was not succesful

writeWebUser

public void writeWebUser(CmsRequestContext context,
                         CmsUser user)
                  throws CmsException
Updates the user information of a web user.
Only a web user can be updated this way.

The user id has to be a valid OpenCms user id.
The user with the given id will be completely overriden by the given data.

Parameters:
context - the current request context
user - the user to be updated
Throws:
CmsException - if operation was not succesful

checkPermissions

protected void checkPermissions(CmsDbContext dbc,
                                CmsResource resource,
                                CmsPermissionSet requiredPermissions,
                                boolean checkLock,
                                CmsResourceFilter filter)
                         throws CmsException,
                                CmsSecurityException
Performs a blocking permission check on a resource.

If the required permissions are not satisfied by the permissions the user has on the resource, an exception is thrown.

Parameters:
dbc - the current database context
resource - the resource on which permissions are required
requiredPermissions - the set of permissions required to access the resource
checkLock - if true, the lock status of the resource is also checked
filter - the filter for the resource
Throws:
CmsException - in case of any i/o error
CmsSecurityException - if the required permissions are not satisfied
See Also:
hasPermissions(CmsRequestContext, CmsResource, CmsPermissionSet, boolean, CmsResourceFilter)

checkPermissions

protected void checkPermissions(CmsRequestContext context,
                                CmsResource resource,
                                CmsPermissionSet requiredPermissions,
                                int permissions)
                         throws CmsSecurityException,
                                CmsLockException,
                                CmsVfsResourceNotFoundException
Applies the permission check result of a previous call to hasPermissions(CmsRequestContext, CmsResource, CmsPermissionSet, boolean, CmsResourceFilter).

Parameters:
context - the current request context
resource - the resource on which permissions are required
requiredPermissions - the set of permissions required to access the resource
permissions - the permissions to check
Throws:
CmsSecurityException - if the required permissions are not satisfied
CmsLockException - if the lock status is not as required
CmsVfsResourceNotFoundException - if the required resource has been filtered

clearPermissionCache

protected void clearPermissionCache()
Clears the permission cache.


finalize

protected void finalize()
                 throws java.lang.Throwable
Throws:
java.lang.Throwable
See Also:
Object.finalize()

hasPermissions

protected int hasPermissions(CmsDbContext dbc,
                             CmsResource resource,
                             CmsPermissionSet requiredPermissions,
                             boolean checkLock,
                             CmsResourceFilter filter)
                      throws CmsException
Performs a non-blocking permission check on a resource.

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:

Parameters:
dbc - the current database context
resource - the resource on which permissions are required
requiredPermissions - the set of permissions required for the operation
checkLock - 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 user
filter - the resource filter to use
Returns:
PERM_ALLOWED if the user has sufficient permissions on the resource for the requested operation
Throws:
CmsException - in case of i/o errors (NOT because of insufficient permissions)

readFolder

protected CmsFolder readFolder(CmsDbContext dbc,
                               java.lang.String resourcename,
                               CmsResourceFilter filter)
                        throws CmsException
Reads a folder from the VFS, using the specified resource filter.

Parameters:
dbc - the current database context
resourcename - the name of the folder to read (full path)
filter - the resource filter to use while reading
Returns:
the folder that was read
Throws:
CmsException - if something goes wrong

readResource

protected CmsResource readResource(CmsDbContext dbc,
                                   java.lang.String resourcePath,
                                   CmsResourceFilter filter)
                            throws CmsException
Reads a resource from the OpenCms VFS, using the specified resource filter.

Parameters:
dbc - the current database context
resourcePath - the name of the resource to read (full path)
filter - the resource filter to use while reading
Returns:
the resource that was read
Throws:
CmsException - if something goes wrong
See Also:
CmsObject.readResource(String, CmsResourceFilter), CmsObject.readResource(String), CmsFile.upgrade(CmsResource, CmsObject)