Skip to content

Commit

Permalink
fix(connectors): allowing registration of connectors with pending sta…
Browse files Browse the repository at this point in the history
…tus technical users (#924)

Refs: #843 
Reviewed-By: Phil Schneider <info@philschneider.de>
  • Loading branch information
AnuragNagpure authored Aug 13, 2024
1 parent 11b473d commit 058fda7
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ public Task<bool> CheckActiveServiceAccountExistsForCompanyAsync(Guid technicalU
portalDbContext.CompanyServiceAccounts
.Where(sa =>
sa.Id == technicalUserId &&
sa.Identity!.UserStatusId == UserStatusId.ACTIVE &&
(sa.Identity!.UserStatusId == UserStatusId.ACTIVE || sa.Identity!.UserStatusId == UserStatusId.PENDING) &&
sa.Identity.CompanyId == companyId)
.AnyAsync();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,14 @@
"company_service_account_kind_id": 2,
"offer_subscription_id": "ed4de48d-fd4b-4384-a72f-ecae3c6cc5ba",
"client_client_id": "sa-os-external"
},
{
"id": "4ce1b774-3d00-4e07-9a53-ae1f64193394",
"name": "sa-pending-0",
"description": "pending service account",
"company_service_account_type_id": 2,
"company_service_account_kind_id": 1,
"offer_subscription_id": null,
"client_client_id": "sa-x-4"
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -185,5 +185,14 @@
"user_entity_id": null,
"identity_type_id": 2,
"last_editor_id":"8b42e6de-7b59-4217-a63c-198e83d93777"
},
{
"id": "4ce1b774-3d00-4e07-9a53-ae1f64193394",
"date_created": "2024-08-08 18:01:33.439000 +00:00",
"company_id": "2dc4249f-b5ca-4d42-bef1-7a7a950a4f87",
"user_status_id": 4,
"user_entity_id": null,
"identity_type_id": 2,
"last_editor_id":"8b42e6de-7b59-4217-a63c-198e83d93777"
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,32 @@ public async Task CheckActiveServiceAccountExistsForCompanyAsync_ReturnsExpected
result.Should().BeTrue();
}

[Fact]
public async Task CheckActiveServiceAccountExistsForCompanyAsyncForPendingStatus_ReturnsExpectedResult()
{
// Arrange
var (sut, _) = await CreateSut();

// Act
var result = await sut.CheckActiveServiceAccountExistsForCompanyAsync(new Guid("4ce1b774-3d00-4e07-9a53-ae1f64193394"), new Guid("2dc4249f-b5ca-4d42-bef1-7a7a950a4f87"));

// Assert
result.Should().BeTrue();
}

[Fact]
public async Task CheckActiveServiceAccountExistsForCompanyAsyncForInactiveStatus_ReturnsExpectedResult()
{
// Arrange
var (sut, _) = await CreateSut();

// Act
var result = await sut.CheckActiveServiceAccountExistsForCompanyAsync(new Guid("38c92162-6328-40ce-80f3-22e3f3e9b94d"), new Guid("2dc4249f-b5ca-4d42-bef1-7a7a950a4f87"));

// Assert
result.Should().BeFalse();
}

#endregion

#region CreateDimCompanyServiceAccount
Expand Down

0 comments on commit 058fda7

Please sign in to comment.