2010年11月4日星期四

[fw-db] Nasted transactions

When I have nasted transactions I get exception 'PDOException' with message
'There is already an active transaction' in...

Sometimes it's hard to track transactional methods in models, and there is
no way to detect if a transaction is started already.

Why don't add a flag in db adapter when start transaction, and set it on
begin, reset it on roll back and commit?
http://framework.zend.com/issues/browse/ZF-870

What are the best practices for organizing transactions in zf app?
--
View this message in context: http://zend-framework-community.634137.n4.nabble.com/Nasted-transactions-tp3028213p3028213.html
Sent from the Zend DB mailing list archive at Nabble.com.

2010年11月3日星期三

Re: [fw-webservices] Soap Server does not uses getLastRequest

On 2 November 2010 21:01, pal4life <nadir.com@gmail.com> wrote:
>
> Hi,
> http://framework.zend.com/manual/1.11/en/zend.soap.server.html
>
> The above link shows an example of logging requests on the SOAP server using
> the getLastRequest. I am aware of using it with the client but is there a
> way to log those request with the server?
>
>  $this->getHelper('viewRenderer')->setNoRender(true);
>
>          // initialize server and set WSDL file location
>      $server = new Zend_Soap_Server('wsdl location');
>
>      // initialize server and set URI
>      //$server = new Zend_Soap_Server(null,
>  //       array('uri' => 'http://webservices.tjh2b.com/Labrequest/soap'));
>
>      // set SOAP service class
>      $server->setClass('Webservices_Manager');
>
>                $server->setRequest();
>
>
>      // register exceptions that generate SOAP faults
>      $server->registerFaultException(array('Webservices_Exception'));
>
>      // handle request
>      $server->handle();
>
>        echo $request = $server->getLastRequest();
>
> Thank you.
>
>
> --
> View this message in context: http://zend-framework-community.634137.n4.nabble.com/Soap-Server-does-not-uses-getLastRequest-tp3024416p3024416.html
> Sent from the Zend Web Services mailing list archive at Nabble.com.
>

I would create a subclass to Zend_Soap_Server and override _setRequest ...

class myZSS extends Zend_Soap_Server {
/**
* Set and log the request.
*
* $request may be any of:
* - DOMDocument; if so, then cast to XML
* - DOMNode; if so, then grab owner document and cast to XML
* - SimpleXMLElement; if so, then cast to XML
* - stdClass; if so, calls __toString() and verifies XML
* - string; if so, verifies XML
*
* @param DOMDocument|DOMNode|SimpleXMLElement|stdClass|string $request
* @return Zend_Soap_Server
*/
protected function _setRequest($request) {
// Set the request.
parent::_setRequest($request);

// Log the request.
// $this->_getRequest() is the call to make to get the XML.

// Return the instance to allow for chaining.
return $this;
}
}

--
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

2010年11月2日星期二

[fw-webservices] Soap Server does not uses getLastRequest

Hi,
http://framework.zend.com/manual/1.11/en/zend.soap.server.html

The above link shows an example of logging requests on the SOAP server using
the getLastRequest. I am aware of using it with the client but is there a
way to log those request with the server?

$this->getHelper('viewRenderer')->setNoRender(true);

// initialize server and set WSDL file location
$server = new Zend_Soap_Server('wsdl location');

// initialize server and set URI
//$server = new Zend_Soap_Server(null,
// array('uri' => 'http://webservices.tjh2b.com/Labrequest/soap'));

// set SOAP service class
$server->setClass('Webservices_Manager');

$server->setRequest();


// register exceptions that generate SOAP faults
$server->registerFaultException(array('Webservices_Exception'));

// handle request
$server->handle();

echo $request = $server->getLastRequest();

Thank you.


--
View this message in context: http://zend-framework-community.634137.n4.nabble.com/Soap-Server-does-not-uses-getLastRequest-tp3024416p3024416.html
Sent from the Zend Web Services mailing list archive at Nabble.com.

[fw-webservices] Re: Looking for jsonrpc client

On 11/1/2010 10:27 PM, Matthew Weier O'Phinney wrote:
> -- Don Dwiggins<ddwiggins@advpubtech.com> wrote
> (on Monday, 01 November 2010, 11:38 AM -0700):
>> I have an application in which a Zend Framework client communicates
>> with a server via XMLRPC, using the ZF xmlrpc client. I want to
>> convert to using JSON. Does anyone know of a JSONRPC client, either
>> within ZF or just a PHP implementation? (The ZF library includes a
>> server, but not a client.)
> I'm not aware of one at this time; I do have a JSON-RPC client on my
> todo list for ZF2... but that likely won't be soon enough for you. :-(

My colleague found one:
http://project.voidwalkers.nl/repositories/annotate/fizzy/library/Fizzy/Json/Client.php?rev=695f4c7ae094545d17d4486aeac124fab3c3e4f5.
I haven't had a chance to look at it, but it worked well enough for her
to get some timings (jsonrpc turned out to be about two orders of
magnitude faster than xmlrpc). Maybe it'll be of some use to you...


--

Don Dwiggins
Advanced Publishing Technology

Re: [fw-auth] Re: Mimic a user

On Tuesday 02 Nov 2010 12:13:35 monk.e.boy wrote:
> Jurian Sluiman wrote:
> > So the only thing you need to do is:
> > $username = $myOtherUser->username;
> > Zend_Auth::getInstance()->getAdapter()->write($username);
>
> That is very interesting as it is what I started doing. How would I show
> the admin toolbar on the users home page?
>
> I assume as well as impersonating them (and saving my original admin login
> details) I would need to elevate that user to have the same privilidges as
> the original admin user? Then show the toolbar (and validate all the admin
> actions) using $acl->isAllowed(...) ?
>
> Thank you for the help :)
>
> monk.e.boy

The idea is you appear to be that user. So you don't see the admin-bar and you
don't have admin privileges. But if you save your admin's identity it's
possible to return to that state when you logout.

Regards, Jurian
--
Jurian Sluiman
Soflomo - http://soflomo.com

Re: [fw-auth] Re: Mimic a user

Just like to point at that this conversation shows a very common problem
I've experienced in any software development. Your application should have
an internal API which is abstracted away from the infrastructure.

Zend_Auth is infrastructure.

What you should have is a an API like UserServiceInterface with a method
login which takes care of signing in a user. The interface doesn't care how
that's done.

Once you have this internal API, all you would do sign on another user would
be something like

$userService->login($user_id);

However bad wordpress's code maybe, this is one thing they got right. To
implement a "sign on as a user" is just a matter of calling one function
with a user id.

Not I'm not answering the question, just pointing out a
potential architectural flaw.

On Tue, Nov 2, 2010 at 7:13 AM, monk.e.boy <john@teethgrinder.co.uk> wrote:

>
>
> Jurian Sluiman wrote:
> >
> >
> > So the only thing you need to do is:
> > $username = $myOtherUser->username;
> > Zend_Auth::getInstance()->getAdapter()->write($username);
> >
> >
>
> That is very interesting as it is what I started doing. How would I show
> the
> admin toolbar on the users home page?
>
> I assume as well as impersonating them (and saving my original admin login
> details) I would need to elevate that user to have the same privilidges as
> the original admin user? Then show the toolbar (and validate all the admin
> actions) using $acl->isAllowed(...) ?
>
> Thank you for the help :)
>
> monk.e.boy
>
> --
> View this message in context:
> http://zend-framework-community.634137.n4.nabble.com/Mimic-a-user-tp3023001p3023533.html
> Sent from the Zend Auth mailing list archive at Nabble.com.
>
>

[fw-auth] Re: Mimic a user

Jurian Sluiman wrote:
>
>
> So the only thing you need to do is:
> $username = $myOtherUser->username;
> Zend_Auth::getInstance()->getAdapter()->write($username);
>
>

That is very interesting as it is what I started doing. How would I show the
admin toolbar on the users home page?

I assume as well as impersonating them (and saving my original admin login
details) I would need to elevate that user to have the same privilidges as
the original admin user? Then show the toolbar (and validate all the admin
actions) using $acl->isAllowed(...) ?

Thank you for the help :)

monk.e.boy

--
View this message in context: http://zend-framework-community.634137.n4.nabble.com/Mimic-a-user-tp3023001p3023533.html
Sent from the Zend Auth mailing list archive at Nabble.com.