Forums / Developer / Changing siteaccess during script execution

Changing siteaccess during script execution

Author Message

Jérôme Vieilledent

Tuesday 27 April 2010 5:17:55 am

Hi all

I'd like to know if it was possible to switch from one siteaccess to another in a script (or cronjob) ?

Thanks :)

Philippe VINCENT-ROYOL

Tuesday 27 April 2010 5:25:46 am

Try to use eZScript::setUseScriptAccess

http://pubsvn.ez.no/doxygen/4.2/html/classeZScript.html#a8e1752784523828149496dd029079c4b

Phil

Certified Developer (4.1): http://auth.ez.no/certification/verify/272607
Certified Developer (4.4): http://auth.ez.no/certification/verify/377321

G+ : http://plus.tl/dspe
Twitter : http://twitter.com/dspe

Matthieu Sévère

Tuesday 27 April 2010 5:29:59 am

Yes but this has to be executed before $script->initialize(); thus you will not be able use it during the execution of a cronjob for exemple or a script launched with ezexec.php

--
eZ certified developer: http://ez.no/certification/verify/346216

Jérôme Vieilledent

Tuesday 27 April 2010 5:31:55 am

Indeed, what I need to do is several tasks for every siteaccesses present in my conf. So unfortunately I won't be able to use this trick :(

Philippe VINCENT-ROYOL

Tuesday 27 April 2010 5:40:41 am

hum during script execution, is it not possible to do something like that :

require_once( "access.php" );

$script->SiteAccess = "mySiteAccess";

$access = array( 'name' => 'mySiteAcess', type' => EZ_ACCESS_TYPE_STATIC );

$access = changeAccess( $access );

Certified Developer (4.1): http://auth.ez.no/certification/verify/272607
Certified Developer (4.4): http://auth.ez.no/certification/verify/377321

G+ : http://plus.tl/dspe
Twitter : http://twitter.com/dspe

Jérôme Vieilledent

Wednesday 19 May 2010 1:56:56 am

Hi Philippe

Thanks for your reply. Indeed, it should work as this is the same code used in eZScript::initialize().

Thanks for your help !