예제 #1
0
        /// <summary>
        /// Получить снимки данных активных пользователей
        /// </summary>
        public UserShot[] GetActiveUsers()
        {
            try
            {
                lock (userDataDict)
                {
                    UserShot[] userShotArr = new UserShot[userDataDict.Count];
                    int        i           = 0;

                    foreach (UserData userData in userDataDict.Values)
                    {
                        userShotArr[i] = new UserShot(userData);
                        i++;
                    }


                    Array.Sort(userShotArr, UserShotComp);
                    return(userShotArr);
                }
            }
            catch (Exception ex)
            {
                log.WriteException(ex, Localization.UseRussian ?
                                   "Ошибка при получении снимков данных активных пользователей" :
                                   "Error getting snapshots of the active users data");
                return(new UserData[0]);
            }
        }
예제 #2
0
 /// <summary>
 /// Проверить, что пользователь вошёл систему, и получить снимок его данных
 /// </summary>
 public bool CheckLoggedOn(out UserShot userShot, bool throwOnFail = true)
 {
     if (UserIsLoggedOn(WebOperationContext.Current, out userShot))
     {
         return(true);
     }
     else if (throwOnFail)
     {
         throw new ScadaException(WebPhrases.NotLoggedOn);
     }
     else
     {
         return(false);
     }
 }
예제 #3
0
        /// <summary>
        /// Проверить, что пользователь вошёл в систему, и получить его снимок
        /// </summary>
        public bool UserIsLoggedOn(WebOperationContext webOpContext, out UserShot userShot)
        {
            UserData userData;

            if (TryGetUserData(webOpContext, out userData) && userData.LoggedOn)
            {
                userShot = new UserShot(userData);
                return(userData.LoggedOn); // свойство могло измениться в другом потоке
            }
            else
            {
                userShot = null;
                return(false);
            }
        }
예제 #4
0
        /// <summary>
        /// Конструктор
        /// </summary>
        public UserShot(UserShot source)
        {
            IpAddress   = source.IpAddress;
            SessionID   = source.SessionID;
            LoggedOn    = source.LoggedOn;
            LogonDT     = source.LogonDT;
            UserProps   = source.UserProps;
            UserRights  = source.UserRights;
            UserMenu    = source.UserMenu;
            UserViews   = source.UserViews;
            UserContent = source.UserContent;

            WebSettings  = source.WebSettings;
            ViewSettings = source.ViewSettings;
            PluginSpecs  = source.PluginSpecs;
            UiObjSpecs   = source.UiObjSpecs;
        }