SETUSERID function
Returns a TRUE value and assigns the user ID to the user if the user ID and password supplied to the SETUSERID function are in the _User table. If the user ID is not in the _User table or the password is incorrect, SETUSERID returns a FALSE value and does not assign the user ID to the user.
Note: Using this function overrides the database user ID previously set by either the SET-CLIENT( ) method or the SET-DB-CLIENT function.Syntax
userid
password
logical-dbname
The logical name of the database where you want to check and set your user ID. The logical database name must be a character string enclosed in quotes, or a character expression. If you do not specify this argument, the Compiler inserts the name of the database that is connected when the procedure is compiled. If you omit this argument and more than one database is connected, it results in a Compiler error.ExampleTo use the
login.p
procedure that is provided with ABL, you must define user IDs and passwords for those users who are authorized to access the database.
The
login.p
procedure uses the SETUSERID function to check the value of the user ID and password that a user enters. If the value of the function is FALSE, the procedure allows the user another try. The user has three tries to log in. The first time, the tries variable is 0; tries is 1 the second time, and 2 the third. The third time, tries is greater than 1 and the procedure exits from ABL with the QUIT statement.Notes
- Use the Userid (-U) parameter together with the Password (-P) parameter. The AVM checks the _User table for the userid supplied with the -U parameter. When it finds that userid, it compares the password supplied with the -P parameter with the password in the _User table. If the two passwords match, the AVM assigns that userid to the ABL session.
- Under the following conditions, the SETUSERID function returns a value of FALSE and does not assign a user ID to the user:
- When using the SETUSERID function, ABL returns a compiler error under the following conditions:
- When specifying the
logical-dbname
argument, you must provide the name of the logical database, not the physical database.- SETUSERID encodes the
password
argument and then compares the result with the value stored in the _User._password field of the _User table.- After SETUSERID returns a value of TRUE and assigns a user ID to a user:
- If the root user ID does not exist in the _User table, SETUSERID returns a value of FALSE when supplied with a userid of root. If the _User table does have a root entry, the user who assumes that user ID has all the privileges associated with the root user ID on UNIX.
- You must create a blank user ID ("") if you want to set the user ID to a null value.
- Table 62 shows how ABL determines a user ID on UNIX.
- Table 63 shows how ABL determines a user ID in Windows.
- See OpenEdge Development: Programming Interfaces and OpenEdge Data Management: Database Administration for more information on user privileges.
- Calling this method generates an audit event, and creates an audit record for the event in all connected audit-enabled databases according to each database’s current audit policy settings.
- Once an initial database connection is established, you can also use the SET-CLIENT( ) method (on the SECURITY-POLICY system handle) or the SET-DB-CLIENT function to set the user ID for the connection.
See alsoCONNECT statement, SET-CLIENT( ) method, SET-DB-CLIENT function, USERID function
OpenEdge Release 10.2B
|