Skip to content

Commit c88f97f

Browse files
committed
LDEV-4956 setAdminPassword and adminPassword
https://luceeserver.atlassian.net/browse/LDEV-4956
1 parent fb2624a commit c88f97f

File tree

2 files changed

+57
-40
lines changed

2 files changed

+57
-40
lines changed

build-run-cfml.xml

Lines changed: 48 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<project default="all" basedir="." name="run-cfml">
33
<macrodef name="echots">
4-
<attribute name="message"/>
4+
<attribute name="message" />
55
<sequential>
66
<local name="timestamp" />
77
<tstamp>
@@ -11,43 +11,46 @@
1111
</sequential>
1212
</macrodef>
1313
<target name="all">
14-
<echots message="Lucee Starting"/>
14+
<echots message="Lucee Starting" />
1515
<script language="CFML">
1616
<![CDATA[
1717
systemOutput( "---------- #DateTimeFormat(now(),'yyyy-mm-dd HH:nn:ss')# - Lucee Started ----------", true);
1818
systemOutput( "#server.lucee.version#", true );
1919
20-
request.adminPassword="admin";
20+
param name="adminPassword" default="admin";
21+
request.adminPassword = adminPassword;
2122
request.errorThrown = false;
2223
2324
try {
25+
param name="setAdminPassword" default="true";
26+
if ( setAdminPassword ) {
27+
28+
// set a password for the admin
29+
try {
30+
admin
31+
action="updatePassword"
32+
type="web"
33+
oldPassword=""
34+
newPassword="#request.adminPassword#";
35+
systemOutput( "Set Web admin password", true );
36+
}
37+
catch(e){
38+
systemOutput( e.message, true ); // may exist from previous execution
39+
}
2440
25-
// set a password for the admin
26-
try {
27-
admin
28-
action="updatePassword"
29-
type="web"
30-
oldPassword=""
31-
newPassword="#request.adminPassword#";
32-
systemOutput( "Set Web admin password", true );
33-
}
34-
catch(e){
35-
systemOutput( e.message, true ); // may exist from previous execution
36-
}
37-
38-
try {
39-
admin
40-
action="updatePassword"
41-
type="server"
42-
oldPassword=""
43-
newPassword="#request.adminPassword#";
44-
systemOutput( "Set Server admin password", true );
45-
}
46-
catch(e){
47-
systemOutput( e.message, true ); // may exist from previous execution
41+
try {
42+
admin
43+
action="updatePassword"
44+
type="server"
45+
oldPassword=""
46+
newPassword="#request.adminPassword#";
47+
systemOutput( "Set Server admin password", true );
48+
}
49+
catch(e){
50+
systemOutput( e.message, true ); // may exist from previous execution
51+
}
4852
}
4953
50-
5154
admin
5255
action="updateMapping"
5356
type="web"
@@ -59,18 +62,24 @@
5962
primary="physical"
6063
trusted="no";
6164
62-
admin
63-
action="getMappings"
64-
type="web"
65-
password="#request.adminPassword#"
66-
returnVariable="mappings";
67-
6865
systemOutput( "-------------- Mappings --------------", true );
69-
loop query="mappings" {
70-
systemOutput("#mappings.virtual# #chr( 9 )# #mappings.strPhysical# "
71-
& ( len( mappings.strArchive ) ? "[#mappings.strArchive#] " : "" )
72-
& ( len( mappings.inspect ) ? "(#mappings.inspect#)" : ""), true );
66+
try {
67+
admin
68+
action="getMappings"
69+
type="web"
70+
password="#request.adminPassword#"
71+
returnVariable="mappings";
72+
73+
loop query="mappings" {
74+
systemOutput("#mappings.virtual# #chr( 9 )# #mappings.strPhysical# "
75+
& ( len( mappings.strArchive ) ? "[#mappings.strArchive#] " : "" )
76+
& ( len( mappings.inspect ) ? "(#mappings.inspect#)" : ""), true );
77+
}
78+
79+
} catch( e ){
80+
systemOutput( e.message, true );
7381
}
82+
systemOutput( "ExpandPath( '/' ) #chr(9)# #ExpandPath( '/' )#" , true );
7483
7584
param name="extensionDir" default="";
7685
if ( len( extensionDir) ){
@@ -195,6 +204,6 @@
195204
}
196205
]]>
197206
</script>
198-
<echots message="Lucee Stopping"/>
207+
<echots message="Lucee Stopping" />
199208
</target>
200-
</project>
209+
</project>

build.xml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
<property name="luceeCFconfig" value=""/>
2121
<!-- enable java debugging -->
2222
<property name="debugger" value=""/>
23+
<property name="cleanup" value="true"/>
24+
<property name="setAdminPassword" value="true"/>
25+
<property name="adminPassword" value="admin"/>
2326

2427
<!-- scripts can be run as an include, or via internalRequest (default) which picks up any Application.cfc -->
2528
<property name="executeScriptByInclude" value=""/>
@@ -85,6 +88,8 @@
8588
<echo message="executeScriptByInclude: ${executeScriptByInclude}" />
8689
<echo message="luceeCFconfig: ${luceeCFconfig}" />
8790
<echo message="javaDebugger: ${debugger}" />
91+
<echo message="setAdminPassword: ${setAdminPassword}" />
92+
<echo message="adminPassword: ${adminPassword}" />
8893

8994
<echo message="" />
9095
<!-- execute CFML testcases -->
@@ -114,6 +119,9 @@
114119
<jvmarg value="-Dlucee.extensions=${extensions}"/>
115120
<jvmarg value="-Dlucee.mapping.first=true"/>
116121
<jvmarg value="-Dcompile=${compile}"/>
122+
<jvmarg value="-DsetAdminPassword=${setAdminPassword}"/>
123+
<jvmarg value="-DadminPassword=${adminPassword}"/>
124+
117125
<!--
118126
<jvmarg value="-Dlucee.cli.printExceptions=true"/>
119127
-->
@@ -131,7 +139,7 @@
131139
-->
132140
</java>
133141
<echo>${errorOut}</echo>
134-
<delete dir="${temp}"/>
142+
<delete dir="${temp}" if:true="${cleanup}"/>
135143
<echo message="Finished!" />
136144
</target>
137145
</project>

0 commit comments

Comments
 (0)