You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -72,6 +72,7 @@ This method is invoked when a class is compiled.</Description>
72
72
write !, "Installing WebTerminal application to " _ $NAMESPACE
73
73
set ns = $NAMESPACE // ought to be package home namespace!
74
74
set ^WebTerminal("HomeNamespace") = ns
75
+
set dbdir = $$$defdir
75
76
zn:ns'="%SYS" "%SYS"
76
77
do ##class(Security.System).GetInstallationSecuritySetting(.security)
77
78
set cspProperties("AutheEnabled") = 32 // password by default, 64 for no password
@@ -83,7 +84,7 @@ This method is invoked when a class is compiled.</Description>
83
84
set cspProperties("AutheEnabled") = 64
84
85
set cspProperties("Description") = "An application representing the open socket for /terminal application. Required since 2016.* Cache versions changed WebSocket behavior. PLEASE LEAVE THIS APPLICATION UNAUTHENTICATED, but do not worry: the socket won't accept anyone without the key."
85
86
set cspProperties("DispatchClass") = ""
86
-
set cspProperties("MatchRoles")=":%DB_CACHESYS" //:%DB_USER"
87
+
set cspProperties("MatchRoles")=":%DB_CACHESYS:" _ ..GetDBRole(dbdir)
87
88
do ..RegisterWebApplication("/terminalsocket", .cspProperties)
88
89
set status = ##Class(Config.Namespaces).Get("%All")
89
90
if ($$$ISERR(status)) { // no namespace %All
@@ -132,8 +133,9 @@ This method is invoked when a class is 'uncompiled'.</Description>
132
133
write !, "Uninstalling WebTerminal application from " _ $NAMESPACE
133
134
set ns = $NAMESPACE // has to be package home namespace!
134
135
if ($get(^WebTerminal("HomeNamespace")) = "") {
135
-
write "Terminal home namespace is not defined! Uninstalling will be skipped."
136
-
quit '$$$OK
136
+
set msg = "Terminal home namespace is not defined! Uninstalling will be skipped."
137
+
set msg = msg _ $C(10,12) _ "Set ^WebTerminal(""HomeNamespace"") global equal to home namespace"
138
+
quit $$$ERROR($$$GeneralError, msg)
137
139
} else {
138
140
set ns = ^WebTerminal("HomeNamespace")
139
141
}
@@ -158,5 +160,25 @@ This method is invoked when a class is 'uncompiled'.</Description>
158
160
QUIT $$$OK
159
161
]]></Implementation>
160
162
</Method>
163
+
164
+
<Methodname="GetDBRole">
165
+
<ClassMethod>1</ClassMethod>
166
+
<FormalSpec>directory:%String</FormalSpec>
167
+
<ReturnType>%String</ReturnType>
168
+
<Implementation><![CDATA[
169
+
quit:'$d(directory) ""
170
+
new $NAMESPACE
171
+
set $Namespace = "%SYS"
172
+
#dim db As SYS.Database
173
+
set db=##class(SYS.Database).%OpenId(directory)
174
+
if $Isobject(db) {
175
+
set resource = db.ResourceName
176
+
set role = resource // I'm assuming that default role exists
0 commit comments