1
1
<?xml version =" 1.0" encoding =" UTF-8" ?>
2
2
<Export generator =" Cache" version =" 25" >
3
- <Class name =" % WebTerminal.Engine" >
3
+ <Class name =" WebTerminal.Engine" >
4
4
<Description >
5
5
Cache WEB Terminal vX.X.X/*build.replace:pkg.version*/
6
6
This class is the core of web terminal application.</Description >
@@ -928,20 +928,23 @@ the client - it includes authorization key.</Description>
928
928
/*
929
929
* Find given CSPSessionCookie in WebTerminal auth global. If found, grant access.
930
930
*/
931
- SET key = $ORDER(^WebTerminal.AuthUser(""))
931
+ SET key = $ORDER(^% WebTerminal.AuthUser(""))
932
932
WHILE (key '= "") {
933
- set lb = $GET(^WebTerminal.AuthUser(key))
933
+ set lb = $GET(^% WebTerminal.AuthUser(key))
934
934
if ((lb '= "") && (key = authKey)) {
935
935
936
936
// setup privileges
937
937
set username = $LISTGET(lb, 1) // user name
938
+ set ns = $namespace
939
+ zn "%SYS"
938
940
do ##class(Security.Users).Get(username, .userProps)
941
+ zn ns
939
942
continue:($order(userProps("")) = "")
940
943
941
944
set namespace = $case(namespace, "":userProps("NameSpace"), :namespace)
942
945
set loginStatus = ##class(%SYSTEM.Security).Login(username) // login user
943
946
944
- kill ^WebTerminal.AuthUser(key)
947
+ kill ^% WebTerminal.AuthUser(key)
945
948
946
949
set ok = loginStatus
947
950
@@ -950,10 +953,10 @@ the client - it includes authorization key.</Description>
950
953
// kill "old" auth tickets
951
954
set time = $LISTGET(lb, 2)
952
955
if (time '= "") && ($SYSTEM.SQL.DATEDIFF("s", time, $h) > 100) { // if older than 100 sec
953
- kill ^WebTerminal.AuthUser(key)
956
+ kill ^% WebTerminal.AuthUser(key)
954
957
}
955
958
956
- SET key = $ORDER(^WebTerminal.AuthUser(key))
959
+ SET key = $ORDER(^% WebTerminal.AuthUser(key))
957
960
}
958
961
959
962
if (namespace '= "") {
@@ -1102,15 +1105,16 @@ New connection established: require auth key, login and start client loop.</Desc
1102
1105
</Class >
1103
1106
1104
1107
1105
- <Class name =" % WebTerminal.Installer" >
1108
+ <Class name =" WebTerminal.Installer" >
1106
1109
<Description >
1107
1110
Importing this class will install Cache WEB Terminal properly.</Description >
1108
1111
<CompileAfter >Engine,Router,StaticContent</CompileAfter >
1109
1112
<Super >%Projection.AbstractProjection</Super >
1113
+ <TimeChanged >63898,2021.685611</TimeChanged >
1110
1114
<TimeCreated >63890,71053.144208</TimeCreated >
1111
1115
1112
1116
<Parameter name =" DispatchClass" >
1113
- <Default >% WebTerminal.Router</Default >
1117
+ <Default >WebTerminal.Router</Default >
1114
1118
</Parameter >
1115
1119
1116
1120
<Projection name =" Reference" >
@@ -1128,7 +1132,7 @@ This method is invoked when a class is compiled.</Description>
1128
1132
zn:ns'="%SYS" "%SYS"
1129
1133
do ##class(Security.System).GetInstallationSecuritySetting(.security)
1130
1134
set cspProperties("AutheEnabled") = 32 // password by default, 64 for no password
1131
- set cspProperties("NameSpace") = "%SYS" // terminal works only in %SYS namespace, only in % package
1135
+ set cspProperties("NameSpace") = ns // terminal works only in %SYS namespace, only in % package
1132
1136
set cspProperties("Description") = "A WEB application for Cache WEB Terminal."
1133
1137
set cspProperties("IsNameSpaceDefault") = 0
1134
1138
set cspProperties("DispatchClass") = ..#DispatchClass
@@ -1137,7 +1141,7 @@ This method is invoked when a class is compiled.</Description>
1137
1141
set tSC = ##class(Security.Applications).Create("/terminal", .cspProperties)
1138
1142
if $$$ISERR(tSC) throw ##class(%Installer.Exception).CreateFromStatus(tSC)
1139
1143
w !, "WEB application ""/terminal"" is created."
1140
- set ^SYS("Security", "CSP", "AllowClass", "/terminal/", ..#DispatchClass) = 1
1144
+ // set ^SYS("Security", "CSP", "AllowClass", "/terminal/", ..#DispatchClass) = 1
1141
1145
} else {
1142
1146
do ##class(Security.Applications).Get("/terminal", .props)
1143
1147
if (props("DispatchClass") '= ..#DispatchClass) {
@@ -1148,7 +1152,6 @@ This method is invoked when a class is compiled.</Description>
1148
1152
w !, "WEB application ""/terminal"" already exists, so it is ready to use."
1149
1153
}
1150
1154
}
1151
- w !, "Mapping %WebTerminal package to %All namespace..."
1152
1155
set status = ##Class(Config.Namespaces).Get("%All")
1153
1156
if ($$$ISERR(status)) { // no namespace %All
1154
1157
w !, "Creating %All namespace..."
@@ -1163,20 +1166,22 @@ This method is invoked when a class is compiled.</Description>
1163
1166
do $SYSTEM.Status.DisplayError(status)
1164
1167
quit status
1165
1168
} else {
1166
- w !, "%All namespace created."
1169
+ w !, "%All namespace is created."
1167
1170
}
1168
1171
}
1172
+ w !, "Mapping %WebTerminal package into all namespaces:"
1173
+ set mapTo = $LISTBUILD("%All", "SAMPLES", "DOCBOOK")
1169
1174
set Properties("Database") = "CACHETEMP"
1170
- set status=##Class(Config.MapPackages).Create("%All", "%WebTerminal", .Properties)
1171
- if ($$$ISERR(status)) {
1172
- do $SYSTEM.Status.DisplayError(status)
1173
- }
1174
- set Properties("Database") = "CACHELIB"
1175
- set status=##Class(Config.MapPackages).Create("%SYS", "%WebTerminal", .Properties)
1176
- if ($$$ISERR(status)) {
1177
- do $SYSTEM.Status.DisplayError(status)
1175
+ set ptr = 0
1176
+ while $LISTNEXT(mapTo, ptr, value) {
1177
+ w " ", value
1178
+ set status = ##Class(Config.MapPackages).Create(value, "WebTerminal", .Properties)
1179
+ if ($$$ISERR(status)) {
1180
+ do $SYSTEM.Status.DisplayError(status)
1181
+ }
1178
1182
}
1179
- w !, "%WebTerminal package successfully mapped into %All namespace."
1183
+ w ".", !, "Mapping complete."
1184
+ w !, "WebTerminal package successfully mapped into all namespaces."
1180
1185
zn:ns'="%SYS" ns
1181
1186
quit $$$OK
1182
1187
]]> </Implementation >
@@ -1203,6 +1208,17 @@ This method is invoked when a class is 'uncompiled'.</Description>
1203
1208
w !, "WEB application ""/terminal"" was successfully removed."
1204
1209
}
1205
1210
}
1211
+ w !, "Unmapping %WebTerminal package from all namespaces:"
1212
+ set mapTo = $LISTBUILD("%All", "SAMPLES", "DOCBOOK")
1213
+ set ptr = 0
1214
+ while $LISTNEXT(mapTo, ptr, value) {
1215
+ w " ", value
1216
+ set status = ##Class(Config.MapPackages).Delete(value, "WebTerminal")
1217
+ if ($$$ISERR(status)) {
1218
+ do $SYSTEM.Status.DisplayError(status)
1219
+ }
1220
+ }
1221
+ w ".", !, "Unmapping complete."
1206
1222
kill ^%WebTerminal.Autocomplete
1207
1223
zn:ns'="%SYS" ns
1208
1224
QUIT $$$OK
@@ -1211,7 +1227,7 @@ This method is invoked when a class is 'uncompiled'.</Description>
1211
1227
</Class >
1212
1228
1213
1229
1214
- <Class name =" % WebTerminal.Router" >
1230
+ <Class name =" WebTerminal.Router" >
1215
1231
<Description >
1216
1232
The REST interface: class that routes HTTP requests</Description >
1217
1233
<Super >%CSP.REST</Super >
@@ -1311,7 +1327,7 @@ Method writes application HTML.</Description>
1311
1327
<Implementation ><![CDATA[
1312
1328
set cookie = %session.CSPSessionCookie
1313
1329
// Put the name of authorized user in a global to authorize WebSocket WebTerminal connection
1314
- set ^WebTerminal.AuthUser(cookie) = $LB(
1330
+ set ^% WebTerminal.AuthUser(cookie) = $LB(
1315
1331
$LISTGET(%session.SecurityContext, 1), // username
1316
1332
$horolog // granting ticket date
1317
1333
)
@@ -1322,7 +1338,7 @@ Method writes application HTML.</Description>
1322
1338
</Class >
1323
1339
1324
1340
1325
- <Class name =" % WebTerminal.StaticContent" >
1341
+ <Class name =" WebTerminal.StaticContent" >
1326
1342
<Description >
1327
1343
This class holds whole application static content like scripts and styles.
1328
1344
Do not edit this file - use external tool to generate it.</Description >
@@ -1336,7 +1352,7 @@ Write the contents of xData tag</Description>
1336
1352
<ReturnType >%Status</ReturnType >
1337
1353
<Implementation ><![CDATA[
1338
1354
set Auth = $get(Auth, "")
1339
- set obj = ##class(%Dictionary.CompiledXData).%OpenId("% WebTerminal.StaticContent||"_Const)
1355
+ set obj = ##class(%Dictionary.CompiledXData).%OpenId("WebTerminal.StaticContent||"_Const)
1340
1356
quit:(obj = "") $$$OK
1341
1357
set xdata = obj.Data
1342
1358
set status=##class(%XML.TextReader).ParseStream(xdata, .textreader)
@@ -1387,10 +1403,10 @@ Write the contents of xData tag</Description>
1387
1403
1388
1404
<Project name =" WEBTerminal" LastModified =" 2015-12-06 12:10:07.906721" >
1389
1405
<Items >
1390
- <ProjectItem name =" % WebTerminal.Engine" type =" CLS" ></ProjectItem >
1391
- <ProjectItem name =" % WebTerminal.Installer" type =" CLS" ></ProjectItem >
1392
- <ProjectItem name =" % WebTerminal.Router" type =" CLS" ></ProjectItem >
1393
- <ProjectItem name =" % WebTerminal.StaticContent" type =" CLS" ></ProjectItem >
1406
+ <ProjectItem name =" WebTerminal.Engine" type =" CLS" ></ProjectItem >
1407
+ <ProjectItem name =" WebTerminal.Installer" type =" CLS" ></ProjectItem >
1408
+ <ProjectItem name =" WebTerminal.Router" type =" CLS" ></ProjectItem >
1409
+ <ProjectItem name =" WebTerminal.StaticContent" type =" CLS" ></ProjectItem >
1394
1410
</Items >
1395
1411
</Project >
1396
1412
</Export >
0 commit comments