public async Task <Response <LocalUsers> > ListAsync(string subscriptionId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default)
        {
            if (subscriptionId == null)
            {
                throw new ArgumentNullException(nameof(subscriptionId));
            }
            if (resourceGroupName == null)
            {
                throw new ArgumentNullException(nameof(resourceGroupName));
            }
            if (accountName == null)
            {
                throw new ArgumentNullException(nameof(accountName));
            }

            using var message = CreateListRequest(subscriptionId, resourceGroupName, accountName);
            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);

            switch (message.Response.Status)
            {
            case 200:
            {
                LocalUsers value = default;
                using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);

                value = LocalUsers.DeserializeLocalUsers(document.RootElement);
                return(Response.FromValue(value, message.Response));
            }
Ejemplo n.º 2
0
    public static bool TryLogin(string email, string password)
    {
        //Step one...
        //Find local user with those details
        try
        {
            UserFile user = LocalUsers.Single(x => x.Email == email && x.Password == password);

            //await Task.Delay(2000);

            CurrentUser = new UserAccount()
            {
                EmailAddress = user.Email,
                Password     = user.Password,
                Username     = user.Username
            };

            OnLoggedIn?.Invoke(CurrentUser);

            return(true);
        }
        catch (Exception ex)
        {
            Debug.LogException(ex);
            return(false);
        }
    }
        public void LocalUsers()
        {
            var payload = new LocalUsersPayload
            {
                GroupIds   = "9",
                GroupNames = "Administrators;Readers",
                UserId     = "123",
                UserName   = "******"
            };

            var obj = new LocalUsers(EventPriority.Operational, payload);

            obj.ValidateSchema();
        }
Ejemplo n.º 4
0
    static void UpdateLocalUsers()
    {
        LocalUsers.Clear();
        string[] allUserPaths = Directory.GetDirectories(UserFile.UserFolder);
        foreach (string path in allUserPaths)
        {
            byte[] arr = File.ReadAllBytes(path + "/user.userfile");
            var    u   = UserFile.Deserialise(arr);

            if (LocalUsers.SingleOrDefault(x => x.Username == u.Username) == null)
            {
                LocalUsers.Add(u);
            }
        }
    }