Updated 4a. JCB Demo Component Directory, Folders and Files (markdown)
@@ -304,15 +304,19 @@ Only if you add permissions here will this view have permissions. [Please watch
|
||||
|
||||
By default, the site view looks is not authorized for any user besides the Super Administrator although it displays on the main menu after logging in to a Registered User and above. If access is given in Joomla!'s ACL to the JCB Demo component for the Registered Group of Joomla! users, the view will display after logging in as a Registered User. For this to happen, the Joomla! ACL must allow access to the component as follows using:
|
||||
Admin area main menu option:
|
||||
|
||||
Components - Demo - Looks - Options - Permissions tab - Registered
|
||||
* Looking (Site) Access Allowed
|
||||
* Looks Access Allowed
|
||||
* Looks (Site) Access Allowed
|
||||
* Looks Edit Own Allowed
|
||||
|
||||
The first option only allows access to the site. The view will display a look but that's all. The second allows access and therefore all looks will display and can be accessed (but not edited) as long as the third access is also granted. The fourth allows editing the look if the user's id matches the one in the look_demo table. More details about the Joomla! ACL on this can be seen in [this video](https://www.youtube.com/watch?v=gWjQjdhYqXI&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=36).
|
||||
|
||||
Be sure you add a filter using the admin area of the site, main menu option, Selecting the Components, Component Builder, Dynamic Gets, Looks, Tweak option:
|
||||
|
||||
* Where Table Key a.created_by equal = $this->user->id
|
||||
|
||||
This Tweak to the Dynamic Get in JCB for the Demo component site view looks, Dynamic Get, getListQuery, extends it to only include records from the table that were created by the user having the same id as the current user. This is available from the site view looks, $this variable, user id form element. The change takes effect once you use JCB to compile the component and install it again using the Joomla! extension installer. The same Tweak is required in the site view looking Dynamic Get, getItem.
|
||||
|
||||
Doing the above also ensures only certain actions are allowed for certain users. In our case, a Registered User should only be allowed to:
|
||||
@@ -324,18 +328,23 @@ The filter allows them to edit only their own look records in the demo_look tabl
|
||||
* Save
|
||||
* Save and Close
|
||||
* Close buttons
|
||||
|
||||
If you add more permissions, more actions and hence more buttons will be allowed such as Save and Copy. Change the JCB Demo component Joomla! ACL permissions and you can see the effect on what edit buttons appear immediately since components do not need to be compiled by JCB for these settings to change.
|
||||
|
||||
Continuing with the edit functionality:
|
||||
* Edit the look record in the demo_look table. It is important you understand this is reusing the admin view look, edit look. You can see this in the form tag located in the source of the page. Use a browser tool such as Chrome, Developer tools to do this.
|
||||
* The registered user id of the logged in user must match the created_by value for it to display and allow the user to edit the record.
|
||||
|
||||
By default, the JCB demo allows all user types except public and guest user groups to view all looks, either they created them or not. To restrict the looks to the specific user, besides the changes to the Joomla! ACL, one must filter the look records in the demo_looks table by owner id. Note, these will take effect without compiling the JCB Demo and other components built using it. The reason is the Joomla! ACL or the global options permissions of the JCB Demo component are being changed for Joomla!'s Registered User Group and not individual permissions within the JCB component. The latter allows for granularity by changing the Joomla!
|
||||
|
||||
* First, login as the registered user and select the looks option from the main menu.
|
||||
* The site view looks displays with the Name and Description of the registered user's look and an edit toolbar underneath.
|
||||
* Click the edit toolbar and display the admin view look, displaying only the form actions defined for that user group.
|
||||
|
||||
Save
|
||||
Save and Close
|
||||
Close
|
||||
|
||||
* The More button was enabled in the JCB demo
|
||||
This allows entry of the additional fields on the form.
|
||||
|
||||
|
Reference in New Issue
Block a user