Kbase P21978: 4GL/ABL: How to change a database user's password?
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  06/04/2011 |
|
Status: Verified
GOAL:
4GL/ABL: How to change a database user's password?
GOAL:
Who can change a user's password using 4GL?
GOAL:
How to programmatically change your user's password using 4GL/ABL?
GOAL:
How to programmatically change another user's password using 4GL/ABL?
FACT(s) (Environment):
All Supported Operating Systems
Progress 8.x
Progress 9.x
OpenEdge 10.x
FIX:
Users can ONLY change their own userid and password. For example, user 'jack' can change his password by executing the following code:
FIND FIRST _User WHERE _User._UserId = "jack" EXCLUSIVE-LOCK NO-ERROR.
IF AVAILABLE (_User) THEN
ASSIGN
_User._password = ENCODE("jill").
ELSE
MESSAGE "This Userid does not exist"
VIEW-AS ALERT-BOX INFO BUTTONS OK.
Database administrators may change a user's _Userid, _User-Name or _Password ONLY by DELETING and RECREATING that user's record in the _User table programmatically or using the Database Administration tool. Indeed, any user, with CREATE/DELETE/WRITE permissions to the _User table, can change another user's password by DELETING and RECREATING that user's record in the _User table using the Database Administration tool or running 4GL/ABL code similar to the following:
DEFINE VARIABLE cNewPassword AS CHARACTER NO-UNDO INITIAL 'jill'.
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 = cNewPassword.
DELETE _User.
CREATE _User.
BUFFER-COPY tempUser TO _User.
END.
ELSE
MESSAGE "This Userid does not exist"
VIEW-AS ALERT-BOX INFO BUTTONS OK.