{
  "meta": {
    "$_GET": [
      {
        "type": "text",
        "name": "sort"
      },
      {
        "type": "text",
        "name": "dir"
      },
      {
        "type": "text",
        "name": "userid"
      }
    ]
  },
  "exec": {
    "steps": [
      {
        "name": "query",
        "module": "dbconnector",
        "action": "select",
        "options": {
          "connection": "authdb",
          "sql": {
            "type": "select",
            "columns": [
              {
                "table": "xuserrole",
                "column": "roleid",
                "recid": 1
              }
            ],
            "params": [
              {
                "operator": "equal",
                "type": "expression",
                "name": ":P1",
                "value": "{{$_GET.userid}}",
                "test": ""
              }
            ],
            "table": {
              "name": "xuserrole"
            },
            "primary": "id",
            "joins": [],
            "wheres": {
              "condition": "AND",
              "rules": [
                {
                  "id": "xuserrole.userid",
                  "field": "xuserrole.userid",
                  "type": "double",
                  "operator": "equal",
                  "value": "{{$_GET.userid}}",
                  "data": {
                    "table": "xuserrole",
                    "column": "userid",
                    "type": "number",
                    "columnObj": {
                      "type": "integer",
                      "primary": false,
                      "unique": false,
                      "nullable": true,
                      "name": "userid"
                    }
                  },
                  "operation": "=",
                  "table": "xuserrole"
                }
              ],
              "conditional": null,
              "valid": true
            },
            "query": "select `roleid` from `xuserrole` where `xuserrole`.`userid` = ?"
          }
        },
        "output": true,
        "meta": [
          {
            "type": "number",
            "name": "roleid"
          }
        ],
        "outputType": "array"
      },
      {
        "name": "repeat",
        "module": "core",
        "action": "repeat",
        "options": {
          "repeat": "{{query}}",
          "outputFields": [],
          "exec": {
            "steps": {
              "name": "api",
              "module": "api",
              "action": "send",
              "options": {
                "url": "{{$_ENV.API_BASEURL+'xuserroles/add/'+$_GET.userid+'/'+roleid}}",
                "schema": [
                  {
                    "type": "object",
                    "name": "data",
                    "sub": [
                      {
                        "type": "object",
                        "name": "userid",
                        "sub": [
                          {
                            "type": "boolean",
                            "name": "isactive"
                          },
                          {
                            "type": "text",
                            "name": "password"
                          },
                          {
                            "type": "text",
                            "name": "updatedate"
                          },
                          {
                            "type": "number",
                            "name": "id"
                          },
                          {
                            "type": "text",
                            "name": "lastname"
                          },
                          {
                            "type": "number",
                            "name": "updateuserid"
                          },
                          {
                            "type": "text",
                            "name": "firstname"
                          },
                          {
                            "type": "text",
                            "name": "username"
                          },
                          {
                            "type": "text",
                            "name": "email"
                          },
                          {
                            "type": "text",
                            "name": "createdate"
                          },
                          {
                            "type": "number",
                            "name": "createuserid"
                          }
                        ]
                      },
                      {
                        "type": "object",
                        "name": "roleid",
                        "sub": [
                          {
                            "type": "text",
                            "name": "name"
                          },
                          {
                            "type": "text",
                            "name": "updatedate"
                          },
                          {
                            "type": "number",
                            "name": "id"
                          },
                          {
                            "type": "number",
                            "name": "updateuserid"
                          },
                          {
                            "type": "text",
                            "name": "createdate"
                          },
                          {
                            "type": "text",
                            "name": "description"
                          },
                          {
                            "type": "boolean",
                            "name": "isdepartment"
                          },
                          {
                            "type": "number",
                            "name": "createuserid"
                          }
                        ]
                      },
                      {
                        "type": "text",
                        "name": "updatedate"
                      },
                      {
                        "type": "number",
                        "name": "id"
                      },
                      {
                        "type": "number",
                        "name": "updateuserid"
                      },
                      {
                        "type": "text",
                        "name": "createdate"
                      },
                      {
                        "type": "number",
                        "name": "createuserid"
                      }
                    ]
                  },
                  {
                    "type": "object",
                    "name": "headers",
                    "sub": [
                      {
                        "type": "text",
                        "name": "connection"
                      },
                      {
                        "type": "text",
                        "name": "content-length"
                      },
                      {
                        "type": "text",
                        "name": "content-type"
                      },
                      {
                        "type": "text",
                        "name": "date"
                      }
                    ]
                  }
                ],
                "method": "POST"
              },
              "output": true,
              "meta": [
                {
                  "type": "object",
                  "name": "data",
                  "sub": [
                    {
                      "type": "object",
                      "name": "userid",
                      "sub": [
                        {
                          "type": "boolean",
                          "name": "isactive"
                        },
                        {
                          "type": "text",
                          "name": "password"
                        },
                        {
                          "type": "text",
                          "name": "updatedate"
                        },
                        {
                          "type": "number",
                          "name": "id"
                        },
                        {
                          "type": "text",
                          "name": "lastname"
                        },
                        {
                          "type": "number",
                          "name": "updateuserid"
                        },
                        {
                          "type": "text",
                          "name": "firstname"
                        },
                        {
                          "type": "text",
                          "name": "username"
                        },
                        {
                          "type": "text",
                          "name": "email"
                        },
                        {
                          "type": "text",
                          "name": "createdate"
                        },
                        {
                          "type": "number",
                          "name": "createuserid"
                        }
                      ]
                    },
                    {
                      "type": "object",
                      "name": "roleid",
                      "sub": [
                        {
                          "type": "text",
                          "name": "name"
                        },
                        {
                          "type": "text",
                          "name": "updatedate"
                        },
                        {
                          "type": "number",
                          "name": "id"
                        },
                        {
                          "type": "number",
                          "name": "updateuserid"
                        },
                        {
                          "type": "text",
                          "name": "createdate"
                        },
                        {
                          "type": "text",
                          "name": "description"
                        },
                        {
                          "type": "boolean",
                          "name": "isdepartment"
                        },
                        {
                          "type": "number",
                          "name": "createuserid"
                        }
                      ]
                    },
                    {
                      "type": "text",
                      "name": "updatedate"
                    },
                    {
                      "type": "number",
                      "name": "id"
                    },
                    {
                      "type": "number",
                      "name": "updateuserid"
                    },
                    {
                      "type": "text",
                      "name": "createdate"
                    },
                    {
                      "type": "number",
                      "name": "createuserid"
                    }
                  ]
                },
                {
                  "type": "object",
                  "name": "headers",
                  "sub": [
                    {
                      "type": "text",
                      "name": "connection"
                    },
                    {
                      "type": "text",
                      "name": "content-length"
                    },
                    {
                      "type": "text",
                      "name": "content-type"
                    },
                    {
                      "type": "text",
                      "name": "date"
                    }
                  ]
                }
              ],
              "outputType": "object"
            }
          }
        },
        "output": true,
        "meta": [
          {
            "name": "$index",
            "type": "number"
          },
          {
            "name": "$number",
            "type": "number"
          },
          {
            "name": "$name",
            "type": "text"
          },
          {
            "name": "$value",
            "type": "object"
          },
          {
            "name": "roleid",
            "type": "number"
          },
          {
            "name": "api",
            "type": "object",
            "sub": [
              {
                "type": "object",
                "name": "data",
                "sub": [
                  {
                    "type": "object",
                    "name": "userid",
                    "sub": [
                      {
                        "type": "boolean",
                        "name": "isactive"
                      },
                      {
                        "type": "text",
                        "name": "password"
                      },
                      {
                        "type": "text",
                        "name": "updatedate"
                      },
                      {
                        "type": "number",
                        "name": "id"
                      },
                      {
                        "type": "text",
                        "name": "lastname"
                      },
                      {
                        "type": "number",
                        "name": "updateuserid"
                      },
                      {
                        "type": "text",
                        "name": "firstname"
                      },
                      {
                        "type": "text",
                        "name": "username"
                      },
                      {
                        "type": "text",
                        "name": "email"
                      },
                      {
                        "type": "text",
                        "name": "createdate"
                      },
                      {
                        "type": "number",
                        "name": "createuserid"
                      }
                    ]
                  },
                  {
                    "type": "object",
                    "name": "roleid",
                    "sub": [
                      {
                        "type": "text",
                        "name": "name"
                      },
                      {
                        "type": "text",
                        "name": "updatedate"
                      },
                      {
                        "type": "number",
                        "name": "id"
                      },
                      {
                        "type": "number",
                        "name": "updateuserid"
                      },
                      {
                        "type": "text",
                        "name": "createdate"
                      },
                      {
                        "type": "text",
                        "name": "description"
                      },
                      {
                        "type": "boolean",
                        "name": "isdepartment"
                      },
                      {
                        "type": "number",
                        "name": "createuserid"
                      }
                    ]
                  },
                  {
                    "type": "text",
                    "name": "updatedate"
                  },
                  {
                    "type": "number",
                    "name": "id"
                  },
                  {
                    "type": "number",
                    "name": "updateuserid"
                  },
                  {
                    "type": "text",
                    "name": "createdate"
                  },
                  {
                    "type": "number",
                    "name": "createuserid"
                  }
                ]
              },
              {
                "type": "object",
                "name": "headers",
                "sub": [
                  {
                    "type": "text",
                    "name": "connection"
                  },
                  {
                    "type": "text",
                    "name": "content-length"
                  },
                  {
                    "type": "text",
                    "name": "content-type"
                  },
                  {
                    "type": "text",
                    "name": "date"
                  }
                ]
              }
            ]
          }
        ],
        "outputType": "array"
      }
    ]
  }
}