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.
>
>
没有评论:
发表评论