📄 cmsobject.java
字号:
* @return a list of all child <code>{@link CmsGroup}</code> objects or <code>null</code>
*
* @throws CmsException if operation was not successful
*/
public List getChild(String groupname) throws CmsException {
return (m_securityManager.getChild(m_context, groupname));
}
/**
* Returns all child groups of a group.<p>
*
* This method also returns all sub-child groups of the current group.<p>
*
* @param groupname the name of the group
*
* @return a list of all child <code>{@link CmsGroup}</code> objects or <code>null</code>
*
* @throws CmsException if operation was not successful
*/
public List getChilds(String groupname) throws CmsException {
return (m_securityManager.getChilds(m_context, groupname));
}
/**
* Returns the configuration read fromr the <code>opencms.properties</code> file.<p>
*
* @return the configuration read fromr the <code>opencms.properties</code> file
*/
public Map getConfigurations() {
return m_securityManager.getConfigurations();
}
/**
* Returns all groups to which a given user directly belongs.<p>
*
* @param username the name of the user to get all groups for
*
* @return a list of <code>{@link CmsGroup}</code> objects
*
* @throws CmsException if operation was not successful
*/
public List getDirectGroupsOfUser(String username) throws CmsException {
return (m_securityManager.getDirectGroupsOfUser(m_context, username));
}
/**
* 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 path of the resource to return the child resources for.
*
* @return a list of all child file <code>{@link CmsResource}</code>s
*
* @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.
*
* @return a list of all child file <code>{@link CmsResource}</code>s
* @param filter the resource filter to use
*
* @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
*/
public List getGroups() throws CmsException {
return (m_securityManager.getGroups(m_context));
}
/**
* 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 succesful
*/
public List getGroupsOfUser(String username) throws CmsException {
return m_securityManager.getGroupsOfUser(m_context, username);
}
/**
* 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 succesful
*/
public List getGroupsOfUser(String username, String remoteAddress) throws CmsException {
return m_securityManager.getGroupsOfUser(m_context, username, remoteAddress);
}
/**
* Returns the lock state for a specified resource.<p>
*
* @param resource the resource to return the lock state for
*
* @return the 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 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 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 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 {
return m_securityManager.moveToLostAndFound(m_context, resourcename, 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 bitset of the permissions of the current user
*
* @throws CmsException if something goes wrong
*/
public CmsPermissionSet getPermissions(String resourceName) throws CmsException {
// reading permissions is allowed even if the resource is marked as deleted
CmsResource resource = readResource(resourceName, CmsResourceFilter.ALL);
CmsUser user = m_context.currentUser();
return m_securityManager.getPermissions(m_context, resource, user);
}
/**
* 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 {
CmsAccessControlList acList = getAccessControlList(resourceName);
CmsUser user = readUser(userName);
return acList.getPermissions(user, getGroupsOfUser(userName));
}
/**
* 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
*/
public CmsPublishList getPublishList() throws CmsException {
return m_securityManager.fillPublishList(m_context, new CmsPublishList(m_context.currentProject()));
}
/**
* 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
*/
public CmsPublishList getPublishList(CmsResource directPublishResource, boolean directPublishSiblings)
throws CmsException {
return m_securityManager.fillPublishList(m_context, new CmsPublishList(
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
*/
public CmsPublishList getPublishList(List directPublishResources, boolean directPublishSiblings)
throws CmsException {
return getPublishList(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 resources 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 indicates if sub-resources in folders should be published (for direct publish only)
*
* @return a publish list
*
* @throws CmsException if something goes wrong
*/
public CmsPublishList getPublishList(
List directPublishResources,
boolean directPublishSiblings,
boolean publishSubResources) throws CmsException {
return m_securityManager.fillPublishList(m_context, new CmsPublishList(
directPublishResources,
directPublishSiblings,
publishSubResources));
}
/**
* Returns the current users request context.<p>
*
* This request context is used to authenticate the user for all
* OpenCms operations. It also contains the request runtime settings, e.g.
* about the current site this request was made on.<p>
*
* @return the current users request context
*/
public CmsRequestContext getRequestContext() {
return m_context;
}
/**
* Returns all resources associated to a given principal via an ACE with the given permissions.<p>
*
* If the <code>includeAttr</code> flag is set it returns also all resources associated to
* a given principal through some of following attributes.<p>
*
* <ul>
* <li>User Created</li>
* <li>User Last Modified</li>
* </ul><p>
*
* @param principalId the id of the principal
* @param permissions a set of permissions to match, can be <code>null</code> for all ACEs
* @param includeAttr a flag to include resources associated by attributes
*
* @return a list of <code>{@link CmsResource}</code> objects
*
* @throws CmsException if something goes wrong
*/
public List getResourcesForPrincipal(CmsUUID principalId, CmsPermissionSet permissions, boolean includeAttr)
throws CmsException {
return m_securityManager.getResourcesForPrincipal(getRequestContext(), principalId, permissions, includeAttr);
}
/**
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -