Home
- Details
- read a text file with site names, where the user should be removed
- find sites by site names (names from step 1). if no site or more that one site was found, write an exception message in the log
- remove the user from each site if follow statements are true:
- the user is a site member
- the user is a SiteManager
- the user is not a member of a any group added to the site
- the user is not only one SiteManager in the site
var user = "andrej";
//this document is a text file, that contains site names
var nodeRef = "workspace://SpacesStore/b370f056-63d7-4431-8279-3f0870fe5f56";
var siteNames = readSiteNames(nodeRef);
for each(var siteName in siteNames) {
findSites(siteName);
}
/**
findSites by name and remove membership of the user.
**/
function findSites(siteName){
var sites = siteService.getSites(siteName,null,0);
if (sites.length > 1) {
logger.warn("WARN: " + "More than one site found by name:" + siteName);
for each(var site in sites) {
logger.warn("\t\t" + site.shortName + "\n");
}
} else if (sites.length < 1) {
logger.warn("WARN: " + "Site not found by name:" + siteName);
} else {
removeMembership(user,sites[0]);
}
}
/**
check:
1. if the user is a site member
2. if the user is a SiteManager
3. if the user is not a mamber of a any group added to the site
4. if the user is not ony one SiteManager in the site
**/
function removeMembership(authorityName,site) {
if(site){
logger.log(site.shortName);
if (site.isMember(authorityName)) {
if (site.getMembersRole(authorityName)=="SiteManager") {
if (!site.isMemberOfGroup(authorityName)) {
if (site.listMembers(null, "SiteManager", 0, true).length < 1) {
logger.warn("ERROR: no more SiteManager for site: \t\t" + site.shortName);
} else {
site.removeMembership(authorityName);
logger.log("membership deleted:" + site.shortName);
}
} else {
logger.warn("WARN: user is not a SiteManager for site: \t\t" + site.shortName);
}
} else {
logger.warn("ERROR: user is a member of the group for site: \t\t" + site.shortName);
}
} else {
logger.warn("WARN: user is not a member of the site: \t\t" + site.shortName);
}
}
logger.log("\n");
}
/**
read site names from a file.
**/
function readSiteNames(nodeRef) {
var csvStr = "";
var foundNode = search.findNode(nodeRef);
csvStr = csvStr + foundNode.content;
//logger.log(csvStr);
var ids = new Array();
var lines = csvStr.split("\n");
return lines;
}
- Details
var group = people.getGroup("GROUP_MYGROUP");
var nodes = people.getPeople("mypeople*");
logger.log("found:" + nodes.length);
logger.log("\n");
for each(var node in nodes)
{
user = utils.getNodeFromString(node);
people.addAuthority(group, user);
//people.removeAuthority(group, user);
logger.log(user.properties["cm:userName"]);
}
- Details
The solution for Alfresco 5.2 version is to add the configuration to the alfresco-global.properties:
activities.post.ignored-types=org.alfresco.documentlibrary.file-previewed,org.alfresco.documentlibrary.file-downloaded
More informations:
https://community.alfresco.com/thread/228224-how-to-hide-document-previewed-in-site-activities-dashlet-52e52d
- Details
revert added files
svn rm --keep-local .
. - path to the folder or file
--keep-local - remove files only from repository and keep it local ()
show file history
svn log -l 5 /path/to/file.txt
-l 5 - number of last versions to show
/path/to/file.txt - your file
compare two file versions
svn -r 1:2 diff /path/to/file.txt
-r 1:2 - version numbers (only numbers without r)
search file through repository with many not checked out projects
svn list -R http://svn.my_host/svn/my_repo_folders | grep my_file_name
- Details
Go to the page with services and klick "refresh"
for Repository
http://www.localhost:8080/alfresco/service/index
for Share
http://www.localhost:8080/share/service/index
Seite 2 von 10