PDA

View Full Version : Run-Time / Control-Set Focus Command


ABC123

Rudy16
04-13-2008, 08:01 PM
If I use a Control / Set Focus on a form in run-time mode, will I be alble to modify forms, etc. and save them in run-time-mode? This way if a Client want's Button Passwords changed, I can travel to the site, invoke the Change Passwords Button on the Main Menu and create new passwords for him.

If there is a better way, would someone please educate me.

Thanks,
Rudy fro Toms River, NJ

Stan Mathews
04-13-2008, 08:13 PM
If I use a Control / Set Focus on a form in run-time mode, will I be alble to modify forms, etc. and save them in run-time-mode? No. When the runtime is used you cannot edit.



If there is a better way, would someone please educate me. If you are going to the client's site, have him suspend activity, copy the database to your laptop which has the developer version, make your changes, copy the database back to his machine.

Rudy16
04-13-2008, 08:24 PM
Thanks Stan.

I Posted another issue and would like to know if this can be done?
I could not find the following in Alpha's Help System. I set up passwords on certain buttons for launching an Administrative Menu. I've set the password via the Properities, Enable Password of that button.

Is ther a way I can set up another button on a password/change form so a user in a run-time environment can change these various passwords in those buttons whenever he deems it necessary?

If not, it should be implemented in the next upgrade. Say a client finds out that someone has figured out what the password is to enter an Administration Form which updates a database and want's to change the password in that buttons properities. If you can set it in design mode, you should be able to change it in run-time mode.

I ask the user community on your web site however, nobody has responded.

What do you thing? Can yhis be done?

Sincerely,

Rudy Pataky

Stan Mathews
04-13-2008, 08:32 PM
Is ther a way I can set up another button on a password/change form so a user in a run-time environment can change these various passwords in those buttons whenever he deems it necessary?I don't deal with security issues very often so I can't say for sure. Did you check the documentation?

A cursory search led me to

<BUTTON>.SET_PASSWORD() (http://support.alphasoftware.com/alphafivehelpv8/Methods/_BUTTON_.SET_PASSWORD().htm)


which seems to offer what you want.

Raymond Lyons
04-14-2008, 02:53 AM
Rudy,

I think you may need something like:


dim ptr as P
ptr = form.load("Test1")
ptr.show()
BP_BUTTON_PASSWORD(ptr.button1.this)
However, this will not save the change for future or other use. I am not sure but I do not think there is a simple way to do this with a function. Seems like the layout would need to be opened in design mode via xbasic, the pw changed and then the save layout. I know of no way to do this (if anyone does, please enlighten us).

What you could do is roll your own button password system, using a table of encrypted passwords, then (probably) have your autoexec read them to set global variables and then use those in your own button password routines. OR, something similar--I don't actually do this so I am not sure of the best way (as if mine would be the best way anyway!).

Ray

Tom Cone Jr
04-14-2008, 06:55 AM
Rudy, it occurs to me that another approach to this might give you the flexibility you need, though I haven't implemented it in a runtime environment myself. How about implementing security for the database as a whole, assigning users to groups. When the button is pushed if the user doesn't belong to an authorized group display an appropriate message box and end the script. Presumably the administrator could change users groups and passwords even in the runtime environment, though I haven't actually tested this in practice.

Rudy16
04-14-2008, 07:22 AM
Thaks to all of you for responding. I'll give all ideas consideration and play around to see what works. Once I have a tested solution, I'll post it for others to share.

I've never written code before and use the "pick list" approach. It's going to take some time for me to learn xbasic, etc. From what I read, the easy way and workaround would be to install the development version at the clients site, and have a hidden hot spot button that would open up to design mode of Alpha, change all the passwords, save all the forms and re-set it back to production/run-time mode.

It would be so nice and clean if somehow, Alpha had an upgrade that allowed you to do it in runtime mode which you could set in Action Scripting..

Thanks again,
Rudy

Stan Mathews
04-14-2008, 09:31 AM
It would be so nice and clean if somehow, Alpha had an upgrade that allowed you to do it in runtime mode which you could set in Action Scripting..Sounds like a suggestion for the Wishlist (http://msgboard.alphasoftware.com/alphaforum/forumdisplay.php?f=22) Area.

DaveM
04-14-2008, 11:43 AM
Tom & Rudy,

i have implemented just such a thing as you described. See the pic below of the users form. it is setup so an administrator is able to change it, but the user only see his own data and very little of it.

Each button(as needed) throuout the app uses a simple if statement to determine if tht user can go there. all the accesses are held in global variables for use on start up of the app.

user has to sign in with password and his info is used on that computer.

the see all sales people button only works for someone with permission to go there. A notice pops up if there is no permission. It is built on a conditionla object. with no permission, it never shows.

like the goto sales button executes this code.

simple if:




if gotosales = .t. then
Form.view("ProspectBuyer")
else
msgbox("NotAllowed","Your permissions do not allow this, see your administrator.",UI_OK)

end if


I suspect this could be worked into Alphas security scheme, but I alreadt built it and don't wanna make it hard for myself.

I would give the whole app to some one who wanted to dupe parts of it.

Rudy16
04-14-2008, 12:03 PM
Dave,

This is great! I would like the app to study it and paste the code into my app. I guess that I must set up the users up front like in Access and then place the code in each Button's "ON Push" script. Thanks a million in advance. Eventuall I will become proficient and help some other newie developer.

All you members are great.

Thanks again,Rudy

DaveM
04-14-2008, 12:15 PM
Rudy,

This is a very large app(even cut down). if you have a good email address, I will send you a copy with passwords to that address. You won't likely get in without it. Estmate is 50 megs.

CALocklin
04-14-2008, 12:23 PM
It's going to take some time for me to learn xbasic, etc.
Yes, xbasic takes awhile to learn but some things aren't that difficult. Verifying the password one can be done in four simple steps. (These scripts only look long because of all the comments I added.) If you create a table of encrypted passwords somewhere (I think that can easily be done with Action Scripting but I find AS difficult to use so I'm not sure), then you could put something like this in the OnPush event of the appropriate buttons. Note that words inclosed in angle brackets "<...>" must be replaced with your own values.

'Get a password from the user.
user_pswd = ui_get_password("PASSWORD","Enter password for <xxxxxxxxxx>.","")
IF user_pswd = "" 'user canceled.
END
END IF

'encrypt the password that the user entered.
user_pswd = encrypt_string( user_pswd, "<EncryptKey>" )

'Assuming the password table contains one record with a different field
'for each password, get the correct [encrypted] password from record 1
'using the 'Record Number' index.
pswd = lookupc( "F", 1, "<PasswordField>", <Password_table>, "" )

'Compare the encrypted user_pswd with the one retrieved from the table.
IF pswd <> user_pswd
ui_msg_box( "WRONG PASSWORD", "Wrong password entered.", ui_stop_symbol )
END
END IF

'The rest of the script follows OR put the above in as InLine Xbasic and
'make it the first action in your action script.

Want a "change password" script? Add this as "the rest of the script":

pswd1 = ui_get_password("PASSWORD","Enter new password for xxxxxxxxx.","")
IF pswd1 = "" 'user canceled.
END
END IF

pswd2 = ui_get_password("PASSWORD","Enter new password again.","")
IF pswd1 = "" 'user canceled.
END
END IF

IF pswd1 <> pswd2
ui_msg_box( "PASSWORD MISMATCH", "The passwords were not the same.", ui_stop_symbol )
END
END IF

pswd = encrypt_string( pswd1, "<EncryptKey>" )

tp = table.open("<Password_table>")
tp.fetch_goto(1) 'Just in case.
tp.change_begin()
tp.<PasswordField> = pswd
tp.change_end()
tp.close()

ui_msg_box( "DONE", "The password has been changed." )

Rudy16
04-14-2008, 12:40 PM
Thank you Cal. Will your xbasic scripts run in a Runtime environment?

Rudy16
04-14-2008, 12:42 PM
Dave,

Do I send you my email via your email address on your web site or post it on this message board. Not sure of the protocall.

Thanks,
Rudy

DaveM
04-14-2008, 12:44 PM
message board

Rudy16
04-14-2008, 01:03 PM
My eMail address is r_pataky@msn.com.

CALocklin
04-14-2008, 03:16 PM
Thank you Cal. Will your xbasic scripts run in a Runtime environment?Yes.

DaveM
04-14-2008, 10:06 PM
Rudy,

Most scripts will run in runtime unless pathed in some strange way.

If you were to make something with a path like "c:\abc\xyz", you would need that path to be there on every runtime you set up if it is shadowed or not.

If you keep all you app and files in one folder, you should have no problems with a single runtime.

shadowed apps need to "SOMETIMES" have the path to the server folder. Alpha provides functions for that too.