Disabling users to access NAV with specific client types

Today on forums was out this question: how to disable access to Microsoft Dynamics NAV Web Client for specific users?

Unfortunately there’s no a native function for disabling a user to access the NAV system with a specific client type (web, mobile, tablet and so on), but this can be easily handled with a customization.  My suggested way (valid also for Extensions) is to create an Event Subscriber to the OnBeforeCompanyOpen event in codeunit 1 (ApplicationManagement). Here you can check the Microsoft Dynamics NAV client type that is running in current session and determine if it’s a valid client type for the user.

Create a custom codeunit and here create a function CheckUserClientType with these properties:

NAVBlockUserClientType_01.jpg

The code for this function is as follows:

NAVBlockUserClientType_02.jpg

Obviously, you need a place to store the settings for each user regarding the Client types that he can’t access (this sample checks for web client because this was the question, but we can check for Tablet and all the other supported client types). Here, I’ve choose to use the User Setup table (I have a boolean field for disabling a certain type of client).

This is the unique way to do this using the actually available events. Another proposed solution was to use the LogInStart function in codeunit 40 (LogInManagement) but I’ve discovered that (if you want to use this function) an event is missing. Here, NAV expose only an OnAfterLogInStart event and we don’t have an OnBeforeLogInStart event available.

For this specific task, my recommendation is to use the suggested way. However, I think that an OnBeforeLogInStart event could be useful to have for certain scenarios (it costs nothing to add it). Its natural place could be here:

OnLoginStartEventRequest.jpg

A request to add it is placed.

P.S. Don’t to this with Dynamics 365 Business Central 😉

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s