{
  "meta": {
    "options": {
      "linkedFile": "/views/layouts/main.ejs",
      "linkedForm": "login1"
    },
    "$_GET": [
      {
        "type": "text",
        "name": "sort"
      },
      {
        "type": "text",
        "name": "dir"
      }
    ],
    "$_POST": [
      {
        "type": "text",
        "fieldName": "email",
        "name": "email"
      },
      {
        "type": "text",
        "fieldName": "remember",
        "name": "remember"
      },
      {
        "type": "text",
        "fieldName": "pwd",
        "name": "pwd"
      }
    ]
  },
  "exec": {
    "steps": [
      {
        "name": "identity",
        "module": "auth",
        "action": "login",
        "options": {
          "provider": "auth",
          "username": "{{$_POST.email}}",
          "password": "{{$_POST.pwd}}"
        },
        "output": true,
        "meta": [],
        "metaData": {
          "loginUsername": {
            "name": "email",
            "type": "text"
          },
          "loginPassword": {
            "name": "pwd",
            "type": "text"
          },
          "loginRemember": {
            "name": "remember",
            "type": "text"
          }
        }
      },
      {
        "name": "identity1",
        "module": "auth",
        "action": "identify",
        "options": {
          "provider": "auth"
        },
        "output": true,
        "meta": []
      },
      {
        "name": "user",
        "module": "dbconnector",
        "action": "single",
        "options": {
          "connection": "authdb",
          "sql": {
            "type": "select",
            "columns": [
              {
                "table": "users",
                "column": "firstname"
              },
              {
                "table": "users",
                "column": "lastname"
              },
              {
                "table": "users",
                "column": "email"
              },
              {
                "table": "users",
                "column": "validated"
              }
            ],
            "params": [
              {
                "operator": "equal",
                "type": "expression",
                "name": ":P1",
                "value": "{{identity1}}",
                "test": ""
              }
            ],
            "table": {
              "name": "users"
            },
            "primary": "id",
            "joins": [],
            "wheres": {
              "condition": "AND",
              "rules": [
                {
                  "id": "users.id",
                  "field": "users.id",
                  "type": "double",
                  "operator": "equal",
                  "value": "{{identity1}}",
                  "data": {
                    "table": "users",
                    "column": "id",
                    "type": "number",
                    "columnObj": {
                      "type": "increments",
                      "primary": true,
                      "unique": false,
                      "nullable": false,
                      "name": "id"
                    }
                  },
                  "operation": "="
                }
              ],
              "conditional": null,
              "valid": true
            },
            "query": "select `firstname`, `lastname`, `email`, `validated` from `users` where `users`.`id` = ?"
          }
        },
        "output": true,
        "meta": [
          {
            "type": "text",
            "name": "firstname"
          },
          {
            "type": "text",
            "name": "lastname"
          },
          {
            "type": "text",
            "name": "email"
          },
          {
            "type": "boolean",
            "name": "validated"
          }
        ],
        "outputType": "object"
      },
      {
        "name": "roles",
        "module": "dbconnector",
        "action": "select",
        "options": {
          "connection": "authdb",
          "sql": {
            "type": "select",
            "columns": [
              {
                "table": "roles",
                "column": "id"
              },
              {
                "table": "roles",
                "column": "name"
              },
              {
                "table": "roles",
                "column": "isDepartment"
              }
            ],
            "params": [
              {
                "operator": "equal",
                "type": "expression",
                "name": ":P1",
                "value": "{{identity1}}",
                "test": ""
              }
            ],
            "table": {
              "name": "roles"
            },
            "primary": "id",
            "joins": [
              {
                "table": "xuserrole",
                "column": "*",
                "type": "INNER",
                "clauses": {
                  "condition": "AND",
                  "rules": [
                    {
                      "table": "xuserrole",
                      "column": "roleid",
                      "operator": "equal",
                      "operation": "=",
                      "value": {
                        "table": "roles",
                        "column": "id"
                      }
                    }
                  ]
                },
                "primary": "id"
              }
            ],
            "wheres": {
              "condition": "AND",
              "rules": [
                {
                  "id": "xuserrole.userid",
                  "field": "xuserrole.userid",
                  "type": "double",
                  "operator": "equal",
                  "value": "{{identity1}}",
                  "data": {
                    "table": "xuserrole",
                    "column": "userid",
                    "type": "number",
                    "columnObj": {
                      "type": "integer",
                      "primary": false,
                      "unique": false,
                      "nullable": true,
                      "name": "userid"
                    }
                  },
                  "operation": "="
                }
              ],
              "conditional": null,
              "valid": true
            },
            "query": "select `roles`.`id`, `roles`.`name`, `roles`.`isDepartment` from `roles` inner join `xuserrole` on `xuserrole`.`roleid` = `roles`.`id` where `xuserrole`.`userid` = ?"
          }
        },
        "output": true,
        "meta": [
          {
            "type": "number",
            "name": "id"
          },
          {
            "type": "text",
            "name": "name"
          },
          {
            "type": "boolean",
            "name": "isDepartment"
          }
        ],
        "outputType": "array"
      }
    ]
  }
}