Registry is not the correct class for storing access rights#168
Registry is not the correct class for storing access rights#168JLTRY merged 2 commits intojmcameron:masterfrom
Conversation
If we set 'core.edit','core.edit.state','core.edit.own' only the core.state value is stored due to hierachical mechanism in Registry If you first set 'core.edit' to true, it becomes $result['core']['edit'] = true. If you then set 'core.edit.state', it becomes $result['core']['edit']['state'] = true, but now $result['core']['edit'] would need to be an array, not a boolean.
|
@parapente it allows to correct one phpunit test testGetActionsSuperAdmin |
|
Note that under joomla 3.x the code was using a JObject |
|
You are right about the issue with the permissions. I noticed it too when I started the conversion of the tests. The problem with the solution is that CMSObject is deprected since Joomla 4.3 and will be removed in Joomla 6. That is why I used a Registry Object as I think I found this type of conversion inside the CMS. What I want to check is if those actions specified in the test are still valid. If they are then we need to find another solution (maybe a custom class). |
|
@parapente I propose to use ContentHelper::getActions('com_attachments'); |
|
or we can use it in AttachmentsPermissions::getActions(); |
|
@parapente I update the PR with an other solution : use Registry with an empty separator |
|
@JLTRY Much better! I didn't know Registry could be used without the seperator. |


If we set
'core.edit','core.edit.state','core.edit.own' in a registry
only the core.state value is stored due to hierachical mechanism in Registry
If you first set 'core.edit' to true, it becomes $result['core']['edit'] = true. If you then set 'core.edit.state', it becomes $result['core']['edit']['state'] = true, but now $result['core']['edit'] would need to be an array, not a boolean.