Author: tmortagne Date: 2008-02-27 11:23:08 +0100 (Wed, 27 Feb 2008) New Revision: 7990
Modified: xwiki-platform/xwiki-plugins/trunk/wiki-manager/src/main/java/com/xpn/xwiki/plugin/wikimanager/WikiManagerMessageTool.java xwiki-platform/xwiki-plugins/trunk/wiki-manager/src/main/java/com/xpn/xwiki/plugin/wikimanager/doc/Wiki.java xwiki-platform/xwiki-plugins/trunk/wiki-manager/src/main/resources/wikimanager/ApplicationResources.properties Log: XAWM-56: Main wiki should not be deletable Modified: xwiki-platform/xwiki-plugins/trunk/wiki-manager/src/main/java/com/xpn/xwiki/plugin/wikimanager/WikiManagerMessageTool.java =================================================================== --- xwiki-platform/xwiki-plugins/trunk/wiki-manager/src/main/java/com/xpn/xwiki/plugin/wikimanager/WikiManagerMessageTool.java 2008-02-27 09:40:39 UTC (rev 7989) +++ xwiki-platform/xwiki-plugins/trunk/wiki-manager/src/main/java/com/xpn/xwiki/plugin/wikimanager/WikiManagerMessageTool.java 2008-02-27 10:23:08 UTC (rev 7990) @@ -149,6 +149,13 @@ "wikimanager.plugin.error.wikitemplatealiasdoesnotexists"; /** + * Used as [EMAIL PROTECTED] WikiManagerException} message when trying to delete the main wiki. + * + * @since 1.1 + */ + public static final String ERROR_DELETEMAINWIKI = "wikimanager.plugin.error.deletemainwiki"; + + /** * Used as [EMAIL PROTECTED] org.apache.commons.logging.Log} log message when trying to create a new wiki * with a wiki descriptor that already exist. */ Modified: xwiki-platform/xwiki-plugins/trunk/wiki-manager/src/main/java/com/xpn/xwiki/plugin/wikimanager/doc/Wiki.java =================================================================== --- xwiki-platform/xwiki-plugins/trunk/wiki-manager/src/main/java/com/xpn/xwiki/plugin/wikimanager/doc/Wiki.java 2008-02-27 09:40:39 UTC (rev 7989) +++ xwiki-platform/xwiki-plugins/trunk/wiki-manager/src/main/java/com/xpn/xwiki/plugin/wikimanager/doc/Wiki.java 2008-02-27 10:23:08 UTC (rev 7990) @@ -50,6 +50,12 @@ */ public void delete(boolean deleteDatabase) throws XWikiException { + if (getWikiName().equals(context.getMainXWiki())) { + throw new WikiManagerException(XWikiException.ERROR_XWIKI_ACCESS_DENIED, + WikiManagerMessageTool.getDefault(context).get( + WikiManagerMessageTool.ERROR_DELETEMAINWIKI, getWikiName())); + } + if (hasAdminRights()) { this.context.getWiki().getStore().deleteWiki(getWikiName(), context); } else { Modified: xwiki-platform/xwiki-plugins/trunk/wiki-manager/src/main/resources/wikimanager/ApplicationResources.properties =================================================================== --- xwiki-platform/xwiki-plugins/trunk/wiki-manager/src/main/resources/wikimanager/ApplicationResources.properties 2008-02-27 09:40:39 UTC (rev 7989) +++ xwiki-platform/xwiki-plugins/trunk/wiki-manager/src/main/resources/wikimanager/ApplicationResources.properties 2008-02-27 10:23:08 UTC (rev 7990) @@ -17,6 +17,7 @@ wikimanager.plugin.error.righttodeletewiki=You don't have right to delete wiki [{0}] wikimanager.plugin.error.wikialiasdoesnotexists=Wiki alias [{0}] document does not exist wikimanager.plugin.error.wikitemplatealiasdoesnotexists=Wiki template alias [{0}] document does not exist +wikimanager.plugin.error.deletemainwiki=Can't delete main wiki # log wikimanager.plugin.log.createwiki.userdoesnotexist=Wiki [{0}] creation failed: user does not exist _______________________________________________ notifications mailing list notifications@xwiki.org http://lists.xwiki.org/mailman/listinfo/notifications