Updated 036 Setting Site View Permission (markdown)

Amigo 2019-06-22 16:31:49 +02:00
parent b929794512
commit 8cf911374e
1 changed files with 10 additions and 2 deletions

@ -10,7 +10,15 @@ If you are [00:00:57](https://www.youtube.com/watch?v=gWjQjdhYqXI&list=PLQRGFI8X
### Explanation On The Code Level
* ### Default
Let's close out here and look at some of the code I have done there so I will have to go to Component Builder [00:02:12](https://www.youtube.com/watch?v=gWjQjdhYqXI&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m12s) And then to components. I'll open sermon distributor, I will go to settings, site views. I will click add, you will see that we have here a value called default view. What the default view really is, is that view [00:02:45](https://www.youtube.com/watch?v=gWjQjdhYqXI&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m45s) that the component will direct you to, if you are accessing a view that you as a user don't have access to. Usually we would set the default view to not have an access control. We will say the default view [00:03:12](https://www.youtube.com/watch?v=gWjQjdhYqXI&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m12s) doesn't have access control. That means it's open and public to all. We could explain on this view how to get access for example to the rest of the component. Because you could see in what user group the user is and you can by that determines some messages. There can only be one default view, even if you select more than one. The first one, the compiler gets to become the default view, the next one will be ignored. [00:03:52](https://www.youtube.com/watch?v=gWjQjdhYqXI&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m52s) There can only be one at the moment. It says select only one. If you have an access for categories and it's not yet set, it will throw the user back to, for example, to preachers. What is the advantage of this? It simply negates the error page. So did you don't get a loop where the permission never gets resolved. It goes into a loop and then crash the site. This prevents that but it doesn't solve our permission structure of completely. But it is at least a first step towards trying to resolve it. This is your default page. Don't give the default page permission structure.
Let's close out here and look at some of the code I have done there so I will have to go to Component Builder [00:02:12](https://www.youtube.com/watch?v=gWjQjdhYqXI&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m12s) And then to components. I'll open sermon distributor, I will go to settings, site views. I will click add, you will see that we have heactuallyre a value called default view. What the default view really is, is that view [00:02:45](https://www.youtube.com/watch?v=gWjQjdhYqXI&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m45s) that the component will direct you to, if you are accessing a view that you as a user don't have access to. Usually we would set the default view to not have an access control. We will say the default view [00:03:12](https://www.youtube.com/watch?v=gWjQjdhYqXI&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m12s) doesn't have access control. That means it's open and public to all. We could explain on this view how to get access for example to the rest of the component. Because you could see in what user group the user is and you can by that determines some messages. There can only be one default view, even if you select more than one. The first one, the compiler gets to become the default view, the next one will be ignored. [00:03:52](https://www.youtube.com/watch?v=gWjQjdhYqXI&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m52s) There can only be one at the moment. It says select only one. If you have an access for categories and it's not yet set, it will throw the user back to, for example, to preachers. What is the advantage of this? It simply negates the error page. So did you don't get a loop where the permission never gets resolved. It goes into a loop and then crash the site. This prevents that but it doesn't solve our permission structure of completely. But it is at least a first step towards trying to resolve it. This is your default page. Don't give the default page permission structure if any of the other pages is accessed [00:04:43](https://www.youtube.com/watch?v=gWjQjdhYqXI&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m43s) it will divert to the default page.
### Adding Custom Scripting - Showing After Installation
The next step that we have to try and address this problem, is some custom scripting that you can add which will show after installation. The component where we have this shown is the demo component. You can open the PHP tab. In the PHP tab you will see that it has a queued message [00:05:19](https://www.youtube.com/watch?v=gWjQjdhYqXI&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m19s) in the post flight installed blocks. It gets the factory, get application. 'First set the component global setting and the permissions in the option area or the front end of the component will not work as expected. Please note that each view on the front end has access and permissions. So if you would like the public to access those views, they must be given the access and permission.' This is an info message that comes up [00:05:54](https://www.youtube.com/watch?v=gWjQjdhYqXI&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m54s) after you have install. That is another way that we've tried to help the user realize that he needs to add some. You can change this into a link, become very fancy or you could even add custom script here, that updates [00:06:16](https://www.youtube.com/watch?v=gWjQjdhYqXI&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m16s) this components promotional structure, and adds the public to have access to the site views. These are some of the ways that we are trying to resolve the permission restraints of site views.
### Looking Into Code - Site Root
Let's look at the code level. Here we have the access file open of sermon distributor, and if we do a search: site. [00:07:00](https://www.youtube.com/watch?v=gWjQjdhYqXI&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m00s) You will see that it has the site access values set for the component. When we look at the front end of the component, open categories, you see that here it is asking whether the user has that access, and if it doesn't, it does a redirect, then redirects to the default page. Let's open the default page. [00:07:32](https://www.youtube.com/watch?v=gWjQjdhYqXI&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m32s) The ideal of the default page, is that if the default page is not the site route, it cannot access the default page. It will add this error, and redirect to the site root, which being the websites homepage. That's how we trying to prevent this permission structure from interfering with your user experience.
???
If any of the other pages is Accessed [00:04:43](https://www.youtube.com/watch?v=gWjQjdhYqXI&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m43s) it will divert to the default page And now the next step that we have to try and address this problem Is some custom scripting That you can add Which will show After installation so let me show you some of that The component where we actually have this shown is the demo component So you can just open the PHP tab And in the PHP tab you see That it has a enqueue message [00:05:19](https://www.youtube.com/watch?v=gWjQjdhYqXI&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m19s) In the post flight in stalled blocks basically gets the factory Get application first set the component Global setting and the permissions in the option Area or the front end of the component will not work as expected Please note that each view on the front end has access and permissions So if you would like the public to access those views They must be given the access and Permission And then this is just an info Message that comes up [00:05:54](https://www.youtube.com/watch?v=gWjQjdhYqXI&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m54s) Basically after install So that is another way that we've tried to help the user realise that he needs to Add some now you can obviously Change this into a link Become very fancy Or You could Even add Custom script here That updates [00:06:16](https://www.youtube.com/watch?v=gWjQjdhYqXI&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m16s) The This components promotional structure And actually adds the public to to have access to the site views These are some of the ways that we are trying to resolve the permissional restraints Of Site views Now let's look at this, I was saying earlier at the code level so forgive me for taking so long to get So here we have the access file open of sermon distributor And if we do a search here Site [00:07:00](https://www.youtube.com/watch?v=gWjQjdhYqXI&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m00s) You see that it has the site access values set for the component Now When we look at The front end of the component Open categories You see that here it is asking whether the user Has that access And then if it doesn't It does a redirect and then redirects to the default page you see that Now let's open the default page [00:07:32](https://www.youtube.com/watch?v=gWjQjdhYqXI&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m32s) And The ideal of the default page Is that if the default page is not the site route It will If It cannot access the default page it will actually add this error And then redirect to the site root Which being the websites homepage And so that's kind of how we trying to Prevent the This permissional structure from interfering with your user experience Now if we go back to the component [00:08:10](https://www.youtube.com/watch?v=gWjQjdhYqXI&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m10s) The Sermon Distributer component And we again open the site views This time I change it that is doesn't have access I actually save it that way Go to the compiler Compile Sermon distributor and install Ok now let's go back to the code Now you'll see That it doesn't have any of that checks in the preachers file [00:08:57](https://www.youtube.com/watch?v=gWjQjdhYqXI&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m57s) Only in the category File And it still redirects to preachers Which in effect means that this one will no longer give any errors But it will show these errors Which relates to the fact that they cannot see The the categories Now I think some of the advancements that we might still think on doing is maybe Add a field to the component Where the user can change these errors [00:09:31](https://www.youtube.com/watch?v=gWjQjdhYqXI&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m31s) To show Maybe a message of how to purchase access or something Yeah we could still look at that you do realise that this stage JCB does have the the option to actually customise any section of code So by using what is known as the custom code implementation Now I'm not gonna demonstrate that please go look and review those videos they are on YouTube Where you can literally Change this whole code block here And then Use use your own implementation upon these measures [00:10:10](https://www.youtube.com/watch?v=gWjQjdhYqXI&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m10s) Well that is a a quick demonstration or explanation on how to manage The different permissional structures for JCB regarding the site front-end So if you do not want that Control you can simply obviously just put it off But I realize that most of you Might want to add some custom scripting that adds permissions to the database for that component That's little bit Beyond the scope of where JCB is at the moment Aldo that is a nice to have there are more pressing things that we'll focus on First
Now if we go back to the sermon distributor component, [00:08:10](https://www.youtube.com/watch?v=gWjQjdhYqXI&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m10s) and we again open the site views, this time I change it that is doesn't have access. I actually save it that way. Go to the compiler, compile sermon distributor and install. Ok now let's go back to the code Now you'll see That it doesn't have any of that checks in the preachers file [00:08:57](https://www.youtube.com/watch?v=gWjQjdhYqXI&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m57s) Only in the category File And it still redirects to preachers Which in effect means that this one will no longer give any errors But it will show these errors Which relates to the fact that they cannot see The the categories Now I think some of the advancements that we might still think on doing is maybe Add a field to the component Where the user can change these errors [00:09:31](https://www.youtube.com/watch?v=gWjQjdhYqXI&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m31s) To show Maybe a message of how to purchase access or something Yeah we could still look at that you do realise that this stage JCB does have the the option to actually customise any section of code So by using what is known as the custom code implementation Now I'm not gonna demonstrate that please go look and review those videos they are on YouTube Where you can literally Change this whole code block here And then Use use your own implementation upon these measures [00:10:10](https://www.youtube.com/watch?v=gWjQjdhYqXI&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m10s) Well that is a a quick demonstration or explanation on how to manage The different permissional structures for JCB regarding the site front-end So if you do not want that Control you can simply obviously just put it off But I realize that most of you Might want to add some custom scripting that adds permissions to the database for that component That's little bit Beyond the scope of where JCB is at the moment Aldo that is a nice to have there are more pressing things that we'll focus on First