Global identity from identify action step not working

[Wappler 3.5.5 - NodeJS - W10]

Hope this is the right place: I think I found a bug, I’ve put the Security Identify in the Global steps as you show.

However, I can’t seem to use it in a database query step unless I also add the Security Identify step in that server action. Let me explain…

This doesn’t work:

  1. I set up a Security Identify in the global steps
  2. I use the {{globalidentity}} variable from step 1 in a database query:
  3. The {{globalidentity}} seems to be completely empty: I debugged the database query and this is the output:
// 20201122163205
// http://localhost:8100/api/Courses/get_my_courses_v2

{
  "query": {
    "options": {
      "connection": "db",
      "sql": {
        "type": "select",
        "columns": [
          
        ],
        "table": {
          "name": "users_enrolled_courses"
        },
        "joins": [
          {
            "table": "courses",
            "column": "*",
            "type": "INNER",
            "clauses": {
              "condition": "AND",
              "rules": [
                {
                  "table": "courses",
                  "column": "id",
                  "operator": "equal",
                  "value": {
                    "table": "users_enrolled_courses",
                    "column": "course_id"
                  },
                  "operation": "="
                }
              ]
            }
          },
          {
            "table": "users",
            "column": "*",
            "type": "INNER",
            "clauses": {
              "condition": "AND",
              "rules": [
                {
                  "table": "users",
                  "column": "id",
                  "operator": "equal",
                  "value": {
                    "table": "users_enrolled_courses",
                    "column": "user_id"
                  },
                  "operation": "="
                }
              ]
            }
          }
        ],
        "query": "SELECT *\nFROM users_enrolled_courses\nINNER JOIN courses ON (courses.id = users_enrolled_courses.course_id) INNER JOIN users ON (users.id = users_enrolled_courses.user_id)\nWHERE users_enrolled_courses.user_id = :P1 /*  */",
        "params": [
          {
            "operator": "equal",
            "type": "expression",
            "name": ":P1"
          }
        ],
        "wheres": {
          "condition": "AND",
          "rules": [
            {
              "id": "users_enrolled_courses.user_id",
              "field": "users_enrolled_courses.user_id",
              "type": "string",
              "operator": "equal",
              "data": {
                "table": "users_enrolled_courses",
                "column": "user_id",
                "type": "text"
              },
              "operation": "="
            }
          ],
          "conditional": {
            
          },
          "valid": true
        },
        "sort": null,
        "dir": "asc"
      },
      "test": true
    },
    "query": "[object Object]"
  }
}

I can’t find the {{globalidentity}} anywhere, it won’t show on the page as well when adding it.

But if I add a security identify in the steps of “get_my_courses_v2”…

This is the output of that server action: image
So they both show up at the top now (they’re false because I am not logged in image )

If I disable that action step, save and run in the browser again:

I DO see the {{globalidentity}} but it’s at the bottom of the output. I can’t use it in the query above, where I need it

Please test this update, unzip in lib/core.

app.zip (3.4 KB)

1 Like

Thanks @patrick quick fix.

This works!

The server action that I showed in OP works now.

Will use it more later this week so will update if there are more issues.

1 Like

This topic was automatically closed after 3 days. New replies are no longer allowed.