customUser field automatically add a user group field in the component config #484

Closed
opened 2019-10-21 08:24:36 +00:00 by jcodewalker · 1 comment
jcodewalker commented 2019-10-21 08:24:36 +00:00 (Migrated from github.com)

Steps to reproduce the issue

Create a customUser field type, add it to look admin view of Demo component, compile and upload the component

Expected result

To find the customUser field added to look admin view ONLY

Actual result

The customUser field is correctly added in the admin view, but also a user group field is automatically added to the component config.
This user group field is named with the code I assigned as "type" to the customUser field, but has an arbitrary name, arbitrary description and is added in an arbitrary tab, which has even an arbitrary note field.
Example:
I set a customUser field like:
type: customUser
name: myCustomName
description: myCustomDescription

I find an arbitrary userGroup type field in the component configuration, in a tab named "target groups", which is positioned between "General" and "Uikit2 settings" with:
name: myCustomName
label: User Group
description: set the user group/s being targeted by this user type

What is this? What does it means?
Schermata 2019-10-21 alle 10 01 01

System information (as much as possible)

  • OS Name & Version:
  • MySql Version:
  • Apache Version:
  • PHP Version:
  • Joomla Version:
  • JCB Version:
  • Browser:

Additional comments

### Steps to reproduce the issue Create a customUser field type, add it to look admin view of Demo component, compile and upload the component ### Expected result To find the customUser field added to look admin view ONLY ### Actual result The customUser field is correctly added in the admin view, but also a user group field is automatically added to the component config. This user group field is named with the code I assigned as "type" to the customUser field, but has an arbitrary name, arbitrary description and is added in an arbitrary tab, which has even an arbitrary note field. Example: I set a customUser field like: type: customUser name: myCustomName description: myCustomDescription I find an arbitrary userGroup type field in the component configuration, in a tab named "target groups", which is positioned between "General" and "Uikit2 settings" with: name: myCustomName label: User Group description: set the user group/s being targeted by this user type What is this? What does it means? ![Schermata 2019-10-21 alle 10 01 01](https://user-images.githubusercontent.com/49115855/67188604-f46b1280-f3ec-11e9-8de9-55fa035b6007.png) ### System information (as much as possible) - OS Name & Version: - MySql Version: - Apache Version: - PHP Version: - Joomla Version: - JCB Version: - Browser: ### Additional comments

This is part of how custom user fields works, since if all you want is a user field then just create one using the normal user-field. But the custom user-field you are able to target only a specific group of users. So JCB adds that field to the config so you can select what those groups should be in your component.

This is not a bug, but yet again another feature of JCB that I have not yet fully explained. You see it is like the ice burg on the website JCB has so much more happening under the hood then you would see above the surface.

So before opening a issue here look at the code, this is what you will see.

We have another component that you can also get the JCB pagkage key if you forked the project called Cost Benefit Projection it has three custom user groups, serviceprovideruser countryuser and memberuser so each has it own customfield:

We then use these relationships to control access.

You can achieve much of this with the access levels in Joomla, but with custom user groups you get an extra layer for even more permission settings.

So the custom usergroups naturally require a getGroups function and since we need that value to be dynamic... JCB adds it to your component for you.

Here is the areas that build this:

So like said before if you just need a normal user group that returns all users then use the default but if you would like to target a selected group... this is the purpose of the custom-user-group field.

This is part of how custom user fields works, since if all you want is a user field then just create one using the normal user-field. But the custom user-field you are able to target only a specific group of users. So JCB adds that field to the config so you can select what those groups should be in your component. This is not a bug, but yet again another feature of JCB that I have not yet fully explained. You see it is like the ice burg on the website JCB has so much more happening under the hood then you would see above the surface. > So before opening a issue here look at the code, this is what you will see. We have another component that you can also get the JCB pagkage key if you forked the project called **Cost Benefit Projection** it has three custom user groups, `serviceprovideruser` `countryuser` and `memberuser` so each has it own customfield: - [serviceprovideruser](https://github.com/namibia/CBP-Joomla-3-Component/blob/master/admin/models/fields/serviceprovideruser.php#L49) and in [config](https://github.com/namibia/CBP-Joomla-3-Component/blob/master/admin/config.xml#L347) - [memberuser](https://github.com/namibia/CBP-Joomla-3-Component/blob/master/admin/models/fields/memberuser.php#L49) and in [config](https://github.com/namibia/CBP-Joomla-3-Component/blob/master/admin/config.xml#L363) - [countryuser](https://github.com/namibia/CBP-Joomla-3-Component/blob/master/admin/models/fields/countryuser.php#L49) and in [config](https://github.com/namibia/CBP-Joomla-3-Component/blob/master/admin/config.xml#L353) We then use these relationships to [control access](https://github.com/namibia/CBP-Joomla-3-Component/blob/master/admin/helpers/costbenefitprojection.php#L29). You can achieve much of this with the access levels in Joomla, but with custom user groups you get an extra layer for even more permission settings. So the custom usergroups naturally require a [getGroups](https://github.com/namibia/CBP-Joomla-3-Component/blob/master/admin/models/fields/serviceprovideruser.php#L46) function and since we need that value to be dynamic... JCB adds it to your component for you. Here is the areas that build this: - the [config xml](https://github.com/vdm-io/Joomla-Component-Builder/blob/staging/admin/helpers/compiler/e_Interpretation.php#L14530) - the [getGroups method](https://github.com/vdm-io/Joomla-Component-Builder/blob/staging/admin/helpers/compiler/c_Fields.php#L3313) - the [getExcluded method](https://github.com/vdm-io/Joomla-Component-Builder/blob/staging/admin/helpers/compiler/c_Fields.php#L3315) So like said before if you just need a normal user group that returns all users then use the default but if you would like to target a selected group... this is the purpose of the custom-user-group field.
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: joomla/Component-Builder#484
No description provided.