/** * Returns <code>true</code> if the given user is the owner of this lock.<p> * * @param user the user to compare to the owner of this lock * * @return <code>true</code> if the given user is the owner of this lock */ public boolean isOwnedBy(CmsUser user) { return m_userId.equals(user.getId()); }
/** * Public constructor, will use the current time for time stamp.<p> * * @param dbc the current database context with the current user * @param structureId the structure id */ public CmsVisitEntry(CmsDbContext dbc, CmsUUID structureId) { m_userId = dbc.currentUser().getId(); m_date = System.currentTimeMillis(); m_structureId = structureId; }
/** * Returns <code>true</code> if the given user is the owner of this lock.<p> * * @param user the user to compare to the owner of this lock * * @return <code>true</code> if the given user is the owner of this lock */ public boolean isOwnedBy(CmsUser user) { return m_userId.equals(user.getId()); }
/** * Public constructor, will use the current time for time stamp.<p> * * @param dbc the current database context with the current user * @param structureId the structure id * @param type the entry type * @param data the additional data to be parsed as a map */ public CmsLogEntry(CmsDbContext dbc, CmsUUID structureId, CmsLogEntryType type, String[] data) { m_userId = dbc.currentUser().getId(); m_date = System.currentTimeMillis(); m_structureId = structureId; m_data = (data == null ? new String[0] : data); m_type = type; }
/** * Caches the given user under its id AND the fully qualified name.<p> * * @param user the user to cache */ public void cacheUser(CmsUser user) { if (m_disabled.get(CacheType.USER) != null) { return; } m_cacheUser.put(user.getId().toString(), user); m_cacheUser.put(user.getName(), user); }
/** * Caches the given user under its id AND the fully qualified name.<p> * * @param user the user to cache */ public void cacheUser(CmsUser user) { if (m_disabled.get(CacheType.USER) != null) { return; } m_cacheUser.put(user.getId().toString(), user); m_cacheUser.put(user.getName(), user); }
/** * Removes the given user from the cache.<p> * * The user is removed by name AND also by uuid.<p> * * @param user the user to remove from cache */ public void uncacheUser(CmsUser user) { m_cacheUser.remove(user.getId().toString()); m_cacheUser.remove(user.getName()); }
/** * Removes the given user from the cache.<p> * * The user is removed by name AND also by uuid.<p> * * @param user the user to remove from cache */ public void uncacheUser(CmsUser user) { m_cacheUser.remove(user.getId().toString()); m_cacheUser.remove(user.getName()); }
/** * Creates a new CmsSessionInfo object.<p> * * @param context the user context to create this session info for * @param sessionId OpenCms id of the (http) session this session info belongs to * @param maxInactiveInterval the maximum time, in seconds, this session info is allowed to be inactive */ public CmsSessionInfo(CmsRequestContext context, CmsUUID sessionId, int maxInactiveInterval) { m_timeCreated = System.currentTimeMillis(); m_sessionId = sessionId; m_maxInactiveInterval = maxInactiveInterval; m_userId = context.getCurrentUser().getId(); update(context); }
/** * Creates a new CmsSessionInfo object.<p> * * @param context the user context to create this session info for * @param sessionId OpenCms id of the (http) session this session info belongs to * @param maxInactiveInterval the maximum time, in seconds, this session info is allowed to be inactive */ public CmsSessionInfo(CmsRequestContext context, CmsUUID sessionId, int maxInactiveInterval) { m_timeCreated = System.currentTimeMillis(); m_sessionId = sessionId; m_maxInactiveInterval = maxInactiveInterval; m_userId = context.currentUser().getId(); update(context); }
/** * @see org.opencms.db.I_CmsSubscriptionDriver#getDateLastVisitedBy(org.opencms.db.CmsDbContext, java.lang.String, org.opencms.file.CmsUser, org.opencms.file.CmsResource) */ public long getDateLastVisitedBy(CmsDbContext dbc, String poolName, CmsUser user, CmsResource resource) throws CmsException { CmsVisitEntryFilter filter = CmsVisitEntryFilter.ALL.filterResource(resource.getStructureId()).filterUser( user.getId()); List<CmsVisitEntry> entries = readVisits(dbc, poolName, filter); if (!entries.isEmpty()) { return entries.get(0).getDate(); } return 0; }
/** * @see org.opencms.db.I_CmsSubscriptionDriver#getDateLastVisitedBy(org.opencms.db.CmsDbContext, java.lang.String, org.opencms.file.CmsUser, org.opencms.file.CmsResource) */ public long getDateLastVisitedBy(CmsDbContext dbc, String poolName, CmsUser user, CmsResource resource) throws CmsException { CmsVisitEntryFilter filter = CmsVisitEntryFilter.ALL.filterResource(resource.getStructureId()).filterUser( user.getId()); List<CmsVisitEntry> entries = readVisits(dbc, poolName, filter); if (!entries.isEmpty()) { return entries.get(0).getDate(); } return 0; }
/** * Enumeration class for the mode parameter in the * {@link CmsDriverManager#readChangedResourcesInsideProject(CmsDbContext, CmsUUID, CmsReadChangedProjectResourceMode)} * method.<p> */ private static class CmsReadChangedProjectResourceMode { /** * Default constructor.<p> */ protected CmsReadChangedProjectResourceMode() { // noop } }
/** * Displays the user permissions.<p> * * @param user the selected user */ void displayUserPermissions(CmsUser user) { CmsPermissionView view = buildPermissionEntryForm(user.getId(), buildPermissionsForCurrentUser(), false, false); view.hideDeniedColumn(); m_userPermissions.addComponent(view); }
/** * Makes a list item for a given user.<p> * * @param user the user * * @return the list item */ protected CmsListItem makeListItemForUser(CmsUser user) { CmsListItem item = getList().newItem(user.getId().toString()); setUserData(user, item); return item; }
/** * Makes a list item from a user.<p> * * @param user a user * * @return a list item */ protected CmsListItem makeListItem(CmsUser user) { CmsListItem item = getList().newItem(user.getId().toString()); setUserData(user, item); return item; }
/** * Makes a list item for a given user.<p> * * @param user the user * * @return the list item */ protected CmsListItem makeListItemForUser(CmsUser user) { CmsListItem item = getList().newItem(user.getId().toString()); setUserData(user, item); return item; }
/** * Checks that the resource is not locked by another user.<p> * * @param resource the resource * @return true if the resource is not locked by another user * * @throws CmsException if something goes wrong */ private boolean checkLock(CmsResource resource) throws CmsException { CmsLock lock = m_cms.getLock(resource); return lock.isUnlocked() || lock.getUserId().equals(m_cms.getRequestContext().getCurrentUser().getId()); }
/** * Makes a list item from a user.<p> * * @param user the user * * @return the list item */ protected CmsListItem makeListItem(CmsUser user) { CmsListItem item = getList().newItem(user.getId().toString()); item.set(LIST_COLUMN_LOGIN, user.getName()); item.set(LIST_COLUMN_FULLNAME, user.getFullName()); return item; }
/** * Enumeration class for the mode parameter in the * {@link CmsDriverManager#readChangedResourcesInsideProject(CmsDbContext, CmsUUID, CmsReadChangedProjectResourceMode)} * method.<p> */ private static class CmsReadChangedProjectResourceMode { /** * Default constructor.<p> */ protected CmsReadChangedProjectResourceMode() { // noop } }