Beispiel #1
0
        /// <summary>
        /// See if user authorized & logon as current user if so
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="domainName"></param>
        /// <returns></returns>

        public static bool Logon(
            string userName,
            string domainName,
            string clientName)
        {
            UserInfo ui;

            if (!IsAuthorized(userName, domainName, out ui))
            {
                return(false);                                                         // authorized for logon?
            }
            UserInfo = ui;

            ClientState.ClientName          = clientName;
            ClientState.MobiusClientVersion = Lex.ExtractVersion(clientName);

            DebugLog.UserName = userName.ToUpper();             // set username so it appears in log messages
            string msg = "User logged on: " + ui.FirstName + " " + ui.LastName + " (" + domainName + @"\" + userName + ")" +
                         ", CanRetrieveStructures: " + ui.Privileges.CanRetrieveStructures +
                         ", CanRetrieveSequences: " + ui.Privileges.CanRetrieveSequences +
                         ", Process: " + Process.GetCurrentProcess().Id +
                         ", Client: " + clientName;

            // + ", ClientVersion: " + ClientState.MobiusClientVersion.ToString();
            DebugLog.Message(msg);

            return(true);
        }