diff --git a/036-Setting-Site-View-Permission.md b/036-Setting-Site-View-Permission.md index aaf5c74..17c9227 100644 --- a/036-Setting-Site-View-Permission.md +++ b/036-Setting-Site-View-Permission.md @@ -1 +1,16 @@ -Hi I would like to show you how to set the site view permission the Site view permission is really related to the front end of any site view Since it usually by Default set not allowed And that is basically because We have [00:00:22](https://www.youtube.com/watch?v=gWjQjdhYqXI&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m22s) The problem where That data is controlled By the Global settings of the component And unless you write some custom script to add that Global settings to the database for permission It actually doesn't have those permissions set and because it's not set it's by Default always said to not allowed Now let me explain that on a code level to you Ok we will use sermon distributor which is One of the demo components that is available and if you are [00:00:57](https://www.youtube.com/watch?v=gWjQjdhYqXI&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m57s) Interested in buying access to this demo component It obviously has site views So If we open the options tab You see there's a permissional or tab And if we search for sight You see there is category site access Plural and category Site Access singular there's also preacher site access and preachers And series and series list [00:01:38](https://www.youtube.com/watch?v=gWjQjdhYqXI&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m38s) And sermon And all these various site accesses Literally saying whether the public Will have access Now by Default as I said It is said to inherit And inherit will actually say not allowed Now they are there's something that I've done to try and accommodate this problem In JCB So 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 And I'll open sermon distributor Then I will go to settings And then sight views I will click add And Now you will see that we have here A value called default View Now what the default view really is Is that the 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 So Usually we would set the default View to not have an access Control So Will say ok 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 actually open and public to all And then we could Explain on this view How to get access for example to the rest of the component . For because you could see in what user group the user is and you can by that determines some messages Ok So that means whenever you have obviously there can only be one default view even if you select more than One the first one the compiler gets to will 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) So they can only be one at the moment it says that here select the only one and so if you have an Access for categories and it's not yet set It will throw the user back to for example here preachers Now What is the advantage of this it Simply negates the error page So did you don't get a loop where the The permission just never gets resolved so just goes into a loop and then crash the site This prevents that but it obviously doesn't solve our permission structure of completely But it is at least a first step towards trying to resolve it so you would say it This is your default page don't give the default page permissional structure so 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 +# SETTING SITE VIEW PERMISSION + + +Hi. I would like to show you how to set the site view permission. The site view permission is related to the front end of any site view. Since it usually by default set not allowed. We have [00:00:22](https://www.youtube.com/watch?v=gWjQjdhYqXI&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m22s) the problem where that data is controlled by the Global settings of the component. Unless you write some custom script to add that Global settings to the database for permissions. It actually doesn't have those permissions set and because it's not set it's by default always set to not allowed. + +Now let me explain that on a code level to you. We will use sermon distributor which is one of the demo components that is available. + +If you are [00:00:57](https://www.youtube.com/watch?v=gWjQjdhYqXI&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m57s) interested in buying access to this demo component, it has site views. If we open the options tab, you see there's a permission tab. If we search for site, you see there is categories site access, plural and category site access, singular. There's also preacher site access and preachers, series and series list, [00:01:38](https://www.youtube.com/watch?v=gWjQjdhYqXI&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m38s) and sermon. All these various site accesses literally saying whether the public will have access. By default as I said, it is set to inherit, and inherit will actually say not allowed. Now there's something that I've done to try and accommodate this problem in JCB. + +### 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. + +??? +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