User check on getItems #29
Labels
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: joomla/Component-Builder#29
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I've been trying to figure out where I may be going wrong with this, and figured that I would finally ask, after having spend many many hours on it.
In the site view models, there is auto-generated code that does permission checks to see if the user is able to access the item. It is similar to this:
That code is causing a redirect loop, and looking between code on sermon distributor, and what I'm working on, I can't find the cause. Of course, if I manually comment out that section of code, it works fine, which is telling me that it is having difficulty finding the access.
Any suggestions?
And, I tested with sermon distributor, and I get the same "too many redirects" error.
please do not mix two issues... I will only answer the first question, please open another issue for the second... :)
Okay let me explain....
In your code you will see that
categories
is the default view... and therefore the loop...In your component you can set what front-end view is the default view (component->settings tab->Site Views->Default View), and for this view you must give public access (once the component is installed) to avoid a loop. Mainly because if a user open a front-end view that he does not have access to it will redirect him to the default view, and show a warning. Therefore if the default view is also not accessible it will cause a loop, redirecting to itself over and over and over....
You will see there is a TODO note in the code as we may want to improve this in the future... but for now that is how it works.
I started working on a fix, to insure this loop does not happen... will be part of the next release.
I'm thinking that there may be more than just this. As a test, I took a clean install of Joomla, installed Sermon Distributor that I downloaded from GitHub (via extension.joomla.org), created a Sermon Category, added a menu item for Sermon Distributor->Categories, and one the frontend that menu item loops, resulting in "ERR_TOO_MANY_REDIRECTS".
In looking in Component Builder, I am noticing that in CB->Components->{your component}->Settings Tab->Admin Views, there are 2 columns: "Has Metadata" and "Add Access". Both of those columns do not have the radio selected. If I go through and select them, save, then save the component and go back to look at them, those radios are unselected again.
No there is not more too it, I think you don't understand... please watch this video
About the radio selection issue, open the pop-up close it and open it a second time, then it should show all as it is stored in the database. IF this does not resolves the issue, check the database to see what was stored... the selection issue is not a component builder issue but a repeatable field issue.
Thank you Llewellyn. That video actually helped a lot. It would be nice, eventually, to have the permissions for site views default to Allowed. This is how many components work. But this work around works. And, I tested by putting your fix in my code, manually, and that redirected nicely as well. As always, excellent support and help.
Enjoy the rest of the holiday. My new component should be entering beta sometime in January (hopefully), all built with Component Builder. Out of 12 admin views, they are all working, and out of 19 site views 17 have the basics in place. Still a matter of getting the model and view code into Component Builder, and work on a few details, but Component Builder makes things much nicer.
Wow, that sounds great...