Opc.Ua.UserRoleManager.HasAccess C# (CSharp) Method

HasAccess() public method

Returns true if the current Windows user has access to the the specified template.
public HasAccess ( string template ) : bool
template string
return bool
        public bool HasAccess(string template)
        {
            string filePath = Utils.GetAbsoluteFilePath(m_directory.FullName + template + m_FileExtension, false, false, false);

            // nothing more to do if no file.
            if (filePath == null)
            {
                return false;
            }

            // check if account has access to semaphore file.
            try
            {
                using (Stream ostrm = File.OpenRead(filePath))
                {
                    ostrm.Dispose();
                }

                // access granted.
                return true;
            }
            catch (Exception)
            {
                // no access or no file.
            }

            return false;
        }