/** * Returns the current user.<p> * * @return the current user */ public CmsUser currentUser() { return m_requestContext.currentUser(); }
/** * Returns the currently logged in user.<p> * * @return the currently logged in user */ public CmsUser getUser() { return getRequestContext().currentUser(); }
/** * Returns the current user.<p> * * @return the current user */ public CmsUser whoami() { return m_cms.getRequestContext().currentUser(); }
/** * Returns the user.<p> * * @return the user */ public String getUser() { return m_context.currentUser().getName(); } }
/** * Creates a user settings object with initialized settings of the current user.<p> * * @param cms the OpenCms context */ public CmsUserSettings(CmsObject cms) { this(cms.getRequestContext().currentUser()); }
/** * 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); }
/** * Returns the user name of the currently logged in user.<p> * * @return the user name of the currently logged in user */ public String getUserName() { return getRequestContext().currentUser().getName(); }
/** * Returns the set of permissions of the current user for a given resource.<p> * * @param resourceName the name of the resource * * @return the bit set of the permissions of the current user * * @throws CmsException if something goes wrong */ public CmsPermissionSet getPermissions(String resourceName) throws CmsException { return getPermissions(resourceName, m_context.currentUser().getName()); }
/** * Use this Constructor if you need to check the old password of the current logged in user.<p> * * @param cms the cms context */ public CmsPasswordInfo(CmsObject cms) { m_cms = cms; if (m_cms != null) { m_userName = m_cms.getRequestContext().currentUser().getName(); } else { m_userName = null; } }
/** * Checks if the given context user has the given role in the given organizational unit.<p> * * @param cms the opencms context * @param role the role to check * * @return <code>true</code> if the given context user has the given role in the given organizational unit */ public boolean hasRole(CmsObject cms, CmsRole role) { return m_securityManager.hasRole(cms.getRequestContext(), cms.getRequestContext().currentUser(), role); }
/** * Returns the filter to get all blocking locks.<p> * * @return the filter to get all blocking locks */ public CmsLockFilter getBlockingFilter() { if (m_blockingFilter == null) { m_blockingFilter = CmsLockFilter.FILTER_ALL; m_blockingFilter = m_blockingFilter.filterNotLockableByUser(getCms().getRequestContext().currentUser()); } return m_blockingFilter; }
/** * Returns true if the current user is not the guest user, * i.e. if he already has logged in with some other user account.<p> * * @return true if the current user is already logged in */ public boolean isLoggedIn() { return !getCmsObject().getRequestContext().currentUser().isGuestUser(); }
/** * Returns the filter to get all non blocking locks.<p> * * @return the filter to get all non blocking locks */ public CmsLockFilter getNonBlockingFilter() { if (m_nonBlockingFilter == null) { m_nonBlockingFilter = CmsLockFilter.FILTER_ALL; m_nonBlockingFilter = m_nonBlockingFilter.filterLockableByUser(getCms().getRequestContext().currentUser()); m_nonBlockingFilter = m_nonBlockingFilter.filterSharedExclusive(); } return m_nonBlockingFilter; }
/** * Returns the filter to identify blocking locks.<p> * * @return the filter to identify blocking locks */ private CmsLockFilter getBlockingFilter() { CmsLockFilter blockingFilter = CmsLockFilter.FILTER_ALL; blockingFilter = blockingFilter.filterNotLockableByUser(getCms().getRequestContext().currentUser()); if (!isDirectPublish()) { blockingFilter = blockingFilter.filterProject(new CmsUUID(getParamProjectid())); } return blockingFilter; }
/** * @see org.opencms.workplace.CmsWorkplace#checkRole() */ @Override protected void checkRole() throws CmsRoleViolationException { // needed since these pages are static exported if (!OpenCms.getDefaultUsers().isUserExport(getCms().getRequestContext().currentUser().getName())) { // only for users that are not the export user OpenCms.getRoleManager().checkRole(getCms(), CmsRole.WORKPLACE_USER); } }
/** * @see org.opencms.workplace.explorer.menu.I_CmsMenuItemRule#matches(org.opencms.file.CmsObject, CmsResourceUtil[]) */ public boolean matches(CmsObject cms, CmsResourceUtil[] resourceUtil) { if (resourceUtil[0].isInsideProject()) { CmsLock lock = resourceUtil[0].getLock(); return !(!resourceUtil[0].getProjectState().isLockedForPublishing() && !lock.isNullLock() && lock.isExclusiveOwnedInProjectBy( cms.getRequestContext().currentUser(), cms.getRequestContext().currentProject())); } // resource is not in current project, rule does not match return false; }
/** * @see org.opencms.workplace.explorer.menu.I_CmsMenuItemRule#matches(org.opencms.file.CmsObject, CmsResourceUtil[]) */ public boolean matches(CmsObject cms, CmsResourceUtil[] resourceUtil) { if (resourceUtil[0].isInsideProject()) { CmsLock lock = resourceUtil[0].getLock(); return !(!resourceUtil[0].getProjectState().isLockedForPublishing() && !lock.isNullLock() && lock.isExclusiveOwnedInProjectBy( cms.getRequestContext().currentUser(), cms.getRequestContext().currentProject())); } // resource is not in current project, rule does not match return false; }
/** * @see org.opencms.workplace.explorer.menu.I_CmsMenuItemRule#matches(org.opencms.file.CmsObject, CmsResourceUtil[]) */ public boolean matches(CmsObject cms, CmsResourceUtil[] resourceUtil) { if (resourceUtil[0].isInsideProject()) { CmsLock lock = resourceUtil[0].getLock(); return (!resourceUtil[0].getProjectState().isLockedForPublishing() && !lock.isShared() && lock.isOwnedInProjectBy( cms.getRequestContext().currentUser(), cms.getRequestContext().currentProject())); } // resource is not locked by the user in current project, rule does not match return false; }
/** * @see org.opencms.workplace.explorer.menu.I_CmsMenuItemRule#matches(org.opencms.file.CmsObject, CmsResourceUtil[]) */ public boolean matches(CmsObject cms, CmsResourceUtil[] resourceUtil) { if (resourceUtil[0].isInsideProject()) { CmsLock lock = resourceUtil[0].getLock(); return resourceUtil[0].getProjectState().isLockedForPublishing() || !(!lock.isNullLock() && lock.isExclusiveOwnedInProjectBy( cms.getRequestContext().currentUser(), cms.getRequestContext().currentProject())); } // resource is not in current project, rule does not match return false; }
/** * @see org.opencms.workplace.explorer.menu.I_CmsMenuItemRule#matches(org.opencms.file.CmsObject, CmsResourceUtil[]) */ public boolean matches(CmsObject cms, CmsResourceUtil[] resourceUtil) { if (resourceUtil[0].isInsideProject()) { CmsLock lock = resourceUtil[0].getLock(); return (!resourceUtil[0].getProjectState().isLockedForPublishing() && !lock.isShared() && lock.isOwnedInProjectBy( cms.getRequestContext().currentUser(), cms.getRequestContext().currentProject())); } // resource is not locked by the user in current project, rule does not match return false; }