/** * Returns the a new db context object.<p> * * @param ctx optional request context, can be <code>null</code> * * @return the a new db context object */ protected CmsDbContext getDbContext(CmsRequestContext ctx) { return m_dbContextFactory.getDbContext(ctx); }
/** * Initializes the default groups for an organizational unit.<p> * * @param context the request context * @param ou the organizational unit */ public void initializeOrgUnit(CmsRequestContext context, CmsOrganizationalUnit ou) { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); m_driverManager.initOrgUnit(dbc, ou); }
/** * Reads the locks that were saved to the database in the previous run of OpenCms.<p> * * @throws CmsException if something goes wrong */ public void readLocks() throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(); try { m_driverManager.readLocks(dbc); } finally { dbc.clear(); } }
/** * Reads the locks that were saved to the database in the previous run of OpenCms.<p> * * @throws CmsException if something goes wrong */ public void readLocks() throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(); try { m_driverManager.readLocks(dbc); } finally { dbc.clear(); } }
/** * Logs everything that has not been written to DB jet.<p> * * @throws CmsException if something goes wrong */ public void updateLog() throws CmsException { if (m_dbContextFactory == null) { // already shutdown return; } CmsDbContext dbc = m_dbContextFactory.getDbContext(); try { m_driverManager.updateLog(dbc); } finally { dbc.clear(); } }
/** * Reads the manager group of a project.<p> * * @param context the current request context * @param project the project to read from * * @return the group of a resource */ public CmsGroup readManagerGroup(CmsRequestContext context, CmsProject project) { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); CmsGroup result = null; try { result = m_driverManager.readManagerGroup(dbc, project); } finally { dbc.clear(); } return result; }
/** * Reads the manager group of a project.<p> * * @param context the current request context * @param project the project to read from * * @return the group of a resource */ public CmsGroup readManagerGroup(CmsRequestContext context, CmsProject project) { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); CmsGroup result = null; try { result = m_driverManager.readManagerGroup(dbc, project); } finally { dbc.clear(); } return result; }
/** * Lookup and read the user or group with the given UUID.<p> * * @param context the current request context * @param principalId the UUID of the principal to lookup * * @return the principal (group or user) if found, otherwise <code>null</code> */ public I_CmsPrincipal lookupPrincipal(CmsRequestContext context, CmsUUID principalId) { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); I_CmsPrincipal result = null; try { result = m_driverManager.lookupPrincipal(dbc, principalId); } finally { dbc.clear(); } return result; }
/** * Reads the group of a project.<p> * * @param context the current request context * @param project the project to read from * * @return the group of a resource */ public CmsGroup readGroup(CmsRequestContext context, CmsProject project) { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); CmsGroup result = null; try { result = m_driverManager.readGroup(dbc, project); } finally { dbc.clear(); } return result; }
/** * Lookup and read the user or group with the given UUID.<p> * * @param context the current request context * @param principalId the UUID of the principal to lookup * * @return the principal (group or user) if found, otherwise <code>null</code> */ public I_CmsPrincipal lookupPrincipal(CmsRequestContext context, CmsUUID principalId) { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); I_CmsPrincipal result = null; try { result = m_driverManager.lookupPrincipal(dbc, principalId); } finally { dbc.clear(); } return result; }
/** * Reads the group of a project.<p> * * @param context the current request context * @param project the project to read from * * @return the group of a resource */ public CmsGroup readGroup(CmsRequestContext context, CmsProject project) { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); CmsGroup result = null; try { result = m_driverManager.readGroup(dbc, project); } finally { dbc.clear(); } return result; }
/** * Checks if the user of the current context has permissions to impersonate the given role * for the given resource.<p> * * @param context the current request context * @param role the role to check * @param resource the resource to check the role for * * @throws CmsRoleViolationException if the user does not have the required role permissions */ public void checkRoleForResource(CmsRequestContext context, CmsRole role, CmsResource resource) throws CmsRoleViolationException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); try { checkRoleForResource(dbc, role, resource); } finally { dbc.clear(); } }
/** * Checks if the user of the current context has permissions to impersonate the given role.<p> * * If the organizational unit is <code>null</code>, this method will check if the * given user has the given role for at least one organizational unit.<p> * * @param context the current request context * @param role the role to check * * @throws CmsRoleViolationException if the user does not have the required role permissions */ public void checkRole(CmsRequestContext context, CmsRole role) throws CmsRoleViolationException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); try { checkRole(dbc, role); } finally { dbc.clear(); } }
/** * Checks if the user of the current context has permissions to impersonate the given role.<p> * * If the organizational unit is <code>null</code>, this method will check if the * given user has the given role for at least one organizational unit.<p> * * @param context the current request context * @param role the role to check * * @throws CmsRoleViolationException if the user does not have the required role permissions */ public void checkRole(CmsRequestContext context, CmsRole role) throws CmsRoleViolationException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); try { checkRole(dbc, role); } finally { dbc.clear(); } }
/** * Checks if the user of the current context has permissions to impersonate the given role * for the given resource.<p> * * @param context the current request context * @param role the role to check * @param resource the resource to check the role for * * @throws CmsRoleViolationException if the user does not have the required role permissions */ public void checkRoleForResource(CmsRequestContext context, CmsRole role, CmsResource resource) throws CmsRoleViolationException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); try { checkRoleForResource(dbc, role, resource); } finally { dbc.clear(); } }
/** * Checks if the given user has the given role for the given resource.<p> * * @param context the current request context * @param user the user to check * @param role the role to check * @param resource the resource to check the role for * * @return <code>true</code> if the given user has the given role for the given resource */ public boolean hasRoleForResource(CmsRequestContext context, CmsUser user, CmsRole role, CmsResource resource) { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); boolean result; try { result = hasRoleForResource(dbc, user, role, resource); } finally { dbc.clear(); } return result; }
/** * Writes the locks that are currently stored in-memory to the database to allow restoring them in * later startups.<p> * * This overwrites the locks previously stored in the underlying database table.<p> * * @throws CmsException if something goes wrong */ public void writeLocks() throws CmsException { if (m_dbContextFactory == null) { // already shutdown return; } CmsDbContext dbc = m_dbContextFactory.getDbContext(); try { m_driverManager.writeLocks(dbc); } finally { dbc.clear(); } }
/** * Writes the locks that are currently stored in-memory to the database to allow restoring them in * later startups.<p> * * This overwrites the locks previously stored in the underlying database table.<p> * * @throws CmsException if something goes wrong */ public void writeLocks() throws CmsException { if (m_dbContextFactory == null) { // already shutdown return; } CmsDbContext dbc = m_dbContextFactory.getDbContext(); try { m_driverManager.writeLocks(dbc); } finally { dbc.clear(); } }
/** * Checks if the given user has the given role for the given resource.<p> * * @param context the current request context * @param user the user to check * @param role the role to check * @param resource the resource to check the role for * * @return <code>true</code> if the given user has the given role for the given resource */ public boolean hasRoleForResource(CmsRequestContext context, CmsUser user, CmsRole role, CmsResource resource) { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); boolean result; try { result = hasRoleForResource(dbc, user, role, resource); } finally { dbc.clear(); } return result; }
/** * Returns all resources of organizational units for which the current user has * the given role role.<p> * * @param context the current request context * @param role the role to check * * @return a list of {@link org.opencms.file.CmsResource} objects * * @throws CmsException if something goes wrong */ public List<CmsResource> getManageableResources(CmsRequestContext context, CmsRole role) throws CmsException { List<CmsResource> resources; CmsDbContext dbc = m_dbContextFactory.getDbContext(context); try { resources = getManageableResources(dbc, role); } finally { dbc.clear(); } return resources; }