Feature Language Change PBF PR-5.0-dev Small PR-5.1-dev Pending

User tests: Successful: Unsuccessful:

avatar chmst
chmst
17 Jan 2023

Pull Request for Issue # .

Summary of Changes

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.

Testing Instructions

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.

Actual result BEFORE applying this Pull Request

You get a message
"You can't delete the view access level '%d:%s' because it is being used by content."

Expected result AFTER applying this Pull Request

grafik

Link to documentations

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

avatar joomla-cms-bot joomla-cms-bot - change - 17 Jan 2023
Category Administration com_users Language & Strings
avatar chmst chmst - open - 17 Jan 2023
avatar chmst chmst - change - 17 Jan 2023
Status New Pending
avatar chmst chmst - change - 17 Jan 2023
Labels Added: Language Change PR-4.3-dev
avatar brianteeman
brianteeman - comment - 17 Jan 2023

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

avatar chmst
chmst - comment - 17 Jan 2023

@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.

avatar brianteeman brianteeman - test_item - 17 Jan 2023 - Tested successfully
avatar brianteeman
brianteeman - comment - 17 Jan 2023

I have tested this item successfully on 7832067

Does what it says so marking as successful

Still not sure how useful it is


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/39654.

avatar brianteeman brianteeman - test_item - 17 Jan 2023 - Tested unsuccessfully
avatar brianteeman
brianteeman - comment - 17 Jan 2023

I have tested this item 🔴 unsuccessfully on 7832067

Does what it says so marking as successful

Still not sure how useful it is


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/39654.

avatar brianteeman
brianteeman - comment - 17 Jan 2023

Steps to reproduce the issue

Create three access levels (1,2,3)
Create an article at level 2
Create a contact at level 3

Test 1

Select all three access and try to delete them

Expected result

Level 1 is deleted and an error message that I cannot delete 2 and 3 because they are in use

Actual result

image

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

avatar chmst
chmst - comment - 17 Jan 2023

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.

avatar brianteeman
brianteeman - comment - 17 Jan 2023

@chmst I created an issue for the multiple delete information
But I only got the error message with this PR

avatar chmst
chmst - comment - 22 Jan 2023

This needs to be resolved first (or together) #39654

avatar brianteeman
brianteeman - comment - 4 Feb 2023

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.

avatar HLeithner
HLeithner - comment - 8 May 2023

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.

avatar HLeithner
HLeithner - comment - 30 Sep 2023

This pull request has been automatically rebased to 5.1-dev.

avatar webgras
webgras - comment - 20 Oct 2023

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.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/39654.

avatar webgras
webgras - comment - 20 Oct 2023

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?


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/39654.

avatar Hackwar
Hackwar - comment - 21 Feb 2024

Can you fix this for PBF?

avatar nadjak77 nadjak77 - test_item - 24 Feb 2024 - Tested successfully
avatar nadjak77
nadjak77 - comment - 24 Feb 2024

I have tested this item ✅ successfully on 56d67a5


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/39654.

avatar chmst chmst - change - 24 Feb 2024
Labels Added: Feature PBF PR-5.0-dev Small
Removed: PR-4.3-dev
avatar chmst chmst - comment - 24 Feb 2024
avatar crimle crimle - test_item - 24 Feb 2024 - Tested successfully
avatar crimle
crimle - comment - 24 Feb 2024

I have tested this item ✅ successfully on 2eec18c


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/39654.

avatar chmst chmst - change - 5 Apr 2024
Labels Added: PR-5.1-dev
avatar chmst chmst - change - 6 Apr 2024
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2024-04-06 17:27:10
Closed_By chmst
avatar chmst
chmst - comment - 6 Apr 2024

closing for a better solution. Pleas test #43223

avatar chmst chmst - close - 6 Apr 2024

Add a Comment

Login with GitHub to post a comment