Sunday, October 26, 2008

User Sessions Table

From Dwayne Wright - Certified FileMaker 9 Developer
WEB: www.dwaynewright.com
EMAIL: info@dwaynewright.com
TWITTER: dwaynewright

A User Sessions Table is used to log when a user opens a database file or closes a database file. This is usually accomplished with the help of scripts that activate on open or close of a database. When the scripts activate, they navigate to a layout that allows for a creation of a new record and attach the necessary information.

This is what I wrote when I added the term User Sessions Table into the FileMaker Term Of The Day blog. I then realized that I really wanted to go the extra mile, add this to my InBizness 2.7 release and write a more robust article for the FileMaker Security Explored Blog. So here goes ...

When I decided to implement a User Sessions Table, I already had some of the necessary code in place. I had a staff table that is tied to my user accounts and privilege set information. The staff file is used to add user accounts to the system and I setup the roles field in staff to correspond to the privilege set information that FileMaker uses. Also, I had setup a global variable to capture a variety of information on startup. The name of the global variable is $$session and the included calculation is ....

"LANGUAGE:" & cfTab & Get ( ApplicationLanguage ) &
"¶APP VERSION:" & cfTab & Get ( ApplicationVersion ) &
"¶LAST LOG IN:" & cfTab & Get ( CurrentTimeStamp ) &
"¶DESKTOP PATH:" & cfTab & Get ( DesktopPath ) &
"¶DOCUMENTS PATH:" & cfTab & Get ( DocumentsPath ) &
"¶EXTENDED PRIV:" & cfTab & Get ( ExtendedPrivileges ) &
"¶PRINTER:" & cfTab & Get ( PrinterName ) &
"¶PRIV SET:" & cfTab & Get ( PrivilegeSetName ) &
"¶SCREEN DEPTH:" & cfTab & Get ( ScreenDepth ) &
"¶SCREEN WIDTH:" & cfTab & Get ( ScreenWidth ) &
"¶SCREEN HEIGHT:" & cfTab & Get ( ScreenHeight ) &
"¶SYSTEM DRIVE:" & cfTab & Get ( SystemDrive ) &
"¶SYSTEM IP:" & cfTab & Get ( SystemIPAddress ) &
"¶SYSTEM LANGUAGE:" & cfTab & Get ( SystemLanguage ) &
"¶SYSTEM NIC:" & cfTab & Get ( SystemNICAddress ) &
"¶SYSTEM PLATFROM:" & cfTab & Get ( SystemPlatform ) &
"¶SYSTEM VERSION:" & cfTab & Get ( SystemVersion ) &
"¶USER NAME:" & cfTab & Get ( UserName ) &
"¶DATABASE NAMES:" & cfTab & DatabaseNames

FYI ... cfTab is a custom function to put the appropriate number of tab characters between the label for the captured data and the data itself. So the next step was to create the Users Session Table itself and my version has the following fields ...


Next up was to add some logic to my startup and shutdown scripts to record those activities to my user sessions table.


Finally, in version 2.7 of InBizness, I’m incorporating role base dashboards as an alternative to the main screen. One of these dashboards is for the companies information technology staff members. Showing startup and shutdown sessions is a natural place to show this information. So here is a peek at what I have setup.

Here you can see one of the tabs in the information tech dashboard. This tab allows me to see the log in and log out information of users within the system. You can click this picture to expand your viewing of the image.
=
More info about the author and FileMaker in general, contact me at info@dwaynewright.com.

© 2008 - Dwayne Wright - dwaynewright.com

The material on this document is offered AS IS. There is NO REPRESENTATION OR WARRANTY, expressed or implied, nor does any other contributor to this document. WARRANTIES OF MERCHANT ABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY DISCLAIMED. Consequential and incidental damages are expressly excluded. FileMaker Pro is the registered trademark of FileMaker Inc.

No comments: