Giter Club home page Giter Club logo

alfresco-shell-tools's Introduction

Alfresco offers a rich remote API using its WebScripts technology which is based on the REST paradigm. This projects provides a set of scripts that makes it more easy to interact with the repository and its exposed resources.

Create or change users, create sites, manage group membership form the command line instead of the user interface.

Also great for automation: Create some hundreds of users from a table and automatically add to a set of groups? This becomes a one liner with the Alfresco shell tools.

Use cases

Reported use cases have been:

  • Backup User-Group relationships
  • Provision demo systems
  • Keep avatar pictures in sync with a 3rth party source
  • pregenerate >100k thumbnail images
  • Initial import of users and groups, along with user-group and group-subgroup assignements
  • Create a bunch of tenants for a multi-tenancy enabled Alfresco
  • Do repetitive maintenance tasks for multiple tenants in one go

How to start?

  1. check out the scripts or download a release tarball
  2. install required 3-rd party tools for json handling http://kmkeen.com/jshon/
  3. set environment variables
  4. install web-scripts from alfresco
  5. have fun

Environment Variables

Required environment variables:

  • ALFTOOLS_USER=<username>
  • ALFTOOLS_PASSWORD=<password>
  • ALFTOOLS_ENDPOINT='http://<host>.<domain>:<port>/alfresco'

Optional environment variables:

  • ALF_VERVBOSE=<true|false>

Commands

Note: 'x' means working, ' ' untested with 5.1, 'X' requires alfresco administrator privileges, '-' not working.

The available commands are:

[X]alfAddAuthorityToGroup.sh
[x]alfCreateCalendarEntry.sh
[X]alfCreateGroup.sh
[X]alfCreateSite.sh
[x]alfCreateTenant.sh
[x]alfCreateUser.sh
[x]alfDeleteAuthorityFromGroup.sh
[x]alfDeleteGroup.sh
[x]alfDelete.sh
[X]alfDeleteSite.sh
[x]alfDeleteUser.sh
[x]alfGetCompanyHomeNodeRef.sh
[x]alfGet.sh
[x]alfGetPermissions.sh
[x]alfGetThumbnail.sh
[x]alfGetUserHomeFolder.sh
[x]alfGetUser.sh
[x]alfListGroupMembers.sh
[x]alfListGroups.sh
[x]alfListTenants.sh
[x]alfListUsers.sh
[x]alfMetadata.sh
[x]alfMkdir.sh
[x]alfNodeRef2Path.sh
[x]alfPath2NodeRef.sh
[x]alfRename.sh
[x]alfResetAvatar.sh
[x]alfSearch.sh
[x]alfSetAvatar.sh
[x]alfSetPermissions.sh
[x]alfUpdateUser.sh
[x]alfUpload.sh

Note: alfCreateSite.sh alfDeleteSite.sh alfInviteUser.sh are not tested with Alfresco 4.x (pre-CSRF protection)

Use -h to get a detailed description of each command.

Example:

$ alfSearch.sh -h
usage: ./bin/alfSearch.sh [global options] [command specific options] arguments
  global options:
    -h   help       shows this help screen
    -v   verbose    displays information while executing

    -E   endpoint   Alfresco endpoint
    -S   share endpoint Alfresco share endpoint
    -U   user       Alfresco user id used in authentication
    -P   password   password used for authenticaiton

    -C   curl opts  any additional options pass to curl

  command options:
    -p property name    which property of each search result node should be printed to stdout.
                        Possible values are nodeRef(default), name, path, type, displayName, title,
                        description, modifiedOn, modifiedBy, modifiedByUser, size, mimetype, path
    -m [property|json]  output mode: 'property' (default) prints the value of the property given by -p.
                        Mode 'json' prints the whole result set as a json object.

  command arguments:
    SEARCHTERM       an Alfresco search term

  command explanation:
    the alfSearch.sh command issues a search against the Alfresco repository and prints
    each the nodeRef of each hit.

  usage examples:

    ./alfSearch.sh 'this is fun'
       --> executes a full text search for 'this is fun'
    ./alfSearch.sh 'TYPE:myns:mydoctype' | wc -l
       --> prints the number of documents of type myns:mydoctype

  side note about the Alfresco search and the implications of the various implementations

    If Alfresco uses the LUCENE search backend, the result list will not be stable. This is due
    to internal performance optimizations done by Alfresco and depends on cache filling levels and
    system load. As a result the search will return more results on subsequence executions.

    If Alfresco is configured to use the SOLR search backend, the result list will be 'eventual consistent'
    This simple means, the Alfresco content is indexed by a background job in an asynchronous manner and
    and therefore will not contain all content at any point in time.
    However, the result list is stable, taking into account what is indexed so far.

  the alfresco shell tools are created by
    [email protected] - http://www.ecm4u.de - http://www.ecm-market.de
    anybody jumps in?

alfresco-shell-tools's People

Contributors

fsckawk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

alfresco-shell-tools's Issues

Alfresco cloud access

It should be possible to access the alfresco cloud offering through the shell 
tools.

Original issue reported on code.google.com by [email protected] on 9 Nov 2012 at 10:28

Test script

Some automated test tooling is required. However, there are is no unit-test 
framework for shell scripts etc.
I suppose there could be a directory called "tests.d" which contains a bunch of 
shell scripts. Each script there (a test script) is executed by a (to be 
created) test-executor script that will examine the exit code to see if the 
test was successful.

The test executor can also setup any test-fixtures required: environment vars, 
alfresco service start/stop, db and alf_data reset.

The test executor script should be integrated/working when called from jenkins.




Original issue reported on code.google.com by [email protected] on 11 Dec 2012 at 7:35

alfCreateSite.sh not working on Alf One 4.2

Trying to create sites via a script (note: the script used to work with 
previous versions of Alfresco One). 

Tested using:
    alfCreateSite.sh -s sitea -d 'My test Site' AutoSite

Error returned:
    curl: (6) Could not resolve host: Path=

Other commands tested and working:
    alfSetAvatar.sh
    alfCreateGroup.sh
    alfAddAuthorityToGroup.sh



Original issue reported on code.google.com by [email protected] on 29 Nov 2013 at 8:40

Debian/Ubuntu package

Install the Alfresco shell tools from an ubuntu (.deb) package. This will make 
it easier to install, test and update the tools.

As there is now a jshon as a deb. package available, all dependencies could be 
resolved.

Original issue reported on code.google.com by [email protected] on 11 Dec 2012 at 8:22

Tools to list and add calendar entries

I've created two shell scripts to list all calendar entries and to add one. 
It's in the ericmspveith-alfresco-shell-tools repo. Could you please pull?

TIA!

Original issue reported on code.google.com by [email protected] on 13 Mar 2014 at 1:11

Port to Alfresco 5.0d

In Alfresco 5.0d, some of the web scripts that the shell tools use are changed or removed. To make all functionality of the shell tools usable in Alfresco 5.0d, web scripts that work as in 4.2 versions of Alfresco must be added.

Create Site not working

What steps will reproduce the problem?

1. New install of Alfresco Enterprise 4.2.2
2. alfCreateSite.sh mysite

What is the expected output? What do you see instead?

Expect to see a new site created. Get an error "Could not resolve host: Path=" 
instead. 

What version of the product are you using? On what operating system?

New build of the shell tools (from yesterday 01-07-2014)
Using a new install of Alfresco Enterprise 4.2.2

Please provide any additional information below.

The commands - alfSetAvatar.sh, alfCreateGroup.sh, alfAddAuthorityToGroup.sh, 
alfAddAuthorityToGroup.sh all work

Added Verbose mode:

Environment
=================

TERM_PROGRAM=Apple_Terminal
SHELL=/bin/bash
TERM=xterm-256color
TMPDIR=/var/folders/fn/vzlzbq910d93zwvp4m3zy2y80000gp/T/
Apple_PubSub_Socket_Render=/tmp/launch-cXTrJm/Render
TERM_PROGRAM_VERSION=326
ALFTOOLS_SHARE_ENDPOINT=http://localhost:8080/share
ALFTOOLS_ENDPOINT=http://localhost:8080/alfresco
OLDPWD=/AlfrescoCode/DemoBuild/BuildServer/Avatars
TERM_SESSION_ID=8E23A480-E53B-40B2-A8FD-6784F26CE2D9
USER=phampton
SSH_AUTH_SOCK=/tmp/launch-xxfn0v/Listeners
__CF_USER_TEXT_ENCODING=0x1F6:0:0
PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/Shared/alfresco-shell-t
ools/bin:/Users/Shared/my-tools/bin
__CHECKFIX1436934=1
PWD=/AlfrescoCode/DemoBuild/BuildServer
LANG=en_GB.UTF-8
PS1=$ 
SHLVL=1
HOME=/Users/phampton
ALFTOOLS_PASSWORD=xxxxxx
LOGNAME=phampton
ALFTOOLS_USER=admin
_=/usr/bin/env

Error Log
=================

connection params:
  user: admin
  endpoint: http://localhost:8080/alfresco
  curl opts: -s -S -k -f -v
  site title: mysite
  site desc:  
  site visibility: PUBLIC
  site preset: site-dashboard
  site short name: 
* Adding handle: conn: 0x7fdf0a004000
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x7fdf0a004000) send_pipe: 1, recv_pipe: 0
* Could not resolve host: Path=
* Closing connection 0
curl: (6) Could not resolve host: Path=
* Adding handle: conn: 0x7fdf0a004000
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 1 (0x7fdf0a004000) send_pipe: 1, recv_pipe: 0
* About to connect() to localhost port 8080 (#1)
*   Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 8080 (#1)
> POST /share/service/modules/create-site HTTP/1.1
> User-Agent: curl/7.30.0
> Host: localhost:8080
> Accept: */*
> Cookie: JSESSIONID=6FFAB54BE393666A6A7F02EA8539753F;
> Content-Type: application/json
> Content-Length: 118
> 
* upload completely sent off: 118 out of 118 bytes
< HTTP/1.1 200 OK
* Server Apache-Coyote/1.1 is not blacklisted
< Server: Apache-Coyote/1.1
< Set-Cookie: 
Alfresco-CSRFToken=nRGW3D59ROGVzaSJi8MWd%2feGCQ9olKb4609Nx1VKrhg%3d; 
Expires=Wed, 09-Jul-2014 10:29:42 GMT; Path=/share
< X-Frame-Options: SAMEORIGIN
< X-XSS-Protection: 1; mode=block
< X-Content-Type-Options: nosniff
< Content-Language: en-US
< Content-Length: 0
< Date: Wed, 02 Jul 2014 10:29:42 GMT
< 
* Connection #1 to host localhost left intact

Original issue reported on code.google.com by [email protected] on 2 Jul 2014 at 11:24

Project License Information

Should probably have a license file and license header in each file.

(I'm a stickler for that sort of thing.)

Original issue reported on code.google.com by [email protected] on 7 Dec 2012 at 8:29

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.