1. read a text file with site names, where the user should be removed
  2. 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
  3. 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 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 {


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.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 {
                      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);


read site names from a file.

function readSiteNames(nodeRef) {
    var csvStr = "";
    var foundNode = search.findNode(nodeRef);
  csvStr = csvStr + foundNode.content;
  var ids = new Array();
  var lines = csvStr.split("\n");
    return lines;

Create a directory and sub directories

mkdir -p one/two/three/four

Get the size of a directory

du -sh file_path

  -s, --summarize
         display only a total for each argument

  -h, --human-readable
         print sizes in human readable format (e.g., 1K 234M 2G)

  -c, --total
         produce a grand total

Show last lines from a log file

tail -n 1000 /var/log/mail.log | more
  -n 100 = last 100 lines
  more = to be able to view file line by line

Download a file

wget <http://domane.to.file.zip> -P </path/to/folder>

Lock remote access for root user

vi /etc/ssh/sshd_config
change: "PermitRootLogin yes" -> "PermitRootLogin no"
/etc/init.d/ssh reload

Show all users (ubuntu)

cat /etc/passwd | cut -d":" -f1
(etc/shadow - users file)

Lock user for login

passwd <username> -l

unlock user for login

passwd <username> -u

Grant executing rights to the current user

chmod +x (datei)

Change folder or file owner

chown <newowner> -R /path/

-R recursive

Unpack tar-archive

tar xf [ARCHIV].tar
- x unpack
- f File

Create tar-archive

tar -cvzf /path/[ARCHIV].tgz /path/to/folde

Create a file

touch <filename>

Add user to the sudoers file

open Sudoers file (/etc/sudoers) and add:

# User privilege specification
<username>    ALL=(ALL:ALL) ALL

Install rpm file

sudo rpm -i <filename>.rpm

Delete file or folder

rm -rf <ordername>

delete all files in current folder

rm -rf *

-r - recursive
-f - force (delete without warnings)

show current directory


show which sub-folders spend how much disk space

du -h --max-depth=1 </folder> | sort -hr

-h, --human-readable           print sizes in human readable format

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

Go to the page with services and klick "refresh"

for Repository


for Share



1. add user Task in yout bpmn-xml-file:

<userTask id="myTask" name="My Task" activiti:formKey="myappwf:myTask">
                <activiti:taskListener event="create" delegateExpression="${CreateMyTaskListener}" />

2. add CreateMyTaskListener bean to the workflow-context.xml file

<bean id="createMyTaskListener"

<bean id="createMyTaskListener.activitiBeanRegistry"
        <property name="targetObject">
            <ref bean="activitiBeanRegistry" />
        <property name="targetMethod" value="put" />
        <property name="arguments">
                <ref bean="createMyTaskListener" />

3. Create a Java class

import org.alfresco.repo.workflow.activiti.tasklistener.TaskCreateListener;

public class CreateMyTaskListener extends TaskCreateListener {

    public void notify(DelegateTask delegateTask) {