Can we put time restrictions on apps - SOTI SNAP

Solved

We are currently trying to restrict access to one of our apps we created on SOTI Snap.  We have an app that we need our users to access only between the hours of 0500am and 1200pm. 

Does anyone know if or how we can do this?

Thanks for any help in advance

a year ago
SOTI MobiControl
ANSWERS
DK
Deepak Kumar
a year ago

Hello Maisie,

Unfortunately, SNAP does not offer this functionality by default.

Here's what I attempted as a workaround:

Step 1: Create a Dummy Homepage (this will serve as your initial page).

Step 2: Use the 'Run JavaScript' action in the page load event of this page, and insert the following script:

function restrictedFunction() {
    // Get the current date and time
    var currentDate = new Date();
    var currentHour = currentDate.getHours();

    // Define the allowed time range (e.g., 5 AM to 12 PM)
    var startTime = 5; // 5 AM
    var endTime = 12;  // 12 PM

    // Check if the current hour is within the allowed range
    if (currentHour >= startTime && currentHour < endTime) {
        // Execute the function if within the allowed time range
        Snap.navigation.navigateTo('Page1');
        // Add your function code here
    } else {
        // Display a message or take action if the function is called outside the allowed time range
        alert('You are not allowed to access this app');
        // You can add code here for handling the restriction (e.g., display an alert)
    }
}

// Call the restricted function
restrictedFunction();



Step 3: Replace "Page 1" in the script above with the actual Homepage where users should be redirected if they are permitted to use the application. Otherwise, display an alert message.

You can also customize the duration in the script based on your specific requirements.

Here is the link to video steps

https://soti.sharepoint.com/:v:/g/Product%20Management/EfVhJHC8L1FFuo-9fnmSlxEBm2PB3H4E2sA8Kw51uQUQZA

Solution
MD
Maisie Dell
a year ago

Thank you so much Deepak!

I will try this as a solution.

Is there a way to schedule the access times based on the enrolment group of the user?  Is this something I can write in to the Java Script?

DK
Deepak Kumar
a year ago

Hello Maisie,

Could you provide an example of your use case?

Based on my current understanding, it seems like you are looking for:

For instance, Enrollment Group 1 should be granted access to app A between 9 AM and 5 PM.

Enrollment Group 2 should be granted access to app B from 4 PM to 8 PM.

S
SMMOD@SOTI
a year ago

Hi Maisie,

After going through the discussion that has happened with Deepak cloud you please specify the use case or provide us with an example of the same for better understanding so that we can assist you accordingly.

Hi Maisie Dell,

Thanks for posting on SOTI Pulse, Thanks Deepak Kumar for responding to the post, your expertise and willingness to help are greatly appreciated!

Have you had an opportunity to test the suggested solutions by Deepak Kumar, and has it successfully addressed your query?

If Yes please mark the post as the solution.

If not, or If you have any additional questions or concerns, please don't hesitate to reach out. We're dedicated to providing assistance and support.