Package org.alfresco.repo.site.script
Class ScriptSiteService
java.lang.Object
org.alfresco.repo.processor.BaseProcessorExtension
org.alfresco.repo.jscript.BaseScopableProcessorExtension
org.alfresco.repo.site.script.ScriptSiteService
- All Implemented Interfaces:
org.alfresco.processor.ProcessorExtension,Scopeable
Script object representing the site service.
- Author:
- Roy Wetherall
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcleanSitePermissions(ScriptNode targetNode) This method cleans up the permissions on the specified node and all its primary children.voidcleanSitePermissions(NodeRef targetNode) It removes permissions which pertain to sites other than the node's current site.createSite(String sitePreset, String shortName, String title, String description, boolean isPublic) Deprecated.createSite(String sitePreset, String shortName, String title, String description, String visibility) Create a new site.createSite(String sitePreset, String shortName, String title, String description, String visibility, String siteType) Create a new site.Site[]Find (search) the sites available in the repository.Site[]Find (search) the sites available in the repository.Get a site for a provided site short name.getSiteInfo(String shortName) Get a site for a provided site short name.Site[]Retrieves the sites available in the repository.booleanThis method checks if the currently authenticated user has permission to create sites.booleanSite existence check.booleanisSiteManager(String siteId) Determines if the current user is a manager of the given site.String[]Returns an array of all the roles that can be assigned to a member of a site.String[]listSiteRoles(String shortName) Returns an array of all the roles that can be assigned to a member of a specific site.Site[]List the sites available in the repository.Site[]List the sites available in the repository.Site[]listUserSites(String userName) List all the sites that the specified user has an explicit membership to.Site[]listUserSites(String userName, int size) List all the sites that the specified user has an explicit membership to.protected Site[]makeSitesArray(List<SiteInfo> siteInfos) Converts the given List of SiteInfo objects to a JavaScript friendly array of Site objects.voidsetServiceRegistry(ServiceRegistry serviceRegistry) Sets the Service RegistryvoidsetSiteService(SiteService siteService) Set the site serviceMethods inherited from class org.alfresco.repo.jscript.BaseScopableProcessorExtension
getScope, setScopeMethods inherited from class org.alfresco.repo.processor.BaseProcessorExtension
getExtensionName, register, setExtensionName, setProcessor
-
Field Details
-
PUBLIC_SITE
Visibility helper constants- See Also:
-
MODERATED_SITE
- See Also:
-
PRIVATE_SITE
- See Also:
-
-
Constructor Details
-
ScriptSiteService
public ScriptSiteService()
-
-
Method Details
-
setServiceRegistry
Sets the Service Registry- Parameters:
serviceRegistry- ServiceRegistry
-
setSiteService
Set the site service- Parameters:
siteService- the site service
-
createSite
public Site createSite(String sitePreset, String shortName, String title, String description, boolean isPublic) Deprecated.as of version 3.2, replaced bycreateSite(String, String, String, String, String)- Parameters:
sitePreset- site presetshortName- site short nametitle- site titledescription- site descriptionisPublic- whether the site is public or not- Returns:
- Site the created site
- See Also:
-
createSite
public Site createSite(String sitePreset, String shortName, String title, String description, String visibility) Create a new site.The site short name will be used to uniquely identify the site so it must be unique.
- Parameters:
sitePreset- site presetshortName- site short nametitle- site titledescription- site descriptionvisibility- visibility of the site (public|moderated|private)- Returns:
- Site the created site
-
createSite
public Site createSite(String sitePreset, String shortName, String title, String description, String visibility, String siteType) Create a new site.The site short name will be used to uniquely identify the site so it must be unique.
- Parameters:
sitePreset- site presetshortName- site short nametitle- site titledescription- site descriptionvisibility- visibility of the site (public|moderated|private)siteType- qname of site type to create- Returns:
- Site the created site
-
hasSite
Site existence check. Allows private site existence to be tested.- Parameters:
shortName- site short name- Returns:
- true if the site exists, false otherwise.
-
hasCreateSitePermissions
public boolean hasCreateSitePermissions()This method checks if the currently authenticated user has permission to create sites.- Returns:
trueif the current user is a Contributor to "Sites" node, elsefalse.- Since:
- 3.4
-
isSiteManager
Determines if the current user is a manager of the given site.- Parameters:
siteId- The short name of the site to check- Returns:
- true if the current user is a manager of the given site
-
getSites
Retrieves the sites available in the repository. The returned list can optionally be filtered by name and site preset. If no filters are specified then all the available sites are returned. NOTE: If the filter starts with a * a Lucene based search will be performed, this may discover a wider range of results i.e. those sites that contain the search term as opposed to those that start with the search term, but newly created sites may not be found until the underlying search indexes are updated.- Parameters:
filter- inclusion filter for returned sites. Only sites whose cm:name OR cm:title OR cm:description start with the filter string will be returned.sitePresetFilter- site preset filtersize- max results size crop if >0- Returns:
- Site[] a list of the site filtered as appropriate
-
listSites
List the sites available in the repository. The returned list can optionally be filtered by name and site preset.If no filters are specified then all the available sites are returned.
- Parameters:
filter- inclusion filter for returned sites. Only sites whose cm:name OR cm:title OR cm:description start with the filter string will be returned.sitePresetFilter- site preset filter- Returns:
- Site[] a list of the site filtered as appropriate
- See Also:
-
listSites
List the sites available in the repository. The returned list can optionally be filtered by name and site preset. If no filters are specified then all the available sites are returned.- Parameters:
filter- inclusion filter for returned sites. Only sites whose cm:name OR cm:title OR cm:description start with the filter string will be returned.sitePresetFilter- site preset filtersize- max results size crop if >0- Returns:
- Site[] a list of the site filtered as appropriate
- See Also:
-
findSites
Find (search) the sites available in the repository. The returned list can optionally be filtered by name and site preset. If no filters are specified then all the available sites are returned.- Parameters:
filter- inclusion filter for returned sites. Only sites whose cm:name OR cm:title OR cm:description CONTAIN the filter string will be returned.sitePresetFilter- site preset filtersize- max results size crop if >0- Returns:
- Site[] a list of the site filtered as appropriate
- Since:
- 4.0
- See Also:
-
findSites
Find (search) the sites available in the repository. The returned list can optionally be filtered by name- Parameters:
filter- inclusion filter for returned sites. Only sites whose cm:name OR cm:title OR cm:description CONTAIN the filter string will be returned.size- max results size crop if >0- Returns:
- Site[] a list of the site filtered as appropriate
- Since:
- 5.0
- See Also:
-
makeSitesArray
Converts the given List of SiteInfo objects to a JavaScript friendly array of Site objects.- Returns:
- Array of Site objects
-
listUserSites
List all the sites that the specified user has an explicit membership to.- Parameters:
userName- user namesize- maximum list size- Returns:
- Site[] a list of sites the user has an explicit membership to
-
listUserSites
List all the sites that the specified user has an explicit membership to.- Parameters:
userName- user name- Returns:
- Site[] a list of sites the user has an explicit membership to
-
getSite
Get a site for a provided site short name.Returns null if the site does not exist.
- Parameters:
shortName- short name of the site- Returns:
- Site the site, null if does not exist
-
getSiteInfo
Get a site for a provided site short name. If the current user does not have permission to view the site content, the info will still be returned, but none of the operations that would modify site information on save() will work. As usual ACLs will apply on any attempt to modify the Site object.Returns null if the site does not exist.
- Parameters:
shortName- short name of the site- Returns:
- Site the site, null if does not exist
-
listSiteRoles
Returns an array of all the roles that can be assigned to a member of a site.- Returns:
- String[] roles available to assign to a member of a site
-
cleanSitePermissions
It removes permissions which pertain to sites other than the node's current site.- Parameters:
targetNode- the root node which is to have its permissions cleaned.- See Also:
-
cleanSitePermissions
This method cleans up the permissions on the specified node and all its primary children. It removes permissions which pertain to sites other than the node's current site.- Since:
- 3.4.2
- See Also:
-
listSiteRoles
Returns an array of all the roles that can be assigned to a member of a specific site.- Returns:
- String[] roles available to assign to a member of a site
-
createSite(String, String, String, String, String)