In-Portal Issue Tracker - In-Portal CMS
Viewing Issue Advanced Details
1105 [In-Portal CMS] Admin Interfaces feature request always 2011-08-20 15:58 2012-07-25 05:33
none 5.2.0-B1
Add "login as user" button to user list in Admin
0001105: Add "Login as User" button to user list in Admin
Add "Login As" button to user list in Admin which will help admins to see how any particular user sees the website by logging in as selected user.

Button will login that user (without admin knowing his password) in a separate popup window.
1. create u:OnLoginAs event, that will be called from Front-end and will login user by ID given in URL
2. in CheckPermission for u:OnLoginAs event we will get logged-in user's ID from Admin Console; if user is valid, then allow login
3. in users grid add toolbar button "Login As", that will open front-end url with u:OnLoginAs event with user id from first selected user in grid
4. when there are more then 1 record selected, then display alert message to admin, that he must select only 1 user
related to 0001081closed  (5.1.3)alex Logout link broken 
patch login_as_user_1105.patch (6,842) 2011-10-06 10:05
patch login_as_user_1105.2.patch (6,972) 2011-10-11 09:30
patch login_as_user_1105.3.patch (6,928) 2011-10-11 12:29
patch login_as_user_v4.patch (11,565) 2011-10-12 05:56
Issue History
2012-07-25 05:33 alex Note Added: 0005113
2012-07-25 05:33 alex Status resolved => closed
2011-10-22 05:27 alex Estimate Points => 2
2011-10-12 05:57 alex Changeset attached 5.2.x r14663
2011-10-12 05:57 alex Note Added: 0004046
2011-10-12 05:57 alex Status reviewed and tested => resolved
2011-10-12 05:57 alex Fixed in Version => 5.2.0-B1
2011-10-12 05:57 alex Resolution open => fixed
2011-10-12 05:57 alex Assigned To !COMMUNITY => alex
2011-10-12 05:57 alex Note Added: 0004045
2011-10-12 05:56 alex File Added: login_as_user_v4.patch
2011-10-12 04:52 alex Relationship added related to 0001081
2011-10-11 14:39 alex Assigned To alex => !COMMUNITY
2011-10-11 14:39 alex Status needs testing => reviewed and tested
2011-10-11 12:31 erik Note Added: 0004041
2011-10-11 12:31 erik Assigned To erik => alex
2011-10-11 12:31 erik Status needs work => needs testing
2011-10-11 12:29 erik File Added: login_as_user_1105.3.patch
2011-10-11 10:00 alex Note Added: 0004040
2011-10-11 10:00 alex Assigned To alex => erik
2011-10-11 10:00 alex Status needs testing => needs work
2011-10-11 09:31 erik Note Added: 0004039
2011-10-11 09:31 erik Assigned To erik => alex
2011-10-11 09:31 erik Status needs work => needs testing
2011-10-11 09:30 erik File Added: login_as_user_1105.2.patch
2011-10-06 14:18 Dmitry Note Edited: 0004035 bug_revision_view_page.php?bugnote_id=0004035#r868
2011-10-06 11:18 alex Note Added: 0004035
2011-10-06 11:18 alex Assigned To alex => erik
2011-10-06 11:18 alex Status needs testing => needs work
2011-10-06 10:05 erik Time Estimate Removed 2 =>
2011-10-06 10:05 erik Note Added: 0004032
2011-10-06 10:05 erik Assigned To erik => alex
2011-10-06 10:05 erik Developer => erik
2011-10-06 10:05 erik Status needs work => needs testing
2011-10-06 10:05 erik File Added: login_as_user_1105.patch
2011-10-04 20:18 Dmitry Note Added: 0004007
2011-10-04 20:18 Dmitry Assigned To => erik
2011-10-04 20:18 Dmitry Status active => needs work
2011-09-26 08:24 Dmitry Note Added: 0003914
2011-09-26 05:05 alex Note Deleted: 0003912
2011-09-26 05:05 alex Additional Information Updated bug_revision_view_page.php?rev_id=849#r849
2011-09-26 05:04 alex Time Estimate Added 2
2011-09-26 05:04 alex Note Added: 0003912
2011-08-20 15:58 Dmitry New Issue
2011-08-20 15:58 Dmitry Reference =>
2011-08-20 15:58 Dmitry Change Log Message => Add "login as user" button to user list in Admin

2011-09-26 08:24   
We have it in Resumark for sure!
2011-10-04 20:18   
Erik, please review and take from Pasttimes project.

Make sure to add new HIDE new button in Simple System preset
2011-10-06 10:05   
patch attached - needs testing
2011-10-06 11:18   
(edited on: 2011-10-06 14:18)
1. There is no need for getFirstSelected JavaScript method, since Grid class already has a method to get all selected IDs in grid. Grid class object can be accesed via Grids['prefix.special'] construct. I've created a "code review" (in the past) for you about another project with exactly same problem.

2. There is no need to add additional parameters to m_Link tag result, when they can be incorporated within it. Please move user_event into m_Link tag parameters. Also there is no need to use "events[u]" form for event setting (please use u_event standard way).

3. Not all phrases used in this patch have been added into language pack (english.lang file).

4. All phrases in language pack should be alphabetically sorted. I've reported this problem in another 2 tasks already.

5. Please use method of verifying admin session, used for "Browse Mode" processing (the one in kApplication::Run method for detecting if admin is logged-in or not) and not create new method, like you did with _hasAdminSession.

6. Using loginUserById method alone to login user won't properly set it's groups to session. Please look into ActivateUser tag to find a way how it should be properly done.

2011-10-11 09:31   
login_as_user_1105.2.patch attached - needs testing
2011-10-11 10:00   
1. Please don't try to create non-obvious code, where it can be obvious.
For example code
if (Grids['u.regular'].GetSelected()[1]) {

should be literally checking if there was more then 1 user selected, then why checking for 2nd array element presence, when direct check can be made (which looks more obvious to the one who don't know how it should work):

if ( Grids['u.regular'].GetSelected().length > 1 ) {

2. Don't just copy/paste code, when there could a way to do it more effieciently, e.g. by using already existing method to do the job. For example code:

$user = (int)$admin_session->RecallVar('user_id');
return ($user != 0);

could be replaced with:

return $admin_session->LoggedIn();

3. Don't create intermidiate variables, when you plan to use then only once, e.g. "$user" variable from example above.

4. If variable contains some ID in it, then it should indicate this in it's name, e.g. "$user_id" instead of "$user". You can see other parts of In-Portal code to get the idea.

5. Tabulation in OnLoginAs method is completely wrong (see attached patch to get the idea if PHP Editor you're using donesn't provide a quick way to see what's wrong).

6. Some of the phrases in the language pack doesn't belong to "Core" module. Please make sure to export only "Core" module phrases of "Admin" & "Both" types on language pack export dialog. This way you'll notice that phrase isn't exported soon enough.
2011-10-11 12:31   
login_as_user_1105.3.patch attached - needs testing
2011-10-12 05:57   
Patch "login_as_user_v4.patch" also fixes issue with all home page links to result in 404 page in mod-rewrite when "env" variable is present.
2011-10-12 05:57   
Fix committed to 5.2.x branch. Commit Message:

Fixes 0001105: Add "Login as User" button to user list in Admin
Commit on behalf of Erik
2012-07-25 05:33   
Since 5.2.0 version was released.