Wednesday, June 25, 2014

Alfresco JS webscripts - no comments before

Errors like:
Caused by: org.mozilla.javascript.EvaluatorException: syntax error (file:/opt/alfresco/tomcat-share/webapps/share/WEB-INF/classes/alfresco/web-extension/site-webscripts/dk/redpill-linpro/alfresco/share/header/share-header.get.js#5)
    at org.mozilla.javascript.DefaultErrorReporter.runtimeError(

Can be caused by comments in js-controller file before <import> statements, EX:
-------------generating error--------
<import resource="classpath:/alfresco/web-extension/site-webscripts/dk/redpill-linpro/alfresco/share/imports/share-header.lib.js">
-------------no error --------
<import resource="classpath:/alfresco/web-extension/site-webscripts/dk/redpill-linpro/alfresco/share/imports/share-header.lib.js">

Silly but true

Monday, June 16, 2014

... renaming users

Trying to find out how to get the activities feed and activities dashlets working for AD sync'ed mixed-case usernames ... I found some help in the property:

Setting it to true works for activity feeds, if you set it form the beginning, but not if on a running system ...

After playing with the, i found AD sync'ed some users were 'moved'. EX: from userName 'LULA' to 'LULA80cb1574-7b9b-4cfb-b82f-f0c72a5ea346'. All authoritive containers were changed.

This happened because Alfresco was set with the properties:

I changed it back, but damage was done! 

And when the user with AD-username in uppercase, EX: 'LULA', alfresco wanted to reuse it for the new username (in a different case) and renamed it.

The user was not deleted because of property:


 Using AE i decided to try and recover the users changed (only ones that tryed logging in). I found out the users with changed usernames still had the correct zones (synchronization subsystem).

Lets try to rename the user. First observation was javascript console cannot change the userName (permission denied), probably need to be system user, so I found the rename User tool.

- stop Alfresco

- comment out vti module contexts: 

tomcat/webapps/alfresco/WEB-INF/classes/alfresco/module/org.alfresco.module.vti/module-context.xml file:

<!-- <import resource="classpath:alfresco/module/org.alfresco.module.vti/context/*-context.xml"/> -->

- go into 'tomcat/webapps/alfresco/WEB-INF'

- run RenameTool:
java -XX:MaxPermSize=512m -classpath ../../../lib/*:../../../endorsed/*:lib/*:classes:classes/alfresco/module:classes/alfresco/module/org.alfresco.module.vti:../../../shared/classes -user admin -pwd admin LULA80cb1574-7b9b-4cfb-b82f-f0c72a5ea346 LULA -verbose

- Reenable VTI

- start Alfresco

- Change in Javascript console (installed?) cm_owner on user:
var person = people.getPerson("LULA");"LULA";;

- site membership should be restored :)

- Now find out which AD groups was removed :(

Friday, June 13, 2014

No customize dashboard after applying custom presets

In Alfresco Share 4.2.x menu has changed and some of this is implemented share-header.get.js and share-header.lib.js.

 When making a custom preset for a site 'type', normally you would give it a custom title and titleId. This causes the customize Dashboard option to disappear, there fore you need to modify line 1531 (form 4.2.2) to include your custom dashboard title id:

 // If on the dashboard then add the customize dashboard option...
 if (page.titleId == "page.siteDashboard.title" || page.titleId == "page.meeting_workspace.title")