Author Topic

Paul Leclercq

Thursday 20 May 2010 4:29:06 am

Comment59219

Hello Quentin,

>> Instead of getting the current user, I get 'anonymous' all the time... :/

We also faced this issue once in the past, our issue was to create multiple uploads in the backoffice, also using 2 extensions, which had different rights.

The ajax would recreate an anonymous user to deal with the request.

I believe there are 2 workarounds for this issue

1) either you give anonymous access, to this function which will allow you to transfert the data as you which.

Or else

2) you send your users ID, and reconnect with the user you wish to use using
$user = eZUser::fetchByName( $userLogin );
$user->loginCurrent();
Then replace the session variable with the initial one, which you can send in your ajax request.

I believe that if this function, is not highly critical, the first workaround may be the simplest