The Department of Social Services is a government department that is responsible for developing and implementing social policies. They deal with a lot of highly sensitive information so want to do everything they can to minimize the chances of private information being mishandled.
They already use PaperCut MF to track what is being copied and printed, which is great for monitoring after the fact, but they also want to limit their staff’s access to devices outside of standard business hours (8 a.m. - 6 p.m. weekdays).
Solution description
Using device scripting, the Department of Social Services will:
-
prevent users from logging in to a device between the hours of 6 p.m. and 8 a.m. on week days and all weekend
-
send an email to the IT manager if someone tries to access a device after hours.
Implementation
The best way to create a device script is to either start with a recipe or build your script using snippets. This example demonstrates how to create a script using snippets. All you need to do is specify your variable values.
To create this script, you will:
For more information about creating device scripts, see:
- Device scripting overview
- Creating device scripts
- Device script API reference
- Tips for device scripting
- Troubleshooting device scripts
Add the Device login hook stub
Every script needs to start with a “hook”. This hook defines the event that triggers the script to run. To prevent access to a device, the event is a user’s attempt to log in, so use deviceLoginHook
. For more information about the available hooks, see
Device script API reference
.
-
Click the Devices tab.
The External Device List page is displayed. -
Select a test device.
The Device Details page is displayed. -
Click the Scripting tab.
-
Select the Enable device script checkbox.
By default, the
deviceLoginHook
is included in the script editor. -
Edit the script description so it captures what this script does.
Add the Deny login access snippet
The Deny login access snippet allows you to specify the:
-
hours/days that access to the device will be blocked
-
user groups whose access will be blocked.
For more information about snippets, see Using snippets .
-
Select the line below the function ( // your script here).
-
Click Insert Snippet at Cursor.
-
Under Actions, select Deny login access.
-
Click insert.
In this example, the Department of Social Services wants to block access to all users between 6 p.m. and 8 a.m. on weeknights, and all Saturday and Sunday.
-
Add variables to specify the device access block period. For more information about JavaScript methods, see JavaScript Functions Definitions . Specifically, you will add a variable to specify the:
-
time of the day before which device access will be blocked (
var BEFORE_HOURS
) -
time of the day after which device access will be blocked (
var AFTER_HOURS
) -
days on which device access will be blocked (
var SATURDAY
andvar SUNDAY
)
-
-
Add a variable to get the current day
date.getDay()
. The snippet includes variables to get the date (new Date()
) and timedate.getHours()
methods, but not the daydate.getDay()
method. -
Update the default
if
statement to remove the user group specification and check whether or not a user is accessing the device outside of work hours.if (inputs.user.isInGroup("Students") && (hours < 8 || hours >= 18)) { actions.login.denyLoginAccess(); }
Add the Send an email to one or many recipients snippet
The ‘Send an email to one or many recipients’ snippet sends a notification to one or more recipients when the action specified in the script occurs. In this case, the action is that device access has been denied.
-
Select the line below the function ( // your script here).
-
Click Insert Snippet at Cursor.
-
Under Actions, select Send an email to one or many recipients.
-
Click insert.
-
Add your organization specific email details.
-
Click Apply.
Test your script and go live
Before you copy your script to production devices, make sure you check that it works in on a test device.
-
Check the following on a test device:
-
Try to log in between 6 p.m. and 8 a.m. on a weeknight.
-
Try to log in on a weekend.
-
Check that the appropriate email recipient received an email for each attempt.
-
Log in between 8 a.m. and 6 p.m. to make sure users can log in when they are allowed.
-
-
Copy your device script to the required devices.
Comments