ЕСОЗ - публічна документація

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Purpose

This Method allows to deactivate items of the Forbidden groups.

Key points

  1. This is a graphQl method used in Administration panel only

  2. Only authenticated and authorized NHS employee with appropriate scope can deactivate items of the Forbidden groups.

  3. Items should be deactivated using DS.

  4. One or more items can be deactivated at once.

  5. Only active items can be deactivated.

Specification

"""
Input for `deactivateForbiddenGroupItems` mutation.
User must have a scope **forbidden_group:write**
"""
input DeactivateForbiddenGroupItemsInput {
    "Forbidden group identifier."
    forbiddenGroupId: ID!
    "List with IDs of `ForbiddenGroupService` objects. Each object should be active and belong to the `forbiddenGroupId`"
    forbiddenGroupServiceIds: [ID!]
    "List with IDs of `ForbiddenGroupCode` objects. Each object should be active and belong to the `forbiddenGroupId`"
    forbiddenGroupCodeIds: [ID!]
}

"""
Return type for `DeactivateForbiddenGroupItems` mutation.
"""
type DeactivateForbiddenGroupItemsPayload {
  "Updaed `ForbiddenGroup`."
  forbiddenGroup: ForbiddenGroup
}

Authorization

  • Verify the validity of access token

    • in case of error - return 401 (“Invalid access token”) in case of validation fails

  • Verify that token is not expired

    • in case of error - return 401 (“Invalid access token”)

  • Check user scopes in order to perform this action (scope = 'forbidden_group:write')

    • return 403 (“Your scope does not allow to access this resource. Missing allowances: forbidden_group:write”) in case of invalid scope(s)

Validate legal entity

  • Extract client_id from token.

  • Check client scopes in order to perform this action (scope = 'forbidden_group:write')

    • in case of error - return 403 (“Your scope does not allow to access this resource. Missing allowances: forbidden_group:write”)

  • Check legal entity status (status = ACTIVE)

    • In case of error - return 409 ('client_id refers to legal entity that is not active')

Validate Digital Sign

  • Validate request is signed

    • in case of error - return 422 (“document must be signed by 1 signer but contains 0 signatures”)

  • Check DS is valid and not expired

  • Validate that DS belongs to the user

    • Check that DRFO from DS and party.tax_id matches

      • in case of error - return 409 (“Signer DRFO doesn't match with requester tax_id“)

Validate request

  1. Check at least one of the array fields submitted: forbidden_group_service_ids, forbidden_group_code_ids

  • in case of error - return 422 ('One of the required property should be present: forbidden_group_service_ids, forbidden_group_code_ids')

  1. For each id in the forbidden_group_service_ids or forbidden_group_code_ids array:

  • Check it is unique within request

    • in case of error - return 422 ('Item Id <id> is duplicated in the request')

  • Check it exists and active:

    • in case of error - return 404 ('not found')

  1. Check deactivation_reason submitted

  • in case of error - return 422 ('required property deactivation_reason was not present')

Service logic

  1. Save signed content to media storage

  2. For each id in the forbidden_group_service_ids or forbidden_group_code_ids array:

    1. set is_active = false in the corresponding table (look at /wiki/spaces/FORBIDDEN/pages/2087190529)

    2. set deactivation_reason = $.deactivation_reason

    3. set updated_at, updated_by

  3. Clear cache

  • No labels