Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Retrieving user login time in SDL Tridion 2011

Tags:

tridion

I need to write a script that generates a report of users that have not logged into Tridion for 1 year. I know we can retrieve the modified dates and the users of all the files, but how would we track the login date of users who don't make any modifications, i.e. only read-only access?

like image 481
Wilson Kwan Avatar asked Sep 19 '12 22:09

Wilson Kwan


2 Answers

Look at the IIS logs for the Tridion 2011 application. In there you should see requests for all the pages in Tridion by various users. Some of the entries will look like this:

2012-09-20 00:48:53 ::1 GET /WebUI/Editors/CME/Views/TridionDashboard/TridionDashboard.aspx - 81 TRIDION\Administrator ::1 Mozilla/5.0+(Windows+NT+6.1;+WOW64)+AppleWebKit/537.1+(KHTML,+like+Gecko)+Chrome/21.0.1180.89+Safari/537.1 200 0 0 48

From the item above you can see that the TridionDashboard page, i.e. the first page you get after logging in, was accessed by the TRIDION\Administrator user (yes, my Tridion VM is called "TRIDION" and I logon to it using the Administrator account).

So, what you need to do is make sure that the logs don't get overwritten once they fill up and get archived to a location where you can grab them and parse them.

The only info you require is the user name. Simply throw it into some kind of a HashSet data structure (that stores only unique keys) such that key is username and value is the timestamp. I bet you can do all the parsing with a couple lines of code using Powershell (or if you use Cygwin a one liner using the grep command will also do the trick).

The logs are typically in %SystemDrive%\inetpub\logs\LogFiles, but check your system to ensure that location hasn't been modified.

like image 134
Nickoli Roussakov Avatar answered Sep 25 '22 23:09

Nickoli Roussakov


I have never written Something like this, the only way I can think of achieving this is to create a GUI extension which adds AppData indicating login time to the User Object whenever they open the CME.

I don't believe there is an event triggered when the login occurs, otherwise I would suggest creating an even system.

You might consider reading this article by Nuno (http://www.tridiondeveloper.com/inheriting-metadata-on-organizational-items), it describes executing an action which is triggered by a user opening an item. My guess is that it would be triggered even when the user only has readonly access (but you would need to check this). If it is triggered on all read actions, you could update the user AppData whenever a user opens any IdentifiableObject in the CME. This would tell you when the user last viewed any item in the CME.

Hope that helps

Chris

like image 20
Chris Summers Avatar answered Sep 22 '22 23:09

Chris Summers