cancel
Showing results for 
Search instead for 
Did you mean: 

Tracking who accessed a document

unknown-user
Champ on-the-rise
Champ on-the-rise
Hi,

We are building a policy management system in Alfresco where in a user when logged into the site will see the pending policies that he needs to agree to. Once he agrees to a policy, it needs to be removed from his view.

We are thinking of a custom dashlet that would display the list of policies that a user needs to agree upon. Any policy document will have a custom action link to mark the user has agreed to that policy. But the challenge is how to track if a user has agreed to a Policy. We dont want to maintain this outside Alfresco (custom db like stuff). What are the options to save the list of users at a document level? Multi-valued property does not seem to be a right choice - the noSmiley Surprisedf users that would agree to a policy could be 0 to 5000+. Can we use Audit service?

Thanks
Jerry
4 REPLIES 4

afaust
Legendary Innovator
Legendary Innovator
Hello,

irregardless of what service you use, you somehow have to maintain the same amount of information: which user did already access which documents. It is the same wether you do this in Alfresco or outside of it.
Using auditing for this seems more a violation than using a multi-valued property with 5000+ values. Auditing is for activitiy / change / service invocation tracking, not for simple persistence. I only see user preferences or a node property as possible alternatives.

Using a node property on the document is problematic, since having a huge multi-value property will affect database load performance for the node (if it isn't already cached). But you can use such a property to simply query for all policies not yet viewed by the current user.

By using user preference, you track the policies a user has seen directly on the person node of that user. Preferences are not saved in the DB, but maintained as part of a JSON content string in a person content property. Unfortunately, this means that every time you add a node to the "read list", the full JSON content string will be re-written on disk and your contentstore (and later your contentstore.deleted) will fill with a large amount of small content files. And you can't just simply query unread policies with this method - you have to load the whole list of all policies and then filter through them.

Regards
Axel

unknown-user
Champ on-the-rise
Champ on-the-rise
Thanks Axel for the detailed reply.

It looks like both solutions (multi-valued property & Preferences) has its own cons. How about using an association between document node and the person object (as mentioned in this https://forums.alfresco.com/en/viewtopic.php?f=5&t=39494) ? It should also be possible to find out who all agreed to a particular policy for reporting purposes.

Thanks

afaust
Legendary Innovator
Legendary Innovator
Hello,

an association would be possible too, but only to store the information for later evaluation / reporting when you have the node at hand. If you need to do some querying (find the policies user X has not yet accepted), then you have to go either property (with a "NOT user=X" fragment) or user preference ("NOT ID IN (ID1, ID2, …)"). You could build the last type of query with associations too, but handling all the existing associations and nodes via NodeService is way more expensive than just parsing the preference JSON string.

A problem you face with associations (and preferences too): If the user / person object is deleted somehow (may just be a temporary error in LDAP synchronization), all the information about the policies that the user accepted is lost, while using a property it is kept (and still valid when the user / person is re-created with the same user name). This was a major issue in a system I once maintained, where the customer was quite unhappy about the additional effort they had to invest to re-create all the associations from-to user / person objects when about a hundred of them were deleted due to a faulty LDAP / AD (rollback was not an option, since a thousand other users were happily working along).

Regards
Axel

unknown-user
Champ on-the-rise
Champ on-the-rise
Thanks a lot Axel for the detailed response.

It looks like all of them has its own pros and cons and has some impact on the performance/maintenance. It would be worthwhile to re-consider our option of storing this in a custom db. Policy Document details and the user who agreed to a policy. This way, we get more flexibility and take the load off from Alfresco (NodeService, Prefereces etc).