langcode: en
status: false
dependencies:
  config:
    - user.role.anonymous
  module:
    - eca_base
    - eca_misc
    - eca_user
    - modeler_api
third_party_settings:
  modeler_api:
    modeler_id: bpmn_io
    data: 'hash:30f03a8c0d04d4e1f8299c73d286c67a'
    label: 'Redirect 403 to Login'
    tags:
      - 'use case'
      - redirect
      - 'redirect 403'
    version: 1.0.0
    annotations:
      TextAnnotation_1r1r1r1:
        text: 'Triggered when an HTTP response is created, allowing inspection and modification.'
        assigned_to:
          Association_08jmr8h: kernel__response_1
      TextAnnotation_1r2r2r2:
        text: 'Check if the HTTP response status code is 403 (Access Denied).'
        assigned_to:
          Association_1r6vwxp: 'kernel__response_1,eca_void_and_condition_0v21nbd'
      TextAnnotation_1r3r3r3:
        text: 'Verify that the current user is anonymous (not logged in).'
        assigned_to:
          Association_0b2gdea: 'eca_void_and_condition_0v21nbd,action_goto_action_0nji5tn'
      TextAnnotation_1r4r4r4:
        text: 'Combine both conditions: must be 403 error AND user must be anonymous.'
        assigned_to:
          Association_0geuj1q: eca_void_and_condition_0v21nbd
      TextAnnotation_1r5r5r5:
        text: 'Redirect anonymous users to the login page, preserving the original destination URL.'
        assigned_to:
          Association_0tlvck0: action_goto_action_0nji5tn
    colors:
      TextAnnotation_1r1r1r1:
        fill: '#ffe0b2'
        stroke: '#6b3c00'
      TextAnnotation_1r2r2r2:
        fill: '#ffe0b2'
        stroke: '#6b3c00'
      TextAnnotation_1r3r3r3:
        fill: '#ffe0b2'
        stroke: '#6b3c00'
      TextAnnotation_1r4r4r4:
        fill: '#ffe0b2'
        stroke: '#6b3c00'
      TextAnnotation_1r5r5r5:
        fill: '#ffe0b2'
        stroke: '#6b3c00'
id: redirect_403_to_login
weight: 0
events:
  kernel__response_1:
    plugin: 'kernel:response'
    label: 'Response created'
    configuration: {  }
    successors:
      -
        id: eca_void_and_condition_0v21nbd
        condition: eca_scalar_1q09u8b
conditions:
  eca_scalar_1q09u8b:
    plugin: eca_scalar
    label: '403'
    configuration:
      negate: false
      left: '[event:code]'
      right: '403'
      operator: equal
      type: value
      case: false
  eca_current_user_role_14bo1m1:
    plugin: eca_current_user_role
    label: Anonymous
    configuration:
      negate: false
      role: anonymous
gateways: {  }
actions:
  eca_void_and_condition_0v21nbd:
    label: And
    plugin: eca_void_and_condition
    configuration: {  }
    successors:
      -
        id: action_goto_action_0nji5tn
        condition: eca_current_user_role_14bo1m1
  action_goto_action_0nji5tn:
    label: 'Redirect to URL'
    plugin: action_goto_action
    configuration:
      url: '/user/login?destination=[event:path]'
      replace_tokens: true
    successors: {  }
