Jump to content

Feature Requests


adrian
 Share

Recommended Posts

  • 1 month later...

@adrian what do you think of a "Login as Superuser" button for local development (obviously)? I'm doing lots of db restores (using RockShell) and after the restore I'm always logged out and need to log in. The problem with the log in is that I have to move away from the current page, then navigate back to the site I was watching...

Ideally I could just click "Login as Superuser" while viewing the page as guest and I'm logged in and redirected to the same page I was before.

Another small thing: Would it be possible to add the doubleclick-submit feature to the user switcher as well (as you did it with the language switcher)?

PS: Just realised that when clicking "login" in the tracy debug bar it already redirects me to the correct frontend page after login, thx for that!!

Link to comment
Share on other sites

Hi @bernhard - I don't know about a "Login as superuser" because you may have more than one superuser so how would you know which one to log in as. One possibility would be to allow the user switcher panel to always show for local dev and you could select the user from there, but I need to think about this a bit more because it would allow logging in as a superuser without having initially started a user switching setting as a superuser. I know it's local dev only and all, but it still makes me nervous.

I have modified the user switching to work like the language switching - not double-click btw, just a single click is all that is needed. I'll commit this later.

On 8/30/2022 at 6:28 AM, bernhard said:

PS: Just realised that when clicking "login" in the tracy debug bar it already redirects me to the correct frontend page after login, thx for that!!

Not really sure what you mean here - which login button are you talking about?

Link to comment
Share on other sites

16 minutes ago, adrian said:

Hi @bernhard - I don't know about a "Login as superuser" because you may have more than one superuser so how would you know which one to log in as. One possibility would be to allow the user switcher panel to always show for local dev and you could select the user from there, but I need to think about this a bit more because it would allow logging in as a superuser without having initially started a user switching setting as a superuser. I know it's local dev only and all, but it still makes me nervous.

I'd have used the one that is in $config->superUserPageID which is 41 usually... Or it could simply do a $users->get() to return the first superuser it can find? I don't think that this is anything worse than what we already have... I just doublechecked and my tracy bar is shown for guest users on local dev and I can use the console for whatever I want. So a superuser-login-button would not hurt imho? ? 

Thx for the tweaks on the user switcher!!

21 minutes ago, adrian said:

Not really sure what you mean here - which login button are you talking about?

I was talking about the login-link in the bar:

lBL2uCw.png

Looks like you have already setup a redirect feature here? If I visit page /foo on the frontend, then click "login" in the tracy bar I come to the login screen and after login I'm back at /foo

When using the regular login the process is different: Visit /foo on the frontend --> go to /processwire --> login --> see the pw page tree (or dashboard) --> go back to /foo (manually)

Link to comment
Share on other sites

Thanks - I wasn't thinking about that Login option - yes, I think it is handy - much nicer that the core login dance :)

Yeah, I suppose we could go with 41 or the first available superuser, but if I implement this, I think it would be better to use the user switcher and have the option to choose.

Regarding having access to everything on the bar already - that's not quite true - I do also prevent access to Adminer in this situation. Whether I really have good justification for that or not is another question, but I do want to have a more thorough think through this moving forward to make sure I am not overlooking anything of concern.

  • Like 1
Link to comment
Share on other sites

30 minutes ago, adrian said:

but if I implement this, I think it would be better to use the user switcher and have the option to choose.

Ok, just wanted to mention that the user switcher is not available on my end when I'm a guest ? 

31 minutes ago, adrian said:

Regarding having access to everything on the bar already - that's not quite true - I do also prevent access to Adminer in this situation. Whether I really have good justification for that or not is another question, but I do want to have a more thorough think through this moving forward to make sure I am not overlooking anything of concern.

Ok thanks, of course that's very sensitive topics and every caution is good! Don't let yourself be pushed in a direction you don't want ? 

But if it's easy and secure to add I'd be thankful ? 

Link to comment
Share on other sites

  • 2 months later...

A feature idea maybe for a rainy day...

Sometimes I find I want to save a record of what is in the Dumps panel. I usually just copy/paste to a text document but it would be cool if there was a download button that saved the contents of the Dumps panel to an HTML file. That would be nicer because of the better formatting and expand/collapse features.

Perhaps not so simple to do because I guess it would be best to embed any needed CSS and JS and the HTML file creation and download would need to happen via JS. So maybe not worth the trouble if it's a pretty niche need, but just thought I'd jot the idea down while it was fresh.

Link to comment
Share on other sites

Hi @Robin S - sounds interesting.

A couple of possible options:

1) Have you ever opened up any of the exception-*-.html files that get stored in /assets/logs/tracy ? These include the required JS for making the toggling etc work, so I guess I could take a similar approach for dumps.

2) What about a Dumps Archive panel - something like the Dumps Recorder, but it would be populated with only the entries you wanted and you could also delete items when you no longer need them. I think I could do this by having an "archive" icon shown next to each item in the Dumps panel - click that and it would be copied to the Archive Panel, and then in the Archive Panel there'd be a delete icon for each item. Would you prefer the ability to save individual items, or just the entire current contents of the Dumps panel?

I think I like #2 better because it keeps access to everything within Tracy.

Any thoughts?

 

  • Like 2
Link to comment
Share on other sites

On 11/20/2022 at 4:58 AM, adrian said:

2) What about a Dumps Archive panel - something like the Dumps Recorder, but it would be populated with only the entries you wanted and you could also delete items when you no longer need them. I think I could do this by having an "archive" icon shown next to each item in the Dumps panel - click that and it would be copied to the Archive Panel, and then in the Archive Panel there'd be a delete icon for each item. Would you prefer the ability to save individual items, or just the entire current contents of the Dumps panel?

Thanks Adrian, that's a really good idea! I think a single save button for the whole panel would be good because it might be useful having all the dumps that occurred together be connected in that way. Although having individual save buttons would be fine too - I think I'll find it very useful in either case.

Edit: could the archived dumps be given a label when saving them? Like maybe a text input that gets populated with the current datetime by default but can be added to or overwritten before clicking the archive button?

Link to comment
Share on other sites

  • 2 months later...

Hey @adrian could the request info panel please also show the page's pageClass? Or is that information somewhere else?

See here, where it's a quite essential information that the current page is of type "\RockCRM\Invoice", which is obvious in the dump but not in the request info panel:

oyBnfQX.png

Thx in advance!

  • Like 2
Link to comment
Share on other sites

But pageClass doesn't work on pages. I see you're calling it on $template though. So I think we want to populate "class" on both the page and template info sections which required different approaches. Please try the attached and let me if you're getting what you need in the Page Info and Template Info sections.

RequestInfoPanel.php

  • Like 2
Link to comment
Share on other sites

  • 3 weeks later...

Hey @adrian I'm working on a PW site in a team and we have the problem that we need different "localRootPath" settings for different users. Is that already possible?

The problem is not for local development - there we can have different config.php files. The problem is on the remote server (staging and production system). It would be nice to be able to click on tracy dumps there, but obviously there we only have one config for multiple developers.

I tried this but it seems to have no affect. Maybe it's too late? But I can't set different paths in config.php as we don't know the user at that point:

if($user->name == 'bernhard') {
	$tracy = $modules->get("TracyDebugger");
	$tracy->set('localRootPath', '/foo/bar/baz/');
	bd('test');
}

Thx!

Link to comment
Share on other sites

Hi @bernhard - I think the easiest way might be to set: Debugger::$editorMapping which I think you should be able to change in config.php

Here is where the path is built: https://github.com/adrianbj/TracyDebugger/blob/f2fbcd88fcecad45b2ce7b428cfe80c1527c1122/TracyDebugger.module.php#L1004-L1048 but I think in your case you will want to get the current value of Debugger::$editorMapping and do a str_replace on the path set in the module setting to adjust for each user as needed. You could probably even just put a placehholder like "localpath" in the module settings and replace that with the correct path per user.

Let me know if that works out for you.

 

  • Thanks 1
Link to comment
Share on other sites

  • 4 months later...

Hey @adrian another thing that gets annoying from time to time:

When using the great user switcher I often want to switch back and forth between two users, usually between the superuser and one other user with another role. This is a very common use case I guess. When I switch from superuser to the other user though, I only have the options to "logout to guest" or "end session". Would it be possible to have a third button "back to xxx" where xxx would be the name of the superuser.

For me that button would be what I need in 99% of the cases. I never ever need one of those two buttons that are already there. Not sure what they are actually for or how/when you use them?

nQTR0Q3.png

Link to comment
Share on other sites

@bernhard, I think your Tracy Debugger might not be up to date. There is no "End Session" button in recent versions. You just can just click any user in the list and immediately change to that user. So it's pretty quick to toggle between two users - remember you can use the "Find user..." filter to find a user by name.

The "Logout to Guest" lets you temporarily switch so you can view the front-end as a guest would, but with the debug bar still available even on production. But if you are using ProCache you would need to switch it off before using "Logout to Guest" because otherwise PHP will be bypassed altogether if a cache file exists.

  • Like 1
Link to comment
Share on other sites

The End Session button should still be a thing. Basically it will kill the user switcher session and leave you logged in as the currently selected user with no option to change.

As for a back to xxxx user, I am with Robin - there should really be no need for that, especially if you limit the available users via one of these settings. This lets you remove frontend only users etc from the list making it much more manageable to find your own superuser account to switch back to.

image.thumb.png.3c3485b597189b1df0c1eca633c7a4f7.png

  • Like 2
Link to comment
Share on other sites

12 minutes ago, adrian said:

The End Session button should still be a thing. Basically it will kill the user switcher session and leave you logged in as the currently selected user with no option to change.

Oh right, of course it only appears when you have switched to a different user. I can't think of many cases where I would want to stay as the currently selected user without having the ability to switch back to superuser but nice to have the option in case it is needed.

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

Hey @adrian I apologise if I'm again asking for something that's already possible. But I don't think so ? 

I've just added a RockMigrations Tweak that shows WHY a $session->redirect happened in the tracy debug bar.

Redirections can be really annoying and hard to debug. You open a page and it does not show up and instead redirects to the homepage. You wonder why... Access levels? Some other redirections in place?

I had a look and Session::redirect is already hookable so it's really simple to add some helpful information:

wDLiyM1.png

You instantly see that I got redirected because of line 36 in Hero.php

While it's a very nice Tweak I think this would be much better placed directly into the tracy debug bar. What do you think?

See https://github.com/baumrock/RockMigrations/blob/6003cf593b878b80937fa9708f0172a8f9fcfed9/tweaks/RedirectLogger.php

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...