3

Is it possible to enable activity streams for private datasets? I've been testing and activity streams are shown for public datasets only.

I checked the /usr/lib/ckan/default/src/ckan/ckan/lib/activity_streams.py file but I couldn't find any line that checks if dataset is public or private... I thought that maybe removing that condition (if exists) would fix my problem.

I'm using CKAN 2.3 (installed form package following these steps: LINK) with Ubuntu 12.04 64bit virtual machine on Azure.

Hope you can help me with this!

manuelmatas
  • 241
  • 1
  • 8
  • Why would you want to alert people to changes to datasets they can't access? – D Read Nov 13 '15 at 14:19
  • I'm using CKAN as a dataset manager for several projects with different teams. Hence, all datasets are always private so users can see only datasets of the organizations they have access to. This is why I need to show activity streams for private datasets, to inform users of each private organization about activities. – manuelmatas Nov 15 '15 at 00:09

2 Answers2

3

I solved the issue. D Read proposal was quite close to the working answer, but the lines to comment were wrong. Despite of this, I'll give D Read a +1 for helping finding the file.

Here is the working fix:

In the activity_streams_session_extension.py file located in /usr/lib/ckan/default/src/ckan/ckan/lib (assuming CKAN 2.3 installation from source), if you want CKAN to store activity streams even if dataset is private, just comment lines 131-132 as you can see here.

In this file, datasets are treated as "packages". So you just need to comment the condition for private packages from:

# Don't create activities for private datasets.
if package.private:
    continue

to

# Don't create activities for private datasets.
#if package.private:
#    continue

Then, reload Apache and Nginx and that's it!

manuelmatas
  • 241
  • 1
  • 8
  • It would be better if you one more condition to check current user privilege. My understanding is if you are sys admin, you should be able to view everything even if the package is private. – RandomEli Aug 23 '18 at 22:49
2

The code in question is activity_streams_session_extension.py. See:

https://github.com/ckan/ckan/blob/0f145a54629287a6f7764b8fd73963bda62260ef/ckan/lib/activity_streams_session_extension.py#L91-L93

D Read
  • 3,175
  • 1
  • 15
  • 25
  • Thanks for your reply! I commented lines 91-93 of the activity_streams_session_extension.py file and then restarted apache and nginx but it doesn't work. Activity streams for private datasets are still not showing... Any ideas? – manuelmatas Nov 02 '15 at 19:44
  • Have you created some more activity on that dataset? It won't generate a history for the time before you made the code change. – D Read Nov 03 '15 at 00:48
  • Yes I've been trying with new activities but when datasets are private nothing is shown. Also tryied creating a public dataset (it stores all activity streams) but when I change it to private, it stops storing activity streams. All this considering that lines 91-93 of the "activity_streams_session_extension.py" file are commented (file location: /usr/lib/ckan/default/src/ckan/ckan/lib ) – manuelmatas Nov 12 '15 at 14:17
  • I would think you need to comment 91-93 and 131-132 to cover all cases. But I haven't read the code very hard, and haven't tried it. – D Read Nov 13 '15 at 14:18