Skip to content

Commit

Permalink
fix review findings
Browse files Browse the repository at this point in the history
  • Loading branch information
ntruchsess committed Oct 8, 2024
1 parent 420b5da commit 9e87170
Show file tree
Hide file tree
Showing 19 changed files with 897 additions and 372 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ public void RemoveAppInstance(Guid appInstanceId) =>
/// <inheritdoc />
public void CreateAppInstanceAssignedServiceAccounts(
IEnumerable<(Guid AppInstanceId, Guid CompanyServiceAccountId)> instanceAccounts) =>
_portalDbContext.AppInstanceAssignedServiceAccounts.AddRange(instanceAccounts
.Select(x => new AppInstanceAssignedCompanyServiceAccount(
_portalDbContext.AppInstanceAssignedTechnicalUsers.AddRange(instanceAccounts
.Select(x => new AppInstanceAssignedTechnicalUser(
x.AppInstanceId,
x.CompanyServiceAccountId)));

Expand All @@ -59,7 +59,7 @@ public Task<bool> CheckInstanceExistsForOffer(Guid offerId) =>

/// <inheritdoc />
public IAsyncEnumerable<Guid> GetAssignedServiceAccounts(Guid appInstanceId) =>
_portalDbContext.AppInstanceAssignedServiceAccounts
_portalDbContext.AppInstanceAssignedTechnicalUsers
.Where(x => x.AppInstanceId == appInstanceId)
.Select(x => x.TechnicalUserId)
.ToAsyncEnumerable();
Expand All @@ -72,6 +72,6 @@ public Task<bool> CheckInstanceHasAssignedSubscriptions(Guid appInstanceId) =>

/// <inheritdoc />
public void RemoveAppInstanceAssignedServiceAccounts(Guid appInstanceId, IEnumerable<Guid> serviceAccountIds) =>
_portalDbContext.AppInstanceAssignedServiceAccounts
.RemoveRange(serviceAccountIds.Select(x => new AppInstanceAssignedCompanyServiceAccount(appInstanceId, x)));
_portalDbContext.AppInstanceAssignedTechnicalUsers
.RemoveRange(serviceAccountIds.Select(x => new AppInstanceAssignedTechnicalUser(appInstanceId, x)));
}
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public void AttachAndModifyCompanyServiceAccount(
sa.Identity!.IdentityAssignedRoles.Select(r => r.UserRoleId),
sa.Id,
sa.Identity!.UserStatusId,
sa.CompaniesLinkedServiceAccount!.Owners == companyId || sa.CompaniesLinkedServiceAccount!.Provider == companyId,
sa.CompaniesLinkedTechnicalUser!.Owners == companyId || sa.CompaniesLinkedTechnicalUser!.Provider == companyId,
sa.Version,
sa.Connector!.Id,
sa.ClientClientId,
Expand All @@ -127,12 +127,12 @@ public void AttachAndModifyCompanyServiceAccount(
serviceAccount.OfferSubscription,
serviceAccount.Identity!.LastEditor,
serviceAccount.ExternalTechnicalUser,
serviceAccount.CompaniesLinkedServiceAccount
serviceAccount.CompaniesLinkedTechnicalUser
})
.Where(x =>
x.ServiceAccount.Id == serviceAccountId &&
x.Identity!.UserStatusId != UserStatusId.DELETED &&
(x.CompaniesLinkedServiceAccount!.Owners == companyId || x.CompaniesLinkedServiceAccount!.Provider == companyId))
(x.CompaniesLinkedTechnicalUser!.Owners == companyId || x.CompaniesLinkedTechnicalUser!.Provider == companyId))
.Select(x => new CompanyServiceAccountDetailedData(
x.ServiceAccount.Id,
x.ServiceAccount.ClientClientId,
Expand Down Expand Up @@ -184,8 +184,8 @@ public void AttachAndModifyCompanyServiceAccount(
.Select(serviceAccount => new
{
ServiceAccount = serviceAccount,
IsOwner = serviceAccount.CompaniesLinkedServiceAccount!.Owners == userCompanyId,
IsProvider = serviceAccount.CompaniesLinkedServiceAccount!.Provider == userCompanyId
IsOwner = serviceAccount.CompaniesLinkedTechnicalUser!.Owners == userCompanyId,
IsProvider = serviceAccount.CompaniesLinkedTechnicalUser!.Provider == userCompanyId
})
.Where(x =>
(isOwner.HasValue
Expand Down

Large diffs are not rendered by default.

Loading

0 comments on commit 9e87170

Please sign in to comment.