-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
[4.0] Allow users edit account via com_users without core.manager permission #32771
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
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
26579dd
Allow manager to edit account via com_users
joomdonation 01f8516
Update edit links
joomdonation e309c41
Show save button in case user editing his own account
joomdonation e95aa11
CS
joomdonation 2c6d7fb
Correct comment
joomdonation f6b4b92
Use $key instead of hardcode 'id'
joomdonation 245712c
Correct @since tag
joomdonation c0bfbf4
Correct @since
joomdonation 6dbb7aa
CS
joomdonation 9b3a9b8
Correct comments
joomdonation 872c108
Update administrator/components/com_users/src/Dispatcher/Dispatcher.php
joomdonation 2b6f50e
Update administrator/components/com_users/src/Dispatcher/Dispatcher.php
joomdonation c8da777
Update administrator/components/com_users/src/Dispatcher/Dispatcher.php
joomdonation 268d19a
Update administrator/components/com_users/src/Controller/UserControll…
joomdonation 2e92be8
CS
joomdonation 688f66a
Update administrator/components/com_users/src/Controller/UserControll…
joomdonation 3466c19
Fix error with PDF
joomdonation f47df46
Merge branch 'user_edit_own_account' of https://github.com/joomdonati…
joomdonation File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
administrator/components/com_users/src/Dispatcher/Dispatcher.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| <?php | ||
| /** | ||
| * @package Joomla.Administrator | ||
| * @subpackage com_users | ||
| * | ||
| * @copyright (C) 2021 Open Source Matters, Inc. <https://www.joomla.org> | ||
| * @license GNU General Public License version 2 or later; see LICENSE.txt | ||
| */ | ||
|
|
||
| namespace Joomla\Component\Users\Administrator\Dispatcher; | ||
|
|
||
| \defined('_JEXEC') or die; | ||
|
|
||
| use Joomla\CMS\Dispatcher\ComponentDispatcher; | ||
|
|
||
| /** | ||
| * ComponentDispatcher class for com_users | ||
| * | ||
| * @since __DEPLOY_VERSION__ | ||
| */ | ||
| class Dispatcher extends ComponentDispatcher | ||
| { | ||
| /** | ||
| * Override checkAccess to allow users edit profile without having to have core.manager permission | ||
| * | ||
| * @return void | ||
| * | ||
| * @since __DEPLOY_VERSION__ | ||
| */ | ||
| protected function checkAccess() | ||
| { | ||
| $task = $this->input->getCmd('task'); | ||
| $view = $this->input->getCmd('view'); | ||
| $layout = $this->input->getCmd('layout'); | ||
| $allowedTasks = ['user.edit', 'user.apply', 'user.save', 'user.cancel']; | ||
|
|
||
| // Allow users to edit their own account | ||
| if (in_array($task, $allowedTasks, true) || ($view === 'user' && $layout === 'edit')) | ||
| { | ||
| $user = $this->app->getIdentity(); | ||
| $id = $this->input->getInt('id'); | ||
|
|
||
| if ((int) $user->id === $id) | ||
| { | ||
| return; | ||
| } | ||
| } | ||
|
|
||
| parent::checkAccess(); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.