Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8921715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T06:37:30+00:00 2026-06-15T06:37:30+00:00

i am creating a cakephp application that should allow admin to login as any

  • 0

i am creating a cakephp application that should allow admin to login as any user in the site without knowing the password. Basically if admin wants to login as a manager, he can simply click a button to login as a manager.

thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T06:37:31+00:00Added an answer on June 15, 2026 at 6:37 am

    I call this user-switching. I implemented this using my DirectAuth:
    https://github.com/dereuromark/cakephp-tools/blob/cake2/Controller/Component/Auth/DirectAuthenticate.php

    But you can also simply

    a) login as admin

    b) have a form with all users to select the one you want to switch to

    c) switch via POST, read the user + $this->Auth->login($userData)

    login() with data passed will overwrite the current session data and therefore automatically log you in as this user.
    just make sure that only the admin role can access the switch action.

    side notes:

    • store sth like Auth.Admin.id in the session if you want to be able to switch back (will remember the original Auth.User.id) – if existent this id could then also have access to the switch action to jump back to the admin.

    • use this Auth.Admin.id to identify wether you are currently the real one or the fake one. this is handy if you do NOT want to trigger certain things like "online activity update" or "message read" etc which only the real user should IMO. this way you can prevent this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm creating a web application using cakephp 1.2.6. There is a functionality that I
I have a CakePHP 1.3 application that has a login system, which works well.
I'm creating a web application that will use multiple types of users (e.g. Admin,
I am creating a Cakephp Application.. My problem is my Jquery work well when
I have a cakePhp application built, and now I'm creating a simple blog based
Creating liquid layouts is an immense pain. Now, I totally understand that tables should
We have an old (written in CakePHP 1.1!) application that has started groaning under
I'm creating a web application for work where the user has to enter the
In my CakePHP application I am creating a session variable in some controller, which
i am using cakephp and creating this condition: $conditions = array(Userword.levelid=>0, Userword.userid=>$this->Auth->user('UserId'),date(Userword.date)=>DATE_SUB(CURDATE(),INTERVAL 0 DAY));

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.