Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(activation): split application activation #1004

Merged
merged 7 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
173 changes: 172 additions & 1 deletion docs/api/administration-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4097,6 +4097,166 @@ paths:
description: Internal Server Error
'401':
description: The User is unauthorized
'/api/administration/registration/application/{applicationId}/retrigger-assign-initial-roles':
post:
tags:
- Registration
summary: 'Retriggers the last failed step (Authorization required - Roles: approve_new_partner)'
parameters:
- name: applicationId
in: path
description: Id of the application that should be triggered
required: true
schema:
type: string
format: uuid
responses:
'204':
description: Empty response on success.
'400':
description: Either the CompanyApplication is not in status SUBMITTED or the next step can't automatically retriggered.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'404':
description: No application found for the applicationId.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'500':
description: Internal Server Error
'401':
description: The User is unauthorized
'/api/administration/registration/application/{applicationId}/retrigger-assign-bpn':
post:
tags:
- Registration
summary: 'Retriggers the last failed step (Authorization required - Roles: approve_new_partner)'
parameters:
- name: applicationId
in: path
description: Id of the application that should be triggered
required: true
schema:
type: string
format: uuid
responses:
'204':
description: Empty response on success.
'400':
description: Either the CompanyApplication is not in status SUBMITTED or the next step can't automatically retriggered.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'404':
description: No application found for the applicationId.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'500':
description: Internal Server Error
'401':
description: The User is unauthorized
'/api/administration/registration/application/{applicationId}/retrigger-remove-roles':
post:
tags:
- Registration
summary: 'Retriggers the last failed step (Authorization required - Roles: approve_new_partner)'
parameters:
- name: applicationId
in: path
description: Id of the application that should be triggered
required: true
schema:
type: string
format: uuid
responses:
'204':
description: Empty response on success.
'400':
description: Either the CompanyApplication is not in status SUBMITTED or the next step can't automatically retriggered.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'404':
description: No application found for the applicationId.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'500':
description: Internal Server Error
'401':
description: The User is unauthorized
'/api/administration/registration/application/{applicationId}/retrigger-set-theme':
post:
tags:
- Registration
summary: 'Retriggers the last failed step (Authorization required - Roles: approve_new_partner)'
parameters:
- name: applicationId
in: path
description: Id of the application that should be triggered
required: true
schema:
type: string
format: uuid
responses:
'204':
description: Empty response on success.
'400':
description: Either the CompanyApplication is not in status SUBMITTED or the next step can't automatically retriggered.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'404':
description: No application found for the applicationId.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'500':
description: Internal Server Error
'401':
description: The User is unauthorized
'/api/administration/registration/application/{applicationId}/retrigger-set-membership':
post:
tags:
- Registration
summary: 'Retriggers the last failed step (Authorization required - Roles: approve_new_partner)'
parameters:
- name: applicationId
in: path
description: Id of the application that should be triggered
required: true
schema:
type: string
format: uuid
responses:
'204':
description: Empty response on success.
'400':
description: Either the CompanyApplication is not in status SUBMITTED or the next step can't automatically retriggered.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'404':
description: No application found for the applicationId.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'500':
description: Internal Server Error
'401':
description: The User is unauthorized
/api/administration/RegistrationStatus/callback:
get:
tags:
Expand Down Expand Up @@ -7338,7 +7498,7 @@ components:
- AWAIT_CLEARING_HOUSE_RESPONSE
- START_SELF_DESCRIPTION_LP
- RETRIGGER_SELF_DESCRIPTION_LP
- ACTIVATE_APPLICATION
- START_APPLICATION_ACTIVATION
- RETRIGGER_BUSINESS_PARTNER_NUMBER_PUSH
- RETRIGGER_BUSINESS_PARTNER_NUMBER_PULL
- MANUAL_TRIGGER_OVERRIDE_CLEARING_HOUSE
Expand All @@ -7358,6 +7518,17 @@ components:
- RETRIGGER_TRANSMIT_DID_BPN
- RETRIGGER_REQUEST_BPN_CREDENTIAL
- RETRIGGER_REQUEST_MEMBERSHIP_CREDENTIAL
- ASSIGN_INITIAL_ROLES
- ASSIGN_BPN_TO_USERS
- REMOVE_REGISTRATION_ROLES
- SET_THEME
- SET_MEMBERSHIP
- FINISH_APPLICATION_ACTIVATION
- RETRIGGER_ASSIGN_INITIAL_ROLES
- RETRIGGER_ASSIGN_BPN_TO_USERS
- RETRIGGER_REMOVE_REGISTRATION_ROLES
- RETRIGGER_SET_THEME
- RETRIGGER_SET_MEMBERSHIP
- TRIGGER_PROVIDER
- AWAIT_START_AUTOSETUP
- OFFERSUBSCRIPTION_CLIENT_CREATION
Expand Down
13 changes: 12 additions & 1 deletion docs/api/apps-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3532,7 +3532,7 @@ components:
- AWAIT_CLEARING_HOUSE_RESPONSE
- START_SELF_DESCRIPTION_LP
- RETRIGGER_SELF_DESCRIPTION_LP
- ACTIVATE_APPLICATION
- START_APPLICATION_ACTIVATION
- RETRIGGER_BUSINESS_PARTNER_NUMBER_PUSH
- RETRIGGER_BUSINESS_PARTNER_NUMBER_PULL
- MANUAL_TRIGGER_OVERRIDE_CLEARING_HOUSE
Expand All @@ -3552,6 +3552,17 @@ components:
- RETRIGGER_TRANSMIT_DID_BPN
- RETRIGGER_REQUEST_BPN_CREDENTIAL
- RETRIGGER_REQUEST_MEMBERSHIP_CREDENTIAL
- ASSIGN_INITIAL_ROLES
- ASSIGN_BPN_TO_USERS
- REMOVE_REGISTRATION_ROLES
- SET_THEME
- SET_MEMBERSHIP
- FINISH_APPLICATION_ACTIVATION
- RETRIGGER_ASSIGN_INITIAL_ROLES
- RETRIGGER_ASSIGN_BPN_TO_USERS
- RETRIGGER_REMOVE_REGISTRATION_ROLES
- RETRIGGER_SET_THEME
- RETRIGGER_SET_MEMBERSHIP
- TRIGGER_PROVIDER
- AWAIT_START_AUTOSETUP
- OFFERSUBSCRIPTION_CLIENT_CREATION
Expand Down
13 changes: 12 additions & 1 deletion docs/api/services-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2112,7 +2112,7 @@ components:
- AWAIT_CLEARING_HOUSE_RESPONSE
- START_SELF_DESCRIPTION_LP
- RETRIGGER_SELF_DESCRIPTION_LP
- ACTIVATE_APPLICATION
- START_APPLICATION_ACTIVATION
- RETRIGGER_BUSINESS_PARTNER_NUMBER_PUSH
- RETRIGGER_BUSINESS_PARTNER_NUMBER_PULL
- MANUAL_TRIGGER_OVERRIDE_CLEARING_HOUSE
Expand All @@ -2132,6 +2132,17 @@ components:
- RETRIGGER_TRANSMIT_DID_BPN
- RETRIGGER_REQUEST_BPN_CREDENTIAL
- RETRIGGER_REQUEST_MEMBERSHIP_CREDENTIAL
- ASSIGN_INITIAL_ROLES
- ASSIGN_BPN_TO_USERS
- REMOVE_REGISTRATION_ROLES
- SET_THEME
- SET_MEMBERSHIP
- FINISH_APPLICATION_ACTIVATION
- RETRIGGER_ASSIGN_INITIAL_ROLES
- RETRIGGER_ASSIGN_BPN_TO_USERS
- RETRIGGER_REMOVE_REGISTRATION_ROLES
- RETRIGGER_SET_THEME
- RETRIGGER_SET_MEMBERSHIP
- TRIGGER_PROVIDER
- AWAIT_START_AUTOSETUP
- OFFERSUBSCRIPTION_CLIENT_CREATION
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -616,5 +616,115 @@ public async Task<NoContentResult> RetriggerDeleteCentralUser([FromRoute] Guid p
await logic.RetriggerDeleteCentralUser(processId).ConfigureAwait(false);
return NoContent();
}

/// <summary>
/// Retriggers the last failed step
/// </summary>
/// <param name="applicationId" example="">Id of the application that should be triggered</param>
/// <returns>NoContent</returns>
/// Example: POST: api/administration/registration/application/{applicationId}/retrigger-assign-initial-roles
/// <response code="204">Empty response on success.</response>
/// <response code="400">Either the CompanyApplication is not in status SUBMITTED or the next step can't automatically retriggered.</response>
/// <response code="404">No application found for the applicationId.</response>
[HttpPost]
[Authorize(Roles = "approve_new_partner")]
[Authorize(Policy = PolicyTypes.CompanyUser)]
[Route("application/{applicationId}/retrigger-assign-initial-roles")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status400BadRequest)]
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status404NotFound)]
public async Task<NoContentResult> RetriggerAssignInitialRoles([FromRoute] Guid applicationId)
{
await logic.TriggerChecklistAsync(applicationId, ApplicationChecklistEntryTypeId.APPLICATION_ACTIVATION, ProcessStepTypeId.RETRIGGER_ASSIGN_INITIAL_ROLES).ConfigureAwait(ConfigureAwaitOptions.None);
return NoContent();
}

/// <summary>
/// Retriggers the last failed step
/// </summary>
/// <param name="applicationId" example="">Id of the application that should be triggered</param>
/// <returns>NoContent</returns>
/// Example: POST: api/administration/registration/application/{applicationId}/retrigger-assign-bpn
/// <response code="204">Empty response on success.</response>
/// <response code="400">Either the CompanyApplication is not in status SUBMITTED or the next step can't automatically retriggered.</response>
/// <response code="404">No application found for the applicationId.</response>
[HttpPost]
[Authorize(Roles = "approve_new_partner")]
[Authorize(Policy = PolicyTypes.CompanyUser)]
[Route("application/{applicationId}/retrigger-assign-bpn")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status400BadRequest)]
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status404NotFound)]
public async Task<NoContentResult> RetriggerAssignBpn([FromRoute] Guid applicationId)
{
await logic.TriggerChecklistAsync(applicationId, ApplicationChecklistEntryTypeId.APPLICATION_ACTIVATION, ProcessStepTypeId.RETRIGGER_ASSIGN_BPN_TO_USERS).ConfigureAwait(ConfigureAwaitOptions.None);
return NoContent();
}

/// <summary>
/// Retriggers the last failed step
/// </summary>
/// <param name="applicationId" example="">Id of the application that should be triggered</param>
/// <returns>NoContent</returns>
/// Example: POST: api/administration/registration/application/{applicationId}/retrigger-remove-roles
/// <response code="204">Empty response on success.</response>
/// <response code="400">Either the CompanyApplication is not in status SUBMITTED or the next step can't automatically retriggered.</response>
/// <response code="404">No application found for the applicationId.</response>
[HttpPost]
[Authorize(Roles = "approve_new_partner")]
[Authorize(Policy = PolicyTypes.CompanyUser)]
[Route("application/{applicationId}/retrigger-remove-roles")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status400BadRequest)]
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status404NotFound)]
public async Task<NoContentResult> RetriggerRemoveRegistrationRoles([FromRoute] Guid applicationId)
{
await logic.TriggerChecklistAsync(applicationId, ApplicationChecklistEntryTypeId.APPLICATION_ACTIVATION, ProcessStepTypeId.RETRIGGER_REMOVE_REGISTRATION_ROLES).ConfigureAwait(ConfigureAwaitOptions.None);
return NoContent();
}

/// <summary>
/// Retriggers the last failed step
/// </summary>
/// <param name="applicationId" example="">Id of the application that should be triggered</param>
/// <returns>NoContent</returns>
/// Example: POST: api/administration/registration/application/{applicationId}/retrigger-set-theme
/// <response code="204">Empty response on success.</response>
/// <response code="400">Either the CompanyApplication is not in status SUBMITTED or the next step can't automatically retriggered.</response>
/// <response code="404">No application found for the applicationId.</response>
[HttpPost]
[Authorize(Roles = "approve_new_partner")]
[Authorize(Policy = PolicyTypes.CompanyUser)]
[Route("application/{applicationId}/retrigger-set-theme")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status400BadRequest)]
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status404NotFound)]
public async Task<NoContentResult> RetriggerSetTheme([FromRoute] Guid applicationId)
{
await logic.TriggerChecklistAsync(applicationId, ApplicationChecklistEntryTypeId.APPLICATION_ACTIVATION, ProcessStepTypeId.RETRIGGER_SET_THEME).ConfigureAwait(ConfigureAwaitOptions.None);
return NoContent();
}

/// <summary>
/// Retriggers the last failed step
/// </summary>
/// <param name="applicationId" example="">Id of the application that should be triggered</param>
/// <returns>NoContent</returns>
/// Example: POST: api/administration/registration/application/{applicationId}/retrigger-set-membership
/// <response code="204">Empty response on success.</response>
/// <response code="400">Either the CompanyApplication is not in status SUBMITTED or the next step can't automatically retriggered.</response>
/// <response code="404">No application found for the applicationId.</response>
[HttpPost]
[Authorize(Roles = "approve_new_partner")]
[Authorize(Policy = PolicyTypes.CompanyUser)]
[Route("application/{applicationId}/retrigger-set-membership")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status400BadRequest)]
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status404NotFound)]
public async Task<NoContentResult> RetriggerSetMembership([FromRoute] Guid applicationId)
{
await logic.TriggerChecklistAsync(applicationId, ApplicationChecklistEntryTypeId.APPLICATION_ACTIVATION, ProcessStepTypeId.RETRIGGER_SET_MEMBERSHIP).ConfigureAwait(ConfigureAwaitOptions.None);
return NoContent();
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public Task RegisterConnectorAsync(
entry.ApplicationChecklistEntryStatusId = ApplicationChecklistEntryStatusId.SKIPPED;
entry.Comment = "Self description was skipped due to clearinghouse trigger is disabled";
},
[ProcessStepTypeId.ACTIVATE_APPLICATION],
[ProcessStepTypeId.ASSIGN_INITIAL_ROLES],
null,
true,
"Self description was skipped due to clearinghouse trigger is disabled"
Expand Down Expand Up @@ -133,7 +133,7 @@ public async Task ProcessFinishSelfDescriptionLpForApplication(SelfDescriptionRe
: ApplicationChecklistEntryStatusId.FAILED;
item.Comment = data.Message;
},
confirm ? new[] { ProcessStepTypeId.ACTIVATE_APPLICATION } : null);
confirm ? new[] { ProcessStepTypeId.ASSIGN_INITIAL_ROLES } : null);
}

/// <inheritdoc />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,4 @@ namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models;

public record CompanyInvitedUserData(
Guid CompanyUserId,
IEnumerable<string> BusinessPartnerNumbers,
IEnumerable<Guid> RoleIds);
Loading
Loading