public WindowsAuthSettingsSectionModel()
		{
			SectionName = "Windows Authentication";
			Document = new Observable<WindowsAuthDocument>();
			RequiredUsers = new ObservableCollection<WindowsAuthData>();
			RequiredGroups = new ObservableCollection<WindowsAuthData>();
			SelectedList = new ObservableCollection<WindowsAuthData>();
			DatabaseSuggestionProvider = new DatabaseSuggestionProvider();
			WindowsAuthName = new WindowsAuthName();

			ApplicationModel.DatabaseCommands.ForSystemDatabase()
				.GetAsync("Raven/Authorization/WindowsSettings")
				.ContinueOnSuccessInTheUIThread(doc =>
				{
					if (doc == null)
					{
						Document.Value = new WindowsAuthDocument();
						return;
					}
					Document.Value = doc.DataAsJson.JsonDeserialization<WindowsAuthDocument>();
					RequiredUsers = new ObservableCollection<WindowsAuthData>(Document.Value.RequiredUsers);
					RequiredGroups = new ObservableCollection<WindowsAuthData>(Document.Value.RequiredGroups);
					SelectedList = RequiredUsers;
					
					OnPropertyChanged(() => Document);
					OnPropertyChanged(() => RequiredUsers);
					OnPropertyChanged(() => RequiredGroups);
				});
		}
Exemple #2
0
        public WindowsAuthSettingsSectionModel()
        {
            SectionName                = "Windows Authentication";
            Document                   = new Observable <WindowsAuthDocument>();
            RequiredUsers              = new ObservableCollection <WindowsAuthData>();
            RequiredGroups             = new ObservableCollection <WindowsAuthData>();
            SelectedList               = new ObservableCollection <WindowsAuthData>();
            DatabaseSuggestionProvider = new DatabaseSuggestionProvider();
            WindowsAuthName            = new WindowsAuthName();

            ApplicationModel.DatabaseCommands.ForDefaultDatabase()
            .GetAsync("Raven/Authorization/WindowsSettings")
            .ContinueOnSuccessInTheUIThread(doc =>
            {
                if (doc == null)
                {
                    Document.Value = new WindowsAuthDocument();
                    return;
                }
                Document.Value = doc.DataAsJson.JsonDeserialization <WindowsAuthDocument>();
                RequiredUsers  = new ObservableCollection <WindowsAuthData>(Document.Value.RequiredUsers);
                RequiredGroups = new ObservableCollection <WindowsAuthData>(Document.Value.RequiredGroups);
                SelectedList   = RequiredUsers;

                OnPropertyChanged(() => Document);
                OnPropertyChanged(() => RequiredUsers);
                OnPropertyChanged(() => RequiredGroups);
            });
        }