Configuring the Alfresco 5 Activity Stream

cancel
Showing results for 
Search instead for 
Did you mean: 

Configuring the Alfresco 5 Activity Stream

kevinr1
Established Member
1 11 8,559

Introduction



In Alfresco 5 we have added two new types of events to the activity stream - for document Download and Preview events. Some concerns have been raised about the number of activities that may be added to the site or user streams and also concerns around privacy - seeing what documents other users have been downloading or previewing.



Firstly, the ability of the server to process activities has been improved considerably since Alfresco 4. The activity processing is now multi-threaded and also handles more activities per stream.



Secondly, the same ACL/permission enforcement that has always been present in Alfresco is still present in 5.0 - that has not changed! So the ability to see a public document is still the same for all users and if a document is private, it will remain private. For example if you add/modify/download a document that is private to you then activity events for the action will not appear on the public activity stream for other users in the site.

Configuration



The activities which are processed by the system can be configured in the Alfresco repository. A config file change is needed to disable certain activities from the various summary processing options. For example if you are still concerned about the Download and Preview activities and want to disable them, then this is how you would do it.

RSS Summary Feeds



To disable them from the RSS summary feeds used by the Document Library components we need to override the bean that deals with processing that list.



In the Alfresco repository tomcat instance, in the tomcat/shared/classes/alfresco/extension folder create a spring context XML file called custom-web-context.xml. If you already have this extension file, then add the bean shown below to the existing file.



The beans that process activities for RSS feeds work against a list of known activity types - the types that are generated by applications such as Alfresco Share. To remove the Download and Preview activities we identify the IDs of those activities which are org.alfresco.documentlibrary.file-previewed and org.alfresco.documentlibrary.file-downloaded and remove them from the list for the documentLibraryActivitySummaryProcessor bean definition.

<?xml version='1.0' encoding='UTF-8'?>

<beans xmlns='http://www.springframework.org/schema/beans'

xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'

xsi:schemaLocation='http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd'>

<bean id='documentLibraryActivitySummaryProcessor' class='org.alfresco.rest.api.impl.activities.BaseActivitySummaryProcessor'>

<property name='registry' ref='activitySummaryParser' />

<property name='eventTypes'>

<list>

<value>org.alfresco.documentlibrary.files-added</value>

<value>org.alfresco.documentlibrary.files-updated</value>

<value>org.alfresco.documentlibrary.files-deleted</value>

<value>org.alfresco.documentlibrary.file-added</value>

<value>org.alfresco.documentlibrary.file-created</value>

<value>org.alfresco.documentlibrary.file-deleted</value>

<value>org.alfresco.documentlibrary.file-liked</value>

<value>org.alfresco.documentlibrary.inline-edit</value>

<value>org.alfresco.documentlibrary.folder-liked</value>

<value>org.alfresco.documentlibrary.folder-added</value>

<value>org.alfresco.documentlibrary.folder-deleted</value>

<value>org.alfresco.documentlibrary.folders-added</value>

<value>org.alfresco.documentlibrary.folders-deleted</value>

</list>

</property>

</bean>

</beans>



Restart Alfresco then no more Download and Preview activities in RSS feeds. You can modify the bean config above to remove any other activity types you don't like from the list.

Removing from Activity Email Summary



Of course the Activity Email Summary is generated by something completely different and uses different configuration - anything else just wouldn't be Alfresco. To deal with that, we need to override the bean that handles the generation of the list of Activities for Email templates.



Fortunately that is not too hard either. Create the following folder path tomcat/shared/classes/alfresco/extension/subsystems/ActivitiesFeed/default/default and create a file called custom-activities-feed-context.xml. This specifically overrides configuration for the ActivitiesFeed sub-system. A sub-system in Alfresco is a powerful and highly configurable component that can be enabled/disabled and tweaked at run-time - however because of this flexibility comes some complexity with the configuration - which is why we have the strange looking folder path - see this wiki page for more info.



The file should contain the following bean override:

<?xml version='1.0' encoding='UTF-8'?>

<beans xmlns='http://www.springframework.org/schema/beans'

xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'

xsi:schemaLocation='http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd'>

<bean id='feedModelBuilderPrototype' class='org.alfresco.repo.activities.feed.DefaultActivitiesFeedModelBuilder' scope='prototype'>

<property name='ignoredActivityTypes'>

<set>

<value>org.alfresco.documentlibrary.file-previewed</value>

<value>org.alfresco.documentlibrary.file-downloaded</value>

</set>

</property>

</bean>

</beans>


Again you can see the activity types specified in a list to be ignored during Activity processing.

Removing from Alfresco Share



To remove the activities from those made available to Alfresco Share dashlets add the following extension config files to your Alfresco Share Tomcat instance (which will be the same Tomcat instance if you are using a default installed package).



tomcat/shared/classes/alfresco/web-extension/site-webscripts/org/alfresco/components/dashlets/site-activities.get.config.xml



and



tomcat/shared/classes/alfresco/web-extension/site-webscripts/org/alfresco/components/dashlets/my-activities.get.config.xml



Both files are identical, so create and edit them to contain:

<config>

<filter-range>

<filter type='today' label='today' />

<filter type='7' label='7days' />

<filter type='14' label='14days' />

<filter type='28' label='28days' />

</filter-range>

<filter-type>

<filter type='mine' label='mine' />

<filter type='others' label='others' />

<filter type='all' label='all' />

<filter type='following' label='following' />

</filter-type>

<filter-activities>

<filter type='org.alfresco.profile.status-changed,org.alfresco.comments.comment-created,org.alfresco.comments.comment-updated,org.alfresco.documentlibrary.file-updated,org.alfresco.documentlibrary.file-added,org.alfresco.documentlibrary.files-added,org.alfresco.documentlibrary.files-deleted,org.alfresco.documentlibrary.files-updated,org.alfresco.documentlibrary.file-deleted,org.alfresco.documentlibrary.inline-edit,org.alfresco.wiki.page-created,org.alfresco.wiki.page-edited,org.alfresco.wiki.page-renamed,org.alfresco.wiki.page-deleted,org.alfresco.blog.post-created,org.alfresco.blog.post-updated,org.alfresco.blog.post-deleted,org.alfresco.site.user-joined,org.alfresco.site.user-left,org.alfresco.site.user-role-changed' label='allItems' />

<filter type='org.alfresco.profile.status-changed' label='statusItems' />

<filter type='org.alfresco.comments.comment-created,org.alfresco.comments.comment-updated' label='commentItems' />

<filter type='org.alfresco.documentlibrary.file-updated,org.alfresco.documentlibrary.file-added,org.alfresco.documentlibrary.files-added,org.alfresco.documentlibrary.files-deleted,org.alfresco.documentlibrary.files-updated,org.alfresco.documentlibrary.file-deleted,org.alfresco.documentlibrary.inline-edit,org.alfresco.wiki.page-created,org.alfresco.wiki.page-edited,org.alfresco.wiki.page-renamed,org.alfresco.wiki.page-deleted,org.alfresco.blog.post-created,org.alfresco.blog.post-updated,org.alfresco.blog.post-deleted' label='contentItems' />

<filter type='org.alfresco.site.user-joined,org.alfresco.site.user-left,org.alfresco.site.user-role-changed' label='membershipItems' />

</filter-activities>

</config>


The important bit is we are removing the same file-previewed and file-downloaded activities mentioned above from the filter-activities configuration.



This may also be a good time to review the above configuration - as it allows you to configure what filters are shown in the Activities summary dashlets, across what date ranges and what other Activities they will show. For instance if you don't want to see 'status' updates from users, then you could completely remove the org.alfresco.profile.status-changed references and filter section.
11 Comments
blog_commenter
Active Member
I tried to follow these instructions to disable notifications für previews and downloads in 5.0.b. It worked in the dashlets, but the activity feed mails still contain those events. I also tried to place a patched activities-feed-context.xml into webapps/alfresco/WEB-INF/classes/alfresco/subsystems/ActivitiesFeed/default, but it also had no effect. What did I do wrong ... ?
blog_commenter
Active Member
Hi, I tried to turn off the share activity stream for download and preview envents, but it is necessary for each site and user to click on the filter (change dashlet filter settings), to the settings take effect. The same must be done for each newly created site.



Alfresco 5.0b.

I really need to disable recording these events globally, thank you in advance for more info.



Martin
kevinr1
Established Member
Some code changes were required to finalize the removal from email threads. The code is in the nightly build now (which is stable currently) and will be in 5.0.c due in a few weeks.
kevinr1
Established Member
Thanks for raising that, I will take a look.
blog_commenter
Active Member
i was following this tutorial cause some one recommend me to see it. but i is there any way to add a custom activities. here what i see is how we can delete but is there any resource to add?
blog_commenter
Active Member
hello Kevin



how about adding my own custom Activity type
blog_commenter
Active Member
Hello,



I have the same problem as Martin. Did You find some workaround or solution for the problem?
blog_commenter
Active Member
Does it work for Alfresco 5.0.c ?



Thanks in advance.



--C.
blog_commenter
Active Member
Hi Kevin:



I found the same problem exposed by Martin in 5.0.c and 5.0.d. In users activity and sites activity. Even in newly created sites Smiley Sad



@Kevin any idea ? @Martin, could you solve this problem ?



Thanks in advance.



--C.
blog_commenter
Active Member
Hi,

Nice post, it was good explained! But I have the Alfresco Version 5.0.1 Enterprise Edition, did all the steps (repo and share projects), in order to blind out the  file-previewed and file-downloaded activities in the activities dashlet and there isn't any effect (firstly I tried to in an amp file, after I tried in the shared folder).

It keeps showing all the activities. Now I don't have any idea how I can blind out these activities.

Thanks!
kevinr1
Established Member
Unfortunately it does appear there is an issue with removing the activities - the configuration only becomes active correctly if a user changes switches the menu option back and forth in the dashlet.



This is now fixed in the next Enterprise release 5.0.2 and also next Community release will have the fix. I apologise that the current solution is not adequate. We have based the new solution on the neat and tidy suggestion from Peter Löfgren: https://github.com/loftuxab/alfresco-community-loftux/commits/loftux See https://issues.alfresco.com/jira/browse/ACE-3980