finish tables api

This commit is contained in:
2023-10-03 11:44:53 +02:00
parent 7ad077d0cf
commit ba069d56fd
8 changed files with 62 additions and 11 deletions

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using Pilz.Networking.CloudProviders.Nextcloud.Client;
@@ -62,6 +63,11 @@ namespace Pilz.Networking.CloudProviders.Nextcloud
}
public UserInfo? Login(NextcloudLogin login)
{
return Login(login, true);
}
public UserInfo? Login(NextcloudLogin login, bool checkUser)
{
// Ensure we are logged out
Logout(false);
@@ -69,15 +75,20 @@ namespace Pilz.Networking.CloudProviders.Nextcloud
// Temporary set user login
CurrentLogin = login;
// Try get user info & check if user is enabled
var userInfo = Cloud.GetUserInfo();
var isValid = userInfo != null && userInfo.Enabled;
if (checkUser)
{
// Try get user info & check if user is enabled
var userInfo = Cloud.GetUserInfo();
var isValid = userInfo != null && userInfo.Enabled;
// If invalid, reset login credentials
if (!isValid)
CurrentLogin = null;
// If invalid, reset login credentials
if (!isValid)
CurrentLogin = null;
return userInfo;
return userInfo;
}
return null;
}
public NextcloudLogin? Login(string baseUrl, CancellationToken cancellationToken)