Skip to content

Commit 6c9dee2

Browse files
authored
Revert "check ip"
1 parent 3adb0a2 commit 6c9dee2

File tree

1 file changed

+23
-31
lines changed

1 file changed

+23
-31
lines changed

src/cls/ZPM/REST/Base.cls

Lines changed: 23 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -9,44 +9,36 @@ Parameter HandleCorsRequest = 1;
99

1010
Parameter PAGESIZE As INTEGER = 20;
1111

12-
Parameter HTTP451LEGAL = "451 Unavailable For Legal Reasons";
13-
1412
ClassMethod OnPreDispatch(pUrl As %String, pMethod As %String, ByRef pContinue As %Boolean) As %Status
1513
{
16-
Set tSC = $$$OK
17-
Try {
14+
SET tSC = $$$OK
15+
TRY {
16+
1817
// Set the return type according to the Accept type in the request. Default is application/json.
19-
If ('..AcceptsContentType(..#CONTENTTYPEJSON)) {
20-
Set tSC = ..ReportHttpStatusCode(..#HTTP406NOTACCEPTABLE)
21-
Set pContinue = 0
22-
Quit
23-
} Else {
18+
IF ('..AcceptsContentType(..#CONTENTTYPEJSON)) {
19+
SET tSC = ..ReportHttpStatusCode(..#HTTP406NOTACCEPTABLE), pContinue=0
20+
QUIT
21+
} ELSE {
2422
// This always returns json
25-
Set %response.ContentType=..#CONTENTTYPEJSON
26-
}
27-
28-
If (##class(%Dictionary.CompiledClass).%ExistsId("ZPM.Analytics.IP")) {
29-
If ('##class(ZPM.Analytics.IP).ValidateIP(..GetRemoteAddr())) {
30-
Set tSC = ..ReportHttpStatusCode(..#HTTP451LEGAL)
31-
Set pContinue = 0
32-
Quit
33-
}
34-
}
23+
SET %response.ContentType=..#CONTENTTYPEJSON
24+
}
25+
3526

36-
// read request object into %DynamicObject format
37-
If ((pMethod'="POST") && (pMethod'="PUT")) || (%request.Content="") {
38-
Set %request.Content = {}
39-
} Else {
40-
If ($IsObject(%request.Content))&&('%request.Content.Size) {
41-
Set %request.Content = {}
42-
} Else {
43-
Set %request.Content = ##class(%Library.DynamicObject).%FromJSON(%request.Content)
27+
// read request object into %DynamicObject format
28+
IF ((pMethod'="POST") && (pMethod'="PUT")) || (%request.Content="") {
29+
SET %request.Content = {}
30+
} ELSE {
31+
IF ($IsObject(%request.Content))&&('%request.Content.Size) {
32+
SET %request.Content = {}
33+
} ELSE {
34+
SET %request.Content = ##class(%Library.DynamicObject).%FromJSON(%request.Content)
4435
}
45-
}
46-
} Catch ex {
47-
Set tSC = ex.AsStatus()
36+
}
37+
38+
} CATCH ex {
39+
SET tSC = ex.AsStatus()
4840
}
49-
Quit ##class(%iKnow.REST.Base).%ErrorHandler(tSC, .pContinue)
41+
QUIT ##class(%iKnow.REST.Base).%ErrorHandler(tSC, .pContinue)
5042
}
5143

5244
ClassMethod %ProcessResult(pStatus As %Status = {$$$OK}, pResult As %DynamicObject = "") As %Status [ Internal ]

0 commit comments

Comments
 (0)