cmsobject.java
来自「找了很久才找到到源代码」· Java 代码 · 共 1,624 行 · 第 1/5 页
JAVA
1,624 行
*
* @throws CmsException if operation was not successful
*
* @deprecated use {@link #getGroupsOfUser(String, boolean)} instead
*/
public List getDirectGroupsOfUser(String username) throws CmsException {
return getGroupsOfUser(username, true);
}
/**
* Returns all file resources contained in a folder.<p>
*
* The result is filtered according to the rules of
* the <code>{@link CmsResourceFilter#DEFAULT}</code> filter.<p>
*
* @param resourcename the full current site relative path of the resource to return the child resources for
*
* @return a list of all child files as <code>{@link CmsResource}</code> objects
*
* @throws CmsException if something goes wrong
*
* @see #getFilesInFolder(String, CmsResourceFilter)
*/
public List getFilesInFolder(String resourcename) throws CmsException {
return getFilesInFolder(resourcename, CmsResourceFilter.DEFAULT);
}
/**
* Returns all file resources contained in a folder.<p>
*
* With the <code>{@link CmsResourceFilter}</code> provided as parameter
* you can control if you want to include deleted, invisible or
* time-invalid resources in the result.<p>
*
* @param resourcename the full path of the resource to return the child resources for
* @param filter the resource filter to use
*
* @return a list of all child file as <code>{@link CmsResource}</code> objects
*
* @throws CmsException if something goes wrong
*/
public List getFilesInFolder(String resourcename, CmsResourceFilter filter) throws CmsException {
CmsResource resource = readResource(resourcename, CmsResourceFilter.ALL);
return m_securityManager.readChildResources(m_context, resource, filter, false, true);
}
/**
* Returns all groups.<p>
*
* @return a list of all <code>{@link CmsGroup}</code> objects
*
* @throws CmsException if operation was not successful
*
* @deprecated use {@link org.opencms.security.CmsOrgUnitManager#getGroups(CmsObject, String, boolean) OpenCms.getOrgUnitManager().getGroupsForOrganizationalUnit(CmsObject, String, boolean)} instead
*/
public List getGroups() throws CmsException {
return OpenCms.getOrgUnitManager().getGroups(this, "", true);
}
/**
* Returns all the groups the given user, directly or indirectly, belongs to.<p>
*
* @param username the name of the user
*
* @return a list of <code>{@link CmsGroup}</code> objects
*
* @throws CmsException if operation was not successful
*
* @deprecated use {@link #getGroupsOfUser(String, boolean)} instead
*/
public List getGroupsOfUser(String username) throws CmsException {
return getGroupsOfUser(username, false);
}
/**
* Returns all the groups the given user belongs to.<p>
*
* @param username the name of the user
* @param directGroupsOnly if set only the direct assigned groups will be returned, if not also indirect roles
*
* @return a list of <code>{@link CmsGroup}</code> objects
*
* @throws CmsException if operation was not successful
*/
public List getGroupsOfUser(String username, boolean directGroupsOnly) throws CmsException {
return getGroupsOfUser(username, directGroupsOnly, true);
}
/**
* Returns all the groups the given user belongs to.<p>
*
* @param username the name of the user
* @param directGroupsOnly if set only the direct assigned groups will be returned, if not also indirect roles
* @param includeOtherOus if to include groups of other organizational units
*
* @return a list of <code>{@link CmsGroup}</code> objects
*
* @throws CmsException if operation was not successful
*/
public List getGroupsOfUser(String username, boolean directGroupsOnly, boolean includeOtherOus) throws CmsException {
return getGroupsOfUser(username, directGroupsOnly, includeOtherOus, m_context.getRemoteAddress());
}
/**
* Returns the groups of a user filtered by the specified IP address.<p>
*
* @param username the name of the user
* @param directGroupsOnly if set only the direct assigned groups will be returned, if not also indirect roles
* @param remoteAddress the IP address to filter the groups in the result list
* @param includeOtherOus if to include groups of other organizational units
*
* @return a list of <code>{@link CmsGroup}</code> objects filtered by the specified IP address
*
* @throws CmsException if operation was not successful
*/
public List getGroupsOfUser(String username, boolean directGroupsOnly, boolean includeOtherOus, String remoteAddress)
throws CmsException {
return m_securityManager.getGroupsOfUser(m_context, username, (includeOtherOus ? ""
: CmsOrganizationalUnit.getParentFqn(username)), includeOtherOus, false, directGroupsOnly, remoteAddress);
}
/**
* Returns the groups of a user filtered by the specified IP address.<p>
*
* @param username the name of the user
* @param remoteAddress the IP address to filter the groups in the result list
*
* @return a list of <code>{@link CmsGroup}</code> objects filtered by the specified IP address
*
* @throws CmsException if operation was not successful
*
* @deprecated use {@link #getGroupsOfUser(String, boolean, boolean, String)} instead
*/
public List getGroupsOfUser(String username, String remoteAddress) throws CmsException {
return getGroupsOfUser(username, false, false, remoteAddress);
}
/**
* Returns the edition lock state for a specified resource.<p>
*
* This can be of all types for them {@link CmsLockType#isSystem()} is <code>false</code>.<p>
*
* @param resource the resource to return the edition lock state for
*
* @return the edition lock state for the specified resource
*
* @throws CmsException if something goes wrong
*/
public CmsLock getLock(CmsResource resource) throws CmsException {
return m_securityManager.getLock(m_context, resource);
}
/**
* Returns the lock state for a specified resource name.<p>
*
* @param resourcename the name if the resource to get the lock state for (full current site relative path)
*
* @return the lock state for the specified resource
*
* @throws CmsException if something goes wrong
*/
public CmsLock getLock(String resourcename) throws CmsException {
CmsResource resource = readResource(resourcename, CmsResourceFilter.ALL);
return getLock(resource);
}
/**
* Returns all locked resources within a folder.<p>
*
* @param foldername the name of the folder
* @param filter the lock filter
*
* @return a list of locked resource paths (relative to current site)
*
* @throws CmsException if operation was not successful
*/
public List getLockedResources(String foldername, CmsLockFilter filter) throws CmsException {
CmsResource resource = readResource(foldername, CmsResourceFilter.ALL);
return m_securityManager.getLockedResources(m_context, resource, filter);
}
/**
* Returns the name a resource would have if it were moved to the
* "lost and found" folder. <p>
*
* 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.<p>
*
* @param resourcename the name of the resource to get the "lost and found" name for (full current site relative path)
*
* @return the tentative name of the resource inside the "lost and found" folder
*
* @throws CmsException if something goes wrong
*
* @see #moveToLostAndFound(String)
*/
public String getLostAndFoundName(String resourcename) throws CmsException {
CmsResource resource = readResource(resourcename, CmsResourceFilter.ALL);
return m_securityManager.moveToLostAndFound(m_context, resource, true);
}
/**
* Returns the parent group of a group.<p>
*
* @param groupname the name of the group
*
* @return group the parent group or <code>null</code>
*
* @throws CmsException if operation was not successful
*/
public CmsGroup getParent(String groupname) throws CmsException {
return m_securityManager.getParent(m_context, groupname);
}
/**
* 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());
}
/**
* Returns the set of permissions of a given user for a given resource.<p>
*
* @param resourceName the name of the resource
* @param userName the name of the user
*
* @return the current permissions on this resource
*
* @throws CmsException if something goes wrong
*/
public CmsPermissionSet getPermissions(String resourceName, String userName) throws CmsException {
// reading permissions is allowed even if the resource is marked as deleted
CmsResource resource = readResource(resourceName, CmsResourceFilter.ALL);
CmsUser user = readUser(userName);
return m_securityManager.getPermissions(m_context, resource, user);
}
/**
* Returns a publish list with all new/changed/deleted resources of the current (offline)
* project that actually get published.<p>
*
* @return a publish list
*
* @throws CmsException if something goes wrong
*
* @deprecated use <code>{@link OpenCms#getPublishManager()}.{@link org.opencms.publish.CmsPublishManager#getPublishList(CmsObject) getPublishList(CmsObject)}</code> instead
*/
public CmsPublishList getPublishList() throws CmsException {
return OpenCms.getPublishManager().getPublishList(this);
}
/**
* Returns a publish list with all new/changed/deleted resources of the current (offline)
* project that actually get published for a direct publish of a single resource.<p>
*
* @param directPublishResource the resource which will be directly published
* @param directPublishSiblings <code>true</code>, if all eventual siblings of the direct
* published resource should also get published.
*
* @return a publish list
*
* @throws CmsException if something goes wrong
*
* @deprecated use <code>{@link OpenCms#getPublishManager()}.{@link org.opencms.publish.CmsPublishManager#getPublishList(CmsObject, CmsResource, boolean) getPublishList(CmsObject, CmsResource, boolean)}</code> instead
*/
public CmsPublishList getPublishList(CmsResource directPublishResource, boolean directPublishSiblings)
throws CmsException {
return OpenCms.getPublishManager().getPublishList(this, directPublishResource, directPublishSiblings);
}
/**
* Returns a publish list with all new/changed/deleted resources of the current (offline)
* project that actually get published for a direct publish of a List of resources.<p>
*
* @param directPublishResources the resources which will be directly published
* @param directPublishSiblings <code>true</code>, if all eventual siblings of the direct
* published resources should also get published.
*
* @return a publish list
*
* @throws CmsException if something goes wrong
*
* @deprecated use <code>{@link OpenCms#getPublishManager()}.{@link org.opencms.publish.CmsPublishManager#getPublishList(CmsObject, List, boolean) getPublishList(CmsObject, List, boolean)}</code> instead
*/
public CmsPublishList getPublishList(List directPublishResources, boolean directPublishSiblings)
throws CmsException {
return OpenCms.getPublishManager().getPublishList(this, directPublishResources, directPublishSiblings, true);
}
/**
* Returns a publish list with all new/changed/deleted resources of the current (offline)
* project that actually get published for a direct publish of a List of resources.<p>
*
* @param directPublishResources the {@link CmsResource} objects which will be directly published
* @param directPublishSiblings <code>true</code>, if all eventual siblings of the direct
* published resources should also get published.
* @param publishSubResources indic
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?