2010年11月2日星期二

Re: [fw-auth] Mimic a user

On Tuesday 02 Nov 2010 00:55:25 monk.e.boy wrote:
> I was thinking of extending Zend_Auth_Adapter_DbTable so it would respond
> with the user name when I am mimicing them? Should I be looking at ACL?
>
> How do you guys solve this?

This function is most time called impersonating. It means you appears to be
another user for the system.

Zend_Auth takes care of authentication ("Who are you?") so impersonating is
typically a Zend_Auth part. ACL asks the question "Are you allowed to ...?",
which is not the case here (only the question whether a user is allowed to
impersonate.

Zend_Auth has all kind of storage adapters, but apply the
Zend_Auth_Adapter_Interface. This has a method write(), which write the
identity into persistence (often a session).

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

You might want to store your current identity into another session. When you
log out, you become your old admin user again.

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

2010年11月1日星期一

Re: [fw-auth] Mimic a user

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

>
> Hi,
>
> When I log in as admin I would like to be able to choose a user and then
> sort of be them, but with an extra admin tool bar.
>
> I do a lot of this:
>
> $u = Doctrine::getTable('User')
> ->createQuery('u')
> ->where('u.email=?');
>
> $user = $u->fetchOne(array(
> Zend_Auth::getInstance()->getIdentity()
> ), Doctrine_Core::HYDRATE_RECORD);
>
> I was thinking of extending Zend_Auth_Adapter_DbTable so it would respond
> with the user name when I am mimicing them? Should I be looking at ACL?
>
> How do you guys solve this?
>
> Many thanks,
>
> monk.e.boy
> --
> View this message in context:
> http://zend-framework-community.634137.n4.nabble.com/Mimic-a-user-tp3023001p3023001.html
> Sent from the Zend Auth mailing list archive at Nabble.com.
>
>
Hi my solution is not ZF specific.
For this functionality, we just save your original session object into a
custom session variable, and fill your session for the given user.
We have a little piece of code, which can revert your original session
object from the custom session variable.

With this solution, you will be seen by the system as the original user.

Tyrael

Re: [fw-webservices] Looking for jsonrpc client

-- 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. :-(

--
Matthew Weier O'Phinney
Project Lead | matthew@zend.com
Zend Framework | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc

[fw-auth] Re: Mimic a user

I'm also curious about people's solutions to this kind of problem.

I suppose one solution would be to have a "master" and "slave" account. The
master account would be the admin user, and the slave account would be the
user you're mimicking. When accessing a page, your ACL could check against
the slave account first, and then check against the master account if access
fails.

You could then have the toolbar injected into a placeholder by a controller
plugin if the master account role is admin or whatever.

Haven't actually tried it though.

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

[fw-auth] Mimic a user

Hi,

When I log in as admin I would like to be able to choose a user and then
sort of be them, but with an extra admin tool bar.

I do a lot of this:

$u = Doctrine::getTable('User')
->createQuery('u')
->where('u.email=?');

$user = $u->fetchOne(array(
Zend_Auth::getInstance()->getIdentity()
), Doctrine_Core::HYDRATE_RECORD);

I was thinking of extending Zend_Auth_Adapter_DbTable so it would respond
with the user name when I am mimicing them? Should I be looking at ACL?

How do you guys solve this?

Many thanks,

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

[fw-webservices] Looking for jsonrpc client

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.)

TIA,

--

Don Dwiggins
Advanced Publishing Technology

[fw-db] Re: lastInsertId() not working?

Just after

$row->save();

to get the last inser id, simply do

$id = $row->id // (id is the name of the primary key)


--
View this message in context: http://zend-framework-community.634137.n4.nabble.com/lastInsertId-not-working-tp949153p3022414.html
Sent from the Zend DB mailing list archive at Nabble.com.