Since some of the core nodeapi functions (eg, path_nodeapi()), call user_access, things like this:

nodes[foo][path] = foo

aren't working. This patch fakes $user->uid = 1 prior to calling node_save(). Not sure if this should be more general, or performed at a higher level, but it works for the example above.

CommentFileSizeAuthor
profiler.user_access.patch840 bytesjhedstrom

Comments

q0rban’s picture

Version: 6.x-2.0-beta1 » 6.x-2.x-dev

I'm concerned about other implications of this. Are you using this patch with success?

jhedstrom’s picture

Status: Needs review » Needs work

I've used this on several projects without any obvious ill-effect.

It seems like the proper way to do this, is to determine when in the installation process Drupal is setting uid = 1 (since upon completion, the user is logged in as uid 1), and then perform these tasks after that--if possible.

jhedstrom’s picture

Status: Needs work » Needs review

Changing back to needs review--just ran into this issue again on a 6.x project.

q0rban’s picture

Status: Needs review » Needs work

This still terrifies me. :) We should at least clean up after ourselves by setting the $user object back the way it was.