}
public void init() {
if (isManaged()) {
if (!Identity.instance().hasPermission("User", "edit", getInstance()) ) {
throw new AuthorizationException("You don't have permission for this operation");
}
if (roles == null) roles = getInstance().getRoles();
if (oldUsername == null) oldUsername = getInstance().getUsername();
createdWikiNodeCount = userDAO.countNodesCreatedBy(getInstance().getId());
uploader = (Uploader)Component.getInstance(Uploader.class);
} else {
if (!prefs.getEnableRegistration() &&
!Identity.instance().hasPermission("User", "isAdmin", Component.getInstance("currentUser"))) {
throw new AuthorizationException("User registration is disabled");
}
if (defaultRole == null) defaultRole = (Role)Component.getInstance("newUserDefaultRole");
}