Checking Active Directory groups
A common practice is to assign security through Active Directory groups. NAV supports this out-of-the-box, but does not give a way to manually check those groups from code. For that you will need to implement a .NET class.
Getting ready
The codeunit from the Checking for user-assigned roles recipe should be created.
How to do it...
Create the following class in Visual Studio. You will need to add a reference to
System.DirectoryServices
.using System; using System.Collections; using System.DirectoryServices; using System.DirectoryServices.ActiveDirectory; using System.Runtime.InteropServices; using System.Security.Principal; namespace NAV_ActiveDirectory { [ProgId("NAV_ActiveDirectory")] [ComVisible(true)] [ClassInterface(ClassInterfaceType.AutoDual)] public class NAV_ActiveDirectory { private ArrayList properties; private string userdn; private int propertiesIndex; public NAV_ActiveDirectory() { properties = new ArrayList(); propertiesIndex = 0; } public void...