Skip to content

Commit

Permalink
Fixed user
Browse files Browse the repository at this point in the history
  • Loading branch information
davidnmbond committed May 21, 2024
1 parent 70f7036 commit 14bf085
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 7 deletions.
File renamed without changes.
4 changes: 3 additions & 1 deletion LogicMonitor.Api.Test/Settings/UserTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ public async Task GetUsers()

foreach (var user in users.Items)
{
var refetchedUser = await LogicMonitorClient.GetAsync<User>(user.Id, default).ConfigureAwait(true);
var refetchedUser = await LogicMonitorClient
.GetAsync<User>(user.Id, default)
.ConfigureAwait(true);
var roles = refetchedUser.Roles;
roles.Should().NotBeNullOrEmpty();
user.UserGroupIds.Should().NotBeNullOrEmpty();
Expand Down
4 changes: 1 addition & 3 deletions LogicMonitor.Api.sln
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
.editorconfig = .editorconfig
.gitignore = .gitignore
Doxyfile = Doxyfile
en-GB_User.dic = en-GB_User.dic
en_GB.aff = en_GB.aff
en_GB.dic = en_GB.dic
Dictionary.dic = Dictionary.dic
global.json = global.json
LICENSE = LICENSE
README.md = README.md
Expand Down
6 changes: 6 additions & 0 deletions LogicMonitor.Api/Settings/ApiToken.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ public class ApiToken : IdentifiedItem, IHasEndpoint
[DataMember(Name = "createdBy")]
public string? CreatedBy { get; set; }

/// <summary>
/// The last IP address for this user
/// </summary>
[DataMember(Name = "lastAuthIp")]
public string? LastAuthenticatedIp { get; set; }

/// <summary>
/// The epoch at which the API Tokens were created
/// </summary>
Expand Down
6 changes: 3 additions & 3 deletions LogicMonitor.Api/Users/User.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ namespace LogicMonitor.Api.Users;
/// User logged event
/// </summary>
[DataContract]
public class User : IdentifiedItem, IHasEndpoint
public class User : IdentifiedItem, IHasEndpoint, IPatchable
{
/// <summary>
/// Whether this user is for API use only
/// </summary>
[DataMember(Name = "apionly")]
public bool IsApinly { get; set; }
public bool IsApiOnly { get; set; }

/// <summary>
/// The roles assigned to this user
Expand Down Expand Up @@ -82,7 +82,7 @@ public class User : IdentifiedItem, IHasEndpoint
/// The status ("active" for users who can log in)
/// </summary>
[DataMember(Name = "status")]
public string Status { get; set; } = string.Empty;
public UserStatus Status { get; set; }

/// <summary>
/// The status ("active" for users who can log in)
Expand Down
19 changes: 19 additions & 0 deletions LogicMonitor.Api/Users/UserStatus.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
namespace LogicMonitor.Api.Users;

/// <summary>
/// The users status
/// </summary>
public enum UserStatus
{
/// <summary>
/// Active
/// </summary>
[EnumMember(Value = "active")]
Active,

/// <summary>
/// Inactive
/// </summary>
[EnumMember(Value = "suspended")]
Suspended
}

0 comments on commit 14bf085

Please sign in to comment.