Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGFIX] Show "switch user" button for non-admin users #68

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

mz-aimcom
Copy link

  • Enable "switch user" button for non-admin users (if action is allowed)
  • Removed unneeded ViewHelper namespace

Related: #67

* Enable "switch user" button for non-admin users (if action is allowed)

Related: koninklijke-collective#67
* Removed unneeded ViewHelper namespace

Related: koninklijke-collective#67
* Added modified "SwitchUserController"
  to be able to successfully call "switchUserAction"
  as non-admin
* Small condition update in "IndexListRow" partial

Related: koninklijke-collective#68
Comment on lines 50 to 53
if (ExtensionManagementUtility::isLoaded('beuser')) {
// Set backend user listing module as starting module if installed
$currentUser->uc['startModuleOnFirstLogin'] = 'system_BeuserTxBeuser';
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the intention behind this? In my case this leads to troubles. When the non-admin user hits exist the user sees an "access denied". I am currently thinking what would be the best solution. Following come to mind:

  1. Make $currentUser->uc['startModuleOnFirstLogin'] = 'system_BeuserTxBeuser'; configurable.
  2. Completely remove these lines.

However, for that it is helpful to understand the motivation for this condition.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no special intention behind that. It's just a copy from what the core does: https://github.com/TYPO3/typo3/blob/main/typo3/sysext/backend/Classes/Controller/SwitchUserController.php#L80

So I think your solution no. 2 would be the best option. There is no need to keep these lines, imo.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see. Thanks for the quick response and update!

Fixed issue:
> When the non-admin user hits exit the user sees an "access denied".

Related: koninklijke-collective#67

(see koninklijke-collective#68 (review))
@fsuter
Copy link

fsuter commented Aug 22, 2023

I have stumbled on the same issue. The problem is that the extension relies on a ViewHelper from the "beuser" extension \TYPO3\CMS\Beuser\ViewHelpers\SwitchUserViewHelper, but that ViewHelper requires the current user to be admin in order to simulate another BE user. This defeats the purpose of the extension.

@junfan59
Copy link

Hi,
We need this feature too. I don't understand, it is one of the most useful feature of this extension... Can you merge the commit 92bc8d8 and solve this issue please ?
Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants