User tests: Successful: Unsuccessful:
Pull Request for Issue # .
An access level can only be delted if there is no content which uses this level. But there is no information given, which tabels are concerned.
This PR adds the list of tables to the error message.
Add an access level.
Set this access level for some items in your content, an article, a contact, a module .. whatever.
Then try to delete this access level.
You get a message
"You can't delete the view access level '%d:%s' because it is being used by content."
Please select:
Documentation link for docs.joomla.org:
No documentation changes for docs.joomla.org needed
Pull Request link for manual.joomla.org:
No documentation changes for manual.joomla.org needed
Category | ⇒ | Administration com_users Language & Strings |
Status | New | ⇒ | Pending |
Labels |
Added:
Language Change
PR-4.3-dev
|
@brianteeman totally agree with you. It is only useful for developers (I had to dive into the database when I wanted to delete an access level.
A good message would be "Please check your articles, use the access level filter. You can use the batch function to change the access level for all articles" and so on.
But I have no idea where to get he component. In Joomla I could use some hard coded table, but not for 3rd party extensions.
Every suggestion is appreciated.
Also agree with the id, will remove it from the message.
I have tested this item
Does what it says so marking as successful
Still not sure how useful it is
I have tested this item
Does what it says so marking as successful
Still not sure how useful it is
Create three access levels (1,2,3)
Create an article at level 2
Create a contact at level 3
Select all three access and try to delete them
Level 1 is deleted and an error message that I cannot delete 2 and 3 because they are in use
Call stack
--
# | Function | Location
1 | () | JROOT\administrator\components\com_users\src\Model\LevelModel.php:123
2 | implode() | JROOT\administrator\components\com_users\src\Model\LevelModel.php:123
3 | Joomla\Component\Users\Administrator\Model\LevelModel->canDelete() | JROOT\libraries\src\MVC\Model\AdminModel.php:833
4 | Joomla\CMS\MVC\Model\AdminModel->delete() | JROOT\administrator\components\com_users\src\Controller\LevelController.php:116
5 | Joomla\Component\Users\Administrator\Controller\LevelController->delete() | JROOT\libraries\src\MVC\Controller\BaseController.php:672
6 | Joomla\CMS\MVC\Controller\BaseController->execute() | JROOT\libraries\src\Dispatcher\ComponentDispatcher.php:143
7 | Joomla\CMS\Dispatcher\ComponentDispatcher->dispatch() | JROOT\libraries\src\Component\ComponentHelper.php:355
8 | Joomla\CMS\Component\ComponentHelper::renderComponent() | JROOT\libraries\src\Application\AdministratorApplication.php:143
9 | Joomla\CMS\Application\AdministratorApplication->dispatch() | JROOT\libraries\src\Application\AdministratorApplication.php:186
10 | Joomla\CMS\Application\AdministratorApplication->doExecute() | JROOT\libraries\src\Application\CMSApplication.php:294
11 | Joomla\CMS\Application\CMSApplication->execute() | JROOT\administrator\includes\app.php:61
12 | require_once() | JROOT\administrator\index.php:32
Thanks for testing - if more than one levels are to be deleted, it needs further work. This was already a bug before. Will change this PR to draft now.
Another related issue is that you can save a view access level without assigning any user groups. In the case of the "special" level this will result in the admin of your site missing all the menus and toolbars and can only recovered by6 editing the database directly.
This pull request has been automatically rebased to 5.0-dev. No new features will be merged into Joomla! 4.3 series. Joomla! 4.4 series is a bridge release to make migration from Joomla! 4 to 5 as smooth as possible.
This pull request has been automatically rebased to 5.1-dev.
I ran in to that problem today, that I could not delete an access level.
I tested the patch on J5.0.0 successfully, as I could see which table was concerned.
In my case it was "#_fields", but it was not a com_content field, but a com_user field, that was still used with this access level. So, the error message with the table helped me a lot. Even if for a "normal" user the table info '#_fields' would not give sufficient information, because fields can be used in multiple areas. But an "experienced" user could have a look into the database and check. Also, a "normal" user would probably not have the rights to remove access levels.
So, the PR might not completely solve the problem (or create errors with multiple deletes), but it reduces the amount of time enormously.
I will test also for multiple and let you know.
If I delete two or more access level at the same time, then only the usages of one access level in the error message.
And shouldn't it be an error, not a warning?
Can you fix this for PBF?
I have tested this item ✅ successfully on 56d67a5
Labels |
Added:
Feature
PBF
PR-5.0-dev
Small
Removed: PR-4.3-dev |
I have tested this item ✅ successfully on 2eec18c
Labels |
Added:
PR-5.1-dev
|
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2024-04-06 17:27:10 |
Closed_By | ⇒ | chmst |
Nice idea. Not sure that the message is much more useful though as the table names are not very helpful. They give a clue to developers and those that speak english but otherwise they are pretty meaningless. Can it not display the component name? And cant see any benefit at all in displaying the id