Esempio n. 1
0
        private void SetUser(UserProfile userProfile)
        {
            try
            {
                if (userProfile != null && UserProxy != null)
                {
                    UserProxy.SetUserProfile(userProfile, _localSharesList, _serverSharesList);
                }
                else
                {
                    UserProxy?.Clear();
                }

                IsUserSelected       = userProfile != null;
                IsSystemUserSelected = userProfile?.ProfileType == UserProfileType.ClientProfile;

                IsRestrictedToOwn = CheckRestrictedToOwn();

                ProfileTypeName = userProfile != null?LocalizationHelper.Translate("[UserConfig." + userProfile.ProfileType + "]") : string.Empty;

                SetSelectedShares();
                SetSelectedRestrictionGroups();
            }
            catch (Exception e)
            {
                ServiceRegistration.Get <ILogger>().Error("UserConfigModel: Error selecting user", e);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// this will turn the _users list into the _usersExposed list
        /// </summary>
        private async Task RefreshUserList()
        {
            // clear the exposed users list
            _loginUserList.Clear();
            _autoLoginUserList.Clear();

            IUserManagement userManagement = ServiceRegistration.Get <IUserManagement>();

            if (userManagement.UserProfileDataManagement == null)
            {
                return;
            }

            // Get our local client profile, it will be available for local login
            var localSystemGuid = Guid.Parse(ServiceRegistration.Get <ISettingsManager>().Load <SystemResolverSettings>().SystemId);

            UserProxy proxy;

            proxy = new UserProxy();
            proxy.SetLabel(Consts.KEY_NAME, LocalizationHelper.Translate(Consts.RES_DISABLE));
            proxy.SetUserProfile(new UserProfile(Guid.Empty, LocalizationHelper.Translate(Consts.RES_DISABLE)));
            proxy.Selected = UserSettingStorage.AutoLoginUser == Guid.Empty;
            proxy.SelectedProperty.Attach(OnAutoLoginUserSelectionChanged);
            _autoLoginUserList.Add(proxy);

            // add users to expose them
            var users = await userManagement.UserProfileDataManagement.GetProfilesAsync();

            foreach (UserProfile user in users)
            {
                var isCurrentClient = user.ProfileId == localSystemGuid;
                if (user.ProfileType != UserProfileType.ClientProfile || isCurrentClient)
                {
                    proxy = new UserProxy();
                    proxy.SetLabel(Consts.KEY_NAME, user.Name);
                    proxy.SetUserProfile(user);
                    if (UserSettingStorage.AutoLoginUser == user.ProfileId)
                    {
                        proxy.Selected = true;
                    }
                    proxy.SelectedProperty.Attach(OnAutoLoginUserSelectionChanged);
                    _autoLoginUserList.Add(proxy);
                    if (!isCurrentClient)
                    {
                        _loginUserList.Add(proxy);
                    }
                }
            }

            // tell the skin that something might have changed
            _loginUserList.FireChange();
            _autoLoginUserList.FireChange();
        }
Esempio n. 3
0
        private void SetUser(UserProfile userProfile)
        {
            try
            {
                if (userProfile != null && UserProxy != null)
                {
                    UserProxy.SetUserProfile(userProfile);
                }
                else
                {
                    UserProxy?.Clear();
                }

                IsUserSelected    = userProfile != null;
                IsRestrictedToOwn = CheckRestrictedToOwn();
            }
            catch (Exception e)
            {
                ServiceRegistration.Get <ILogger>().Error("UserLanguageModel: Error selecting user", e);
            }
        }