Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- #943: The `load` command when used with a GitHub repository URL accepts a `branch` argument again
- #958: Update command should not fail early if external name is used
- #970: fix: Resolve <UNDEFINED> error in 'generate' command WebApp processing

### Deprecated
- #828: The `CheckStatus` flag for `<Invoke>` action has been deprecated. Default behavior is now to always check the status of the method if and only if the method signature returns %Library.Status
Expand Down
37 changes: 23 additions & 14 deletions src/cls/IPM/Storage/ModuleTemplate.cls
Original file line number Diff line number Diff line change
Expand Up @@ -194,33 +194,42 @@ Method AddWebApps(

new $namespace
set $namespace = "%SYS"
set (matchRoles,dispatchClass,autheEnabled,path)=""
for i=1:1:$listlength(tAppList) {
set app = ##class(Security.Applications).Get($listget(tAppList,i),.props)
set tAppName = props("Name")
set app = ##class(Security.Applications).Get($listget(tAppList,i), .props)
if $$$ISOK(app) {
set tAppName = props("Name")
set matchRoles = props("MatchRoles")
set autheEnabled = props("AutheEnabled")
set dispatchClass = props("DispatchClass")
set path = props("Path")
} else {
set tAppName = $listget(tAppList,i)
set autheEnabled = $$$AuthePassword
}
set ..TemplateResources(tAppName) = tAppName
set ..TemplateResources(tAppName, "Url") = tAppName
if props("MatchRoles")["%DB_"_curns {
set props("MatchRoles") = $replace(props("MatchRoles"),"%DB_"_curns,"{$dbrole}")
if matchRoles["%DB_"_curns {
set props("MatchRoles") = $replace(matchRoles,"%DB_"_curns,"{$dbrole}")
}
if (props("DispatchClass")'="") {
set ..TemplateResources(tAppName,"DispatchClass") = props("DispatchClass")
if (dispatchClass'="") {
set ..TemplateResources(tAppName,"DispatchClass") = dispatchClass
} else {
set tCSPDir = ##class(%File).NormalizeDirectory(##class(%File).ParentDirectoryName(##class(%File).ManagerDirectory())_"/csp")
set ..TemplateResources(tAppName,"Directory") = $replace(props("Path"),tCSPDir,"${cspdir}")
set ..TemplateResources(tAppName,"Directory") = $replace(path,tCSPDir,"${cspdir}")
set cspapps = cspapps_$listbuild(tAppName)

}
if ( props("AutheEnabled") = 32 ) {
if ( autheEnabled = $$$AuthePassword ) {
set ..TemplateResources(tAppName,"UnauthenticatedEnabled") = 0
set ..TemplateResources(tAppName,"PasswordAuthEnabled") = 1
} elseif ( props("AutheEnabled") = 64 ) {
set ..TemplateResources(tAppName,"UnauthenticatedEnabled") = 0
set ..TemplateResources(tAppName,"PasswordAuthEnabled") = 1
} elseif ( props("AutheEnabled") = 96 ) {
} elseif ( autheEnabled = $$$AutheUnauthenticated ) {
set ..TemplateResources(tAppName,"UnauthenticatedEnabled") = 1
set ..TemplateResources(tAppName,"PasswordAuthEnabled") = 0
} elseif ( autheEnabled = 96 ) {
set ..TemplateResources(tAppName,"UnauthenticatedEnabled") = 1
set ..TemplateResources(tAppName,"PasswordAuthEnabled") = 1
} else {
set ..TemplateResources(tAppName,"AuthenticationMethods") = props("AutheEnabled")
set ..TemplateResources(tAppName,"AuthenticationMethods") = autheEnabled
}

// Map subscript of application properties to %Installer.CSPApplication properties
Expand Down
9 changes: 9 additions & 0 deletions tests/unit_tests/Test/PM/Unit/Module.cls
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,13 @@ Method TestGetModuleDefaultsFromXML()
do $$$AssertEquals(count, 3)
}

Method TestFixUndefinedCLIGenCommand()
{
set webAppList = "/test/test"
set path = ##class(%File).NormalizeDirectory("test-path")
set template = ##class(%IPM.Storage.ModuleTemplate).NewTemplate(path, "testmodule", "1.0.0", "test module verification", "testmod")
set sc = template.AddWebApps(webAppList, .tCSPapps)
do $$$AssertStatusOK(sc, "AddWebApps method must now process web app list without error.")
}

}