Consultor Eletrônico



Kbase P26392: 4GL/ABL: How to programmatically change a Progress Database user's id and password?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   02/12/2008
Status: Verified

GOAL:

4GL/ABL: How to programmatically change a Progress Database user's id and password?

GOAL:

How to change a Progress 4GL database _user password using 4GL?

GOAL:

Can I change my Progress database user password using 4GL?

GOAL:

Can I change another Progress database user password using 4GL?

FACT(s) (Environment):

All Supported Operating Systems
Progress 8.x
Progress 9.x
OpenEdge 10.x

FIX:

1. Any user can change their own password. For example, user "jack" can change his own password by executing the following code:

/* User 'jack' can ONLY change his OWN password */
FIND FIRST _User WHERE _User._UserId = "jack" EXCLUSIVE-LOCK NO-ERROR.
IF AVAILABLE (_User) THEN
ASSIGN
_User._password = ENCODE("NewPassword").
ELSE
MESSAGE "This Userid does not exist"
VIEW-AS ALERT-BOX INFO BUTTONS OK.
2. A Progress database Security administrator can change another user password ONLY by deleting and re-creating the user's record in the _user table. For example, the Security Administrator change the password of user 'jack' by executing the following code:

/* Security Administrator changes password of user 'jack'*/
DEFINE VARIABLE cNewPassword AS CHARACTER NO-UNDO.
DEFINE TEMP-TABLE tempUser NO-UNDO LIKE _User.
FIND FIRST _User WHERE _User._UserId = "jack" EXCLUSIVE-LOCK NO-ERROR.
IF AVAILABLE (_User) THEN DO:
BUFFER-COPY _User EXCEPT _User._Password TO tempUser.
ASSIGN
tempUser._Password = ENCODE("NewPassword").
DELETE _User.
CREATE _User.
BUFFER-COPY tempUser TO _User.
END.
ELSE
MESSAGE "This Userid does not exist"
VIEW-AS ALERT-BOX INFO BUTTONS OK.