Security module , grid of users and link to sec_form_edit_users

Hello,
I have a question about SC grid that is automatically created for the security module, and in particular for users.
There is an “add new” button at the upper left corner to add a user, and for each record a link to update it.
Both point to the same application “sec_form_edit_users” but:
a) in the case of “add new” rightly appears the password and the mechanism for repeat and it is in insert mode
b) in the case of the links on the exisiting records the two password fields are not displayed and is positioned on the user record on which I clicked.

In the case of insert it is not passed the parameter user id.
I can not understand where to look to understand how the system works.
In the case of insert there are the two password fields , some buttons of toolbar are idden and the title is about insert.
In the cas of update the title is editing and there are all the buttons of the toolbar (perhaps with different description).

Regards Gianpaolo

I’m not quite sure what you want to know. Depending on the status of the application you can apply different things. If you add a new record then by default all fields are empty. If the form is called as a result of a link from another form the keys are predefined. It’s actually straight forward. But I’m not sure where you doubts are.

Hello Albert,
I wanted to say that I understand a php script that based on the parameters passed behaves differently.
I do not understand where these different modes are set to operate at the application level “sec_forms_edit_users” automatically generated with the security module

Is it just a matter of understanding or do you want to achieve something and you don’t know how? The control logic of the generated applications can only be followed if you open the code in some php debugger like xdebug, phped etc.

Gianpagi,

3 things I see:

  1. If you create a field link from an app (to another app or same app), you can configure the properties which would include an option to “Add New” at the top. Automatically SC will take care of passing the id (when linking i.e. editing the specific line) or opening the new app in new mode for you. Not sure you want to get into the innards of that as Albert hinted but I suppose SC passes the config details by get or post params.

  2. In the destination app, if you remove the “update” and “delete” buttons from the toolbar and run the app directly, it will automatically open in Insert mode. Well you’ve given it no other choice, right? Heh. The converse should give opposite results too.

  3. You can use sc_apl_conf macro to also set opening state of an app before calling it from another app

Hope this helps.

Ok, Aducom and Scriptcaser

Regards

Hi all.

I know this is an old post, but I have exactly the same issue as gianpagi when trying to edit the form “sec_form_edit_users”.

It’s a simple form, with a single block layout and hardly any event/method code in it. And yet somehow it hides the password and password confirmation fields when you are updating an existing record. These fields are visible on adding a new record. I would like to change that behaviour for this project but cannot see where/how the hiding/showing is being achieved.

It’s the same if you run the app direct from the IDE, so not an sc_apl_conf() issue.

We’ve created dozens of SC systems now and I am pretty familiar with the security system now, But I still cannot work this one out. To save me creating a brand new form to make this simple change, can anyone offer any pointers?

Thanks.

The default security system has two separate forms - one to add user and the other to edit user. The add user form is intended for the end user to add themselves (using the link on the login page)- and set their own password at that time. The edit user is intended for use by an administrator and does not include the password fields (they are not hidden - just not used). The intent is that only the user knows their password and only the user can reset it.

Thanks for that bhardin, but I am looking at the default sec_form_edit_users. This is the one that is called from sec_grid_sec_users when an administrator is editing users.

All our users are added by the administrator - we don’t choose the option during security setup to allow users to self-register.

The point is, this edit form DOES have a password and confirmation password field - see screenshot.

[ATTACH=JSON]{“data-align”:“none”,“data-size”:“large”,“data-attachmentid”:87772}[/ATTACH]

Those two fields only show in Insert mode, not in Update mode. Run the app yourself and give it a valid {login} parameter, to edit that record. You will not see the password fields. Now run the SAME app but don’t give it a login parameter, so it goes into insert mode. You will now see the password fields. Same app, different fields showing. But no obvious code to make that happen.

Normally we only want the users themselves to be able to reset their passwords, as you’ve indicated. But my question is, how is that hide/show being done in the sec_form_edit_users application, because for this particular client I need to understand and modify the behaviour. We need the administrator to have the facility to reset a user’s password (not seeing the old one, just resetting it to a new one).

sec_form_edit_users.jpg

sec_form_edit_users.jpg

Form Settings > Edit Fields
Those fields are not displayed in update mode

Thanks bhardin - that’s exactly what I needed. I have often used the Required, Read only and PK tick boxes, but for some reason I have never noticed or used the New and Update tick boxes!! I appreciate your help.