Skip to content
This repository has been archived by the owner on Nov 26, 2017. It is now read-only.

Corrections to JAccess when there is an invalid or missing asset or parenting is to root. #1416

Merged
merged 1 commit into from Jul 28, 2012

Conversation

elinw
Copy link
Contributor

@elinw elinw commented Jul 28, 2012

Although there is some confusion in the wording examination of the comments and docblocks of JAccess indicates that if there is parenting to the root asset or there is an invalid asset that the rules from the root asset should be used. For various reasons this was not actually working in the current class. This has been causing problems for developers who wish to parent assets from the root asset. In addition this corrects a situation where as a result of the asset_id being privately manage a corrupted asset_id could never be corrected using the class.

The approach to solving this involved several steps.
First, change the code so that the id of the root asset is always obtained using the API rather than assuming either that the parent_id is 0 or that the id is 1. This solves problems when the asset table data has been created outside of Joomla and imported, possibly with the root not as the first record.

Second, when there are no rules available, for example when the asset is not found, the root asset rules are used regardless of whether the rules are being treated as recursive or not. This is important for a number of reasons not least of which is it provides super user permissions if available. Previously in this situation the super user did not have special super user permissions.

Third, there are some complications when getActions/getActionsFromFile/getActionsFromData do not include a section that matches an asset (that is that final assets are parented to the root asset with nothing akin to a component in between). In this case, such assets will now fall back to the root asset for their rules unless something else is provided.

Fourth, a number of the tests for JRules and JAccess had incorrect expected results. These have been corrected.

corrections and improvements to the tests for JAccess and JRules.
Correct fall back to $rootId where that was not happening.
pasamio added a commit that referenced this pull request Jul 28, 2012
Corrections to JAccess when there is an invalid or missing asset or parenting is to root.
@pasamio pasamio merged commit bc0100c into joomla:staging Jul 28, 2012
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants