Page tree
Skip to end of metadata
Go to start of metadata

Your Rating: Results: 1 Star2 Star3 Star4 Star5 Star 161 rates

A step-by-step guide on how to recreate a default user account (superuser, rebootstrapping from xml) in case of troubleshooting can be found at Reset superuser account page.

If for some reason your anonymous user can't be loaded anymore, this script should help, if applied as per Executing fix scripts. Recreating the superuser is very similar, just get the correct bootstrap files (wink)

Anonymous user :

<%@ page contentType="text/plain" %>
<%@ page import="info.magnolia.importexport.BootstrapUtil"%>
<%@ page import="info.magnolia.context.MgnlContext"%>
<%@ page import="javax.jcr.ImportUUIDBehavior"%>
<%
  MgnlContext.setInstance(MgnlContext.getSystemContext());
  BootstrapUtil.bootstrap(new String[]{"/mgnl-bootstrap/core/users.system.anonymous.xml"}, ImportUUIDBehavior.IMPORT_UUID_COLLISION_REPLACE_EXISTING);
  MgnlContext.getJCRSession("users").save();
%>
Executed Successfully

Anonymous role :

<%@ page contentType="text/plain" %>
<%@ page import="info.magnolia.importexport.BootstrapUtil"%>
<%@ page import="info.magnolia.context.MgnlContext"%>
<%@ page import="javax.jcr.ImportUUIDBehavior"%>
<%
  MgnlContext.setInstance(MgnlContext.getSystemContext());

// on an author instance:
  BootstrapUtil.bootstrap(new String[]{"/path/to/userroles.anonymous.xml"}, ImportUUIDBehavior.IMPORT_UUID_COLLISION_REPLACE_EXISTING);

// on an public instance:
  BootstrapUtil.bootstrap(new String[]{"/path/to/public/userroles.anonymous.xml"}, ImportUUIDBehavior.IMPORT_UUID_COLLISION_REPLACE_EXISTING);


  MgnlContext.getJCRSession("userroles").save();
%>
  • No labels

3 Comments

  1. Beware that, as of Magnolia v4.0.1, the utility explained above, ModuleUtil, no longer works - see the release notes.

    In my case, all I needed to do was to restore the anonymous account's password to its default value. That default value is anonymous.

    1. You can use info.magnolia.importexport.BootstrapUtil instead.

  2. Since by now most of the people should use 4.0.1 or higher, I've changed the default script to use the current code.