Posts Tagged 'script'

Instantiate Space Template on creation of Alfresco Site

Alfresco ShareWe could already create custom Share Site definitions (dashboard definitions actually), but in the past one could not determine by the Site object what ‘type’ of Site was initiated. I filed an enhancement request (May 2010), and recently I noted that it has been implemented (already for a while probably, 3.3 or 3.4). Now this property exists (st:sitePreset) we can use it to instantiate a RUP folder structure for a RUP site, and a Prince2 folder structure for a Prince2 site, and so forth. This blog describes my findings and solutions to instantiate a Space Template into the documentLibrary of a Share Site. Continue reading ‘Instantiate Space Template on creation of Alfresco Site’

(How) Is your Alfresco repository being used?

In a recent post I just discovered this “Alfresco generate reports with JasperReports” project. It seemed to fit my needs for reporting against Alfresco and Share, and I was very happy and exited. However… It appeared to be too complex to use.

I try to be as little indispensible as possible. If someone from ‘the business’ is in need of reporting, I try to give access to a tool that suits his/her needs. If they need to create or modify a report, they should not be dependent of me, or anyone else capable of doing Alfresco Magic. Being build op Open Standards and proven technologies does not mean everybody is capable of doing everything with it

My view on reporting is:

  1. ‘The business’ should be able to create/maintain reports.
  2. The reporting environment should support Aspects. If one adds a type with some additional properties, the reporting environment should be able to deal with it, without manual reconfiguring.

Continue reading ‘(How) Is your Alfresco repository being used?’

Know the usage of your Alfresco repository

it happens now and then an organization puts a DMS in place, and starts working. Usually they don’t have a clear view on how their system is used. I work for just such an organization; lets start working and formalize afterwards. Therefore I got this idea to create a reporting add-on. The main idea is to use an existing easy-to-use reporting tool to configure the reports, based on Alfresco data. the resulting reports should be stored in Alfresco. There is of course the Birt extension in the Alfresco Forge, but lets face it, I cannot give Eclipse to the report-maintaining guys.

Yesterday night I found this “Alfresco generate reports with JasperReports” project on Google Code (with a pointer in the Alfresco Forge). This does exactly what I initially had in mind. One can create XML feeds in Alfresco. Use the XML feed, combined with  a JasperReports report definition, and store the output in Alfresco again. And all this using Alfresco server-side scripting, which means you can easily schedule the reports to be generated at night, and that you can include logic like sequentially execute all reports existing in a given Space. (Think of adding a report-definition aspect to the JasperReport definition  object in Alfresco containing the name/link to the xml data feed…) All I have to do is come up with a clever set of XML feeds to source the reports! I am working on this idea to frequently update my XML feed (stored as a document in Alfresco). Continue reading ‘Know the usage of your Alfresco repository’

Executing named scripts as System in Alfresco

Sometimes you are assigned to a running project, and wonder why some design decisions have been made. I am facing rule-triggered scripts trying to change permissions on a folder structure, that travels the repository (folder based routing alike). And in this project there is (of course) no time/budget to decently solve this. This results in a system where no one should change any permission because it results in a failing system. (The folder structure has nodes with -very- limited permissions for most users, therefore coordinators cannot modify them). These scripts need to run as System of course. There are quite a bunch of these, and a simple, quick solution has my preference (it’s my own time right?).

This blog describes how I tweaked the class responsible for executing scripts in Alfresco. A set of scripts can be named that will be executed as System user, therefore eliminating my issues with permissions. All other scripts will be run as before, having the context of the user invoking them. It is a follow up on my ‘Sudo for Scripts in Alfresco‘ post, originated from the discussion with Fabio Strozzi. Continue reading ‘Executing named scripts as System in Alfresco’

Sudo for Scripts in Alfresco

sudoToday I ran into the pitfall of Alfresco scripts and permissions again. For all kind of reasons I cannot rewrite code, but run into trouble because a user having a particular role executes a script that modifies permissions. This of course fails if this user has less permissions on a given space or document than expected. The user/group will have more permissions (that make no sense) than needed, and only a little tiny change in the security settings can screw-up the transaction the script is part of. The best approach is of course to get rid of the script approach at all (related to permissions), and implement a decent class running as System. But I cannot.

I remember having seen the sudoUtils in the past, and the improved version after that, created by Fabio Strozzi. This is nice, but not exactly matching my use case/requirements. I have no clue who executes this function. An unknown, in time growing set of groups can execute, but only if it is defined in a particular script. The script limits the access, not the user or group. It would make sense to allow execution of a particular named script (or better, a set of predefined scripts). My idea is that I can define a set of scripts that can be executed as System user. However, to make sure we meet security, these named scripts (in alfresco-global.properties) need to be loaded from classpath, not from repository.

Lets face it, if someone has access to the file system, anything is possible… Continue reading ‘Sudo for Scripts in Alfresco’