avoid npe when admin user has not been created

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1360435 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-07-11 22:02:51 +00:00
parent cd03511cc9
commit 450f03a6a6
5 changed files with 18 additions and 19 deletions

View File

@ -808,7 +808,8 @@
<appserver.base>${archivaAppServerBase}</appserver.base> <appserver.base>${archivaAppServerBase}</appserver.base>
<appserver.home>${archivaAppServerBase}</appserver.home> <appserver.home>${archivaAppServerBase}</appserver.home>
<derby.system.home>${archivaAppServerBase}/logs</derby.system.home> <derby.system.home>${archivaAppServerBase}/logs</derby.system.home>
<redback.admin.creation.file>${basedir}/target/auto-admin-creation.properties</redback.admin.creation.file> <!-- remove admin auto creation that must be tested too -->
<!--redback.admin.creation.file>${basedir}/target/auto-admin-creation.properties</redback.admin.creation.file-->
<java.io.tmpdir>${project.build.directory}</java.io.tmpdir> <java.io.tmpdir>${project.build.directory}</java.io.tmpdir>
<archiva.user.configFileName>${archivaAppServerBase}/conf/archiva.xml</archiva.user.configFileName> <archiva.user.configFileName>${archivaAppServerBase}/conf/archiva.xml</archiva.user.configFileName>
<archiva.devMode>${archiva.devMode}</archiva.devMode> <archiva.devMode>${archiva.devMode}</archiva.devMode>

View File

@ -148,9 +148,6 @@
} }
}); });
require(['jquery','i18n','sammy','startup','utils','domReady!'], function (domReady) { require(['jquery','i18n','sammy','startup','utils','domReady!'], function (domReady) {
loadi18n(function () { loadi18n(function () {
$.ajax({ $.ajax({
@ -166,9 +163,6 @@
startArchivaApplication(); startArchivaApplication();
$("#loadingDiv").hide(); $("#loadingDiv").hide();
}) })
} }
}) })
}) })

View File

@ -269,7 +269,8 @@ function() {
}); });
this.get('#:folder', function () { this.get('#:folder', function () {
self.activeMenuId(this.params.folder); self.activeMenuId(this.params.folder);
ko.utils.arrayFirst(self.artifactMenuItems.concat(self.usersMenuItems, self.administrationMenuItems), function(p) { var baseItems = self.artifactMenuItems?self.artifactMenuItems:[];
ko.utils.arrayFirst(baseItems.concat(self.usersMenuItems, self.administrationMenuItems), function(p) {
if ( p.href == "#"+self.activeMenuId()) { if ( p.href == "#"+self.activeMenuId()) {
p.func(); p.func();
return; return;
@ -277,12 +278,17 @@ function() {
}); });
}); });
this.get('#open-admin-create-box',function(){
$.log("#open-admin-create-box");
adminCreateBox();
});
//this.get('', function () { this.app.runRoute('get', '#search') }); //this.get('', function () { this.app.runRoute('get', '#search') });
} ); } );
sammyArchivaApplication.run(); sammyArchivaApplication.run();
} }
startArchivaApplication=function(){ startArchivaApplication=function(){
$.log("startArchivaApplication"); $.log("startArchivaApplication");
$('#topbar-menu-container').html($("#topbar_menu_tmpl" ).tmpl()); $('#topbar-menu-container').html($("#topbar_menu_tmpl" ).tmpl());
$('#sidebar-content').html($("#main_menu_tmpl").tmpl()); $('#sidebar-content').html($("#main_menu_tmpl").tmpl());
@ -292,6 +298,7 @@ function() {
$(element).attr("redback-permissions",valueAccessor); $(element).attr("redback-permissions",valueAccessor);
} }
}; };
ko.applyBindings(new MainMenuViewModel()); ko.applyBindings(new MainMenuViewModel());
hideElementWithKarma(); hideElementWithKarma();
@ -299,8 +306,6 @@ function() {
checkCreateAdminLink(); checkCreateAdminLink();
$('#footer-content').html($('#footer-tmpl').tmpl(window.archivaRuntimeInfo)); $('#footer-content').html($('#footer-tmpl').tmpl(window.archivaRuntimeInfo));
$( "#quick-search-autocomplete" ).autocomplete({ $( "#quick-search-autocomplete" ).autocomplete({
minLength: 3, minLength: 3,
delay: 600, delay: 600,

View File

@ -28,7 +28,6 @@
<a data-bind="text: text, attr: { id: id, href: href}"></a> <a data-bind="text: text, attr: { id: id, href: href}"></a>
</li> </li>
<!-- /ko --> <!-- /ko -->
</ul> </ul>
<ul class="nav nav-list" redback-permissions="{permissions: ['archiva-manage-configuration']}" data-bind="foreach: administrationMenuItems"> <ul class="nav nav-list" redback-permissions="{permissions: ['archiva-manage-configuration']}" data-bind="foreach: administrationMenuItems">
@ -65,7 +64,7 @@
<div id="organisation-logo" class="pull-left"></div> <div id="organisation-logo" class="pull-left"></div>
<ul class="nav pull-right"> <ul class="nav pull-right">
<li id="create-admin-link" style="display: none"> <li id="create-admin-link" style="display: none">
<a href="#" onclick="adminCreateBox();" id="create-admin-link-a"> <a href="#open-admin-create-box" onclick="adminCreateBox();" id="create-admin-link-a">
<span class="label label-important">${$.i18n.prop('create.admin.page.link')}</span> <span class="label label-important">${$.i18n.prop('create.admin.page.link')}</span>
</a> </a>
</li> </li>

View File

@ -22,7 +22,7 @@
username="sa" username="sa"
password="" password=""
driverClassName="org.apache.derby.jdbc.EmbeddedDriver" driverClassName="org.apache.derby.jdbc.EmbeddedDriver"
url="jdbc:derby:${catalina.base}/target/database/users;create=true" url="jdbc:derby:${appserver.base}/database/users;create=true"
/> />
<Resource name="mail/Session" auth="Container" <Resource name="mail/Session" auth="Container"
type="javax.mail.Session" type="javax.mail.Session"