Consultor Eletrônico



Kbase P180697: 4GL/ABL: How to get a list of the _User._Userid for all the database Security Administrators?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   17/01/2011
Status: Unverified

GOAL:

4GL/ABL: How to get a list of the _User._Userid for all the database Security Administrators?

GOAL:

How to programmatically list the _User._Userid for all the database Security Administrators using 4GL/ABL?

GOAL:

How to programmatically obtain a list of _User._Userid for users previously designated as Security Administrators via the Data Administration Tool: Admin > Security > Security Administrators?

FACT(s) (Environment):

All Supported Operating Systems
Progress 9.x
OpenEdge Category: Language (4GL/ABL)

FIX:


In Progress 9.x, a database Security Administrator is any user who has _Can-Create and _Can-Delete permissions to the _User table.

The fllowing code constructs a list of all the Security Administrators for the connected 9.x database:

DEFINE VARIABLE cSecurityAdministratorList AS CHARACTER NO-UNDO.
DEFINE VARIABLE cCanCreateList AS CHARACTER NO-UNDO.
DEFINE VARIABLE cCanDeleteList AS CHARACTER NO-UNDO.
DEFINE VARIABLE cThisCanCreateUser AS CHARACTER NO-UNDO.
DEFINE VARIABLE iCounter AS INTEGER NO-UNDO.
DEFINE VARIABLE iNumCanCreate AS INTEGER NO-UNDO.
FIND _File WHERE _File-Name = "_User" AND _Can-Create <> "" AND _Can-Delete <> "" NO-LOCK NO-ERROR.
IF AVAILABLE (_File) THEN DO:
ASSIGN
cCanCreateList = _File._Can-Create
cCanDeleteList = _File._Can-Delete
iNumCanCreate = NUM-ENTRIES(cCanCreateList).
END.
DO iCounter = 1 TO iNumCanCreate:
ASSIGN
cThisCanCreateUser = ENTRY ( iCounter , cCanCreateList).
IF LOOKUP ( cThisCanCreateUser, cCanDeleteList) > 0 THEN
cSecurityAdministratorList = cSecurityAdministratorList + "," + cThisCanCreateUser.
END.
MESSAGE LEFT-TRIM(cSecurityAdministratorList, ",")
VIEW-AS ALERT-BOX INFO BUTTONS OK.