Can a SearchTableParameterQuery be run in a secure site?
I have geocortex security enabled with users/roles.
I am trying to run a workflow that includes a SearchTableParameterQuery directed to a search table within the site. When run from my viewer, the workflow fails and a message shows "Aborted exception: 'Access to this resource requires authorization.'." I can confirm running the workflow using a non-secure rest endpoint for the SearchTableParameterQuery works just fine. I can also confirm the workflow knows my current user name as I send it to an Alert just before the Search activity. Is there a way to solve this?
The workflow hopefully will be a complex search form for the front-end and to plug into workflows that generate reports. Is there another way to accomplish this, like a custom module? A workflow sounds like a good method for this scenario but really need the authorization to work.
Thanks
-
Hello Irene, since the “SearchTableParameterQuery” activity runs from Essentials, and not from the viewer, you have to generate a token for it from the workflow.
You can do that by using the “WebRequest” activity. You have to configure the URL of the REST endpoint where you can get the token, as well as a username/password (probably you can create a dedicated user for this on the REST manager) and other parameters (you can see them on the example workflow attached). Also, since the reply from the REST endpoint is in JSON format, you have to parse the reply in order to get the token string (the steps are in the attached workflow as well).
On the URL of the “SearchTableParameterQuery” you probably have something like “(http://HOSTNAME/Geocortex/Essentials/REST/sites/%20Example_Site/searchtables/Search_Table/search) http://HOSTNAME/Geocortex/Essentials/REST/sites/Example_Site/searchtables/Search_Table/search ”. Once you have the token in a string variable, you can add it to the URL of the activity like:
"(http://HOSTNAME/Geocortex/Essentials/REST/sites/Charlotte/searchtables/Search_Table/search?token=) http://HOSTNAME/Geocortex/Essentials/REST/sites/Example_Site/searchtables/Search_Table/search?token= "+tokenVariable
Where “tokenVariable” is the token returned by the “WebRequest” activity and parsed.
Please note that this workflow will only work with the site security enabled. If the site security is disabled then the "WebRequest" response will be empty.
You can download the example workflow from (https://support.geocortex.com/Data/Sites/1/userfiles/3322/getsitetoken.zip) here .
-Alejandro
0 -
The example workflow is no longer available, is it possible to relink this?
Elliott0
Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.
Kommentare
2 Kommentare