@@ -55,7 +55,27 @@ todo add optional parameter WEBAPP to Alter web app name if it needs to have ano
5555<Namespace Name="Samples" Create="no">
5656<ClassMapping From="${Namespace}" Package="MDX2JSON"/>
5757</Namespace>
58+
59+ <IfDef Var="User" >
60+ <IfDef Var="Password">
61+ <RunInstall Class="MDX2JSON.Installer" Method="createuser" />
62+ </IfDef>
63+ <IfNotDef Var="Password">
64+ <Log Text="You specified username but not a password" Level="0"/>
65+ </IfNotDef>
66+ </IfDef>
5867
68+ </Manifest>
69+ ]]> </Data >
70+ </XData >
71+
72+ <XData name =" CreateUser" >
73+ <Description >
74+ See generated code in zcreateuser+1^MDX2JSON.Installer.1
75+ Creates user and gives him access</Description >
76+ <XMLNamespace >INSTALLER</XMLNamespace >
77+ <Data ><![CDATA[
78+ <Manifest>
5979<IfDef Var="User" >
6080<IfDef Var="Password">
6181<User Username="${User}" Namespace="${Namespace}" PasswordVar="Password" Roles="%DB_${Namespace}" Enabled="true" Comment="MDX2JSON user" Fullname="MDX2JSON user" >
@@ -89,6 +109,21 @@ do ##class(MDX2JSON.Installer).setup(.pVars)</Description>
89109]]> </Implementation >
90110</Method >
91111
112+ <Method name =" createuser" >
113+ <Description >
114+ This is a method generator whose code is generated by XGL.
115+ Set pVars("User")="web"
116+ Set pVars("Password")="dsweb"
117+ do ##class(MDX2JSON.Installer).createuser(.pVars)</Description >
118+ <Internal >1</Internal >
119+ <ClassMethod >1</ClassMethod >
120+ <CodeMode >objectgenerator</CodeMode >
121+ <FormalSpec ><![CDATA[ &pVars,pLogLevel:%Integer=0,pInstaller:%Installer.Installer]]> </FormalSpec >
122+ <ReturnType >%Status</ReturnType >
123+ <Implementation ><![CDATA[ Quit ##class(%Installer.Manifest).%Generate(%compiledclass, %code, "CreateUser")
124+ ]]> </Implementation >
125+ </Method >
126+
92127<Method name =" CreateWebApp" >
93128<ClassMethod >1</ClassMethod >
94129<FormalSpec >pVars,pLogLevel,tInstaller</FormalSpec >
@@ -424,7 +459,7 @@ Grant select access to User to all tables in comma-separated list of namespaces<
424459<Implementation ><![CDATA[
425460 set user = tInstaller.Evaluate("${User}")
426461 set namespace = tInstaller.Evaluate("${Namespace}")
427- return ..GrantSelectToUser (user,namespace)
462+ return ..GrantExecuteToUser (user,namespace)
428463]]> </Implementation >
429464</Method >
430465
0 commit comments