Get started with DDM
- Last Updated: February 11, 2026
- 7 minute read
- OpenEdge
- Version 13.0
- Documentation
- Copy the existing sample database into a new database for use in the following
steps.
-
For example, copy
Sports2020database intomysports22database.proenv>procopy $DLC/sports2020 mysports22 - Start the database server for the
mysports22database.proenv>proserve mysports22 -H localhost -S 5000
-
- Enable DDM for
mysports22.proenv>proutil mysports22 -C enableddmAfter you enable the database for DDM:Note: To check if the database is licensed for DDM, enable the DDM feature before configuring and using it.- Clients earlier than OpenEdge 12.8 that are not aware of the DDM setup may not be able to open or connect to the database.
- Activate DDM to configure it because DDM is inactive, by default.
For more information, see PROUTIL ENABLEDDM qualifier.
- If users are not already added in the database, create users using the
CreateUser()method of theOpenEdge.DataAdminpackage and add them in the database.Note: This topic generates user records solely for demonstration purposes. OpenEdge provides different and more standard ways to integrate with various user account systems, such as the built-in_oslocalauthentication system for using Operating System (OS) local accounts, external user accounts accessed by an ABL authentication callback, and the OpenEdge Authentication Gateway. For more information, see Assert user identity.-
The following example code creates the
AdminUseruser, who has the authorization to view data in DDM-configured fields:USING OpenEdge.DataAdmin.*. VAR DataAdminService oDAS. VAR IUser oUser. VAR LOGICAL lResult. VAR CHARACTER Paswrd = "password". ASSIGN oDAS = NEW DataAdminService(LDBNAME("DICTDB")). oUser = oDAS:NewUser("AdminUser"). oUser:Description = "Dummy user for DDM administration". oUser:Password = Paswrd. lResult = oDAS:CreateUser(oUser). MESSAGE "Added AdminUser to database". DELETE OBJECT oDAS.- Save the example code as create-AdminUser.p.
- To create
AdminUser, runcreate-AdminUser.p.proenv>mpro mysports22 create-AdminUser.p
- To create the
GeneralUseruser, who does not have the authorization to view data in the DDM-configured fields, run the following example code:USING OpenEdge.DataAdmin.*. VAR DataAdminService oDAS. VAR IUser oUser. VAR LOGICAL lResult. VAR CHARACTER Paswrd = "password". ASSIGN oDAS = NEW DataAdminService(LDBNAME("DICTDB")). oUser = oDAS:NewUser("GeneralUser"). oUser:Description = "Dummy general user". oUser:Password = Paswrd. lResult = oDAS:CreateUser(oUser). MESSAGE "Added GeneralUser to database". DELETE OBJECT oDAS.- Save the example code as create-GeneralUser.p.
- To create
GeneralUser, runcreate-GeneralUser.p.proenv>mpro mysports22 create-GeneralUser.p
Note: BecauseAdminUseris the first non-blank user for themysports22database, the blank user no longer has security administrator rights for any connections to the database. Therefore, after runningcreate-GeneralUser.p, you must log in with theAdminUseruser ID and password to createGeneralUser.
-
- Grant the security administrator privileges to the currently logged-in user.
This step is optional but recommended. In the absence of a DDM administrator,
either the ABL security administrator or the SQL DBA acts as a DDM
administrator. Therefore, they are granted this permission for convenience in
initial configuration and protection against losing all DDM administrators.
The following example code grants the security administrator privileges to the currently logged-in user:
using OpenEdge.DataAdmin.DataAdminService from propath. using OpenEdge.DataAdmin.IAdministrator from propath. define variable administrator as class IAdministrator no-undo. define variable service as class DataAdminService no-undo. define variable okay as logical no-undo. DEF VAR cSecadminUser AS CHAR NO-UNDO. cSecadminUser = USERID. message "Adding " + cSecadminUser + " as security admin". assign service = new DataAdminService (LDBNAME(1)). assign administrator = service:getAdministrator ( ). assign administrator:administrators = cSecadminUser. assign okay = service:updateAdministrator ( input administrator ). PAUSE 10. QUIT.- Save the example code as secadmin.p.
- To grant security administrator privileges to
AdminUser, run secadmin.p.proenv>mpro mysports22 -U AdminUser -P password secadmin.p
-
To determine user privileges for accessing the masked data, create a new role for database users (user-to-role mapping).
The following example code creates the
PAYROLLrole, which regulates the privileges granted to users for data unmasking:USING OpenEdge.DataAdmin.*. VAR DataAdminService oDAS. VAR IRole oRole. VAR LOGICAL lResult. ASSIGN oDAS = NEW DataAdminService(LDBNAME("DICTDB")). oRole = oDAS:NewRole("Payroll"). oRole:Description = "Admin User Role". // This role will be used for Dynamic Data Masking oRole:IsDDM = true. lResult = oDAS:CreateRole(oRole). MESSAGE "Added Payroll Role". DELETE OBJECT oDAS.- Save the example code as addRole.p.
- Run addRole.p.
proenv>mpro mysports22 -U AdminUser -P password addRole.p
- Create an authorization tag and associate it with the role created in Step 6. An
authorization tag establishes the connection between the user-defined DDM roles
and the fields of a table to which a mask is to be applied.
The following example code associates the
#DDM_SEE_ContactInfoauthorization tag with thePAYROLLrole:USING OpenEdge.DataAdmin.*. VAR DataAdminService service. VAR IAuthTag oTag. VAR LOGICAL lReturn. ASSIGN service = new DataAdminService (LDBNAME("DICTDB")). oTag = service:NewAuthTag("#DDM_SEE_ContactInfo"). oTag:RoleName = service:GetRole("Payroll"):Name. oTag:description = "Can see contact info". lRETURN = service:CreateAuthTag(oTag). MESSAGE "Added Payroll to #DDM_SEE_ContactInfo". QUIT.- Save the example code as setAuthTagRole.p.
-
Run setAuthTagRole.p.
proenv>mpro mysports22 -U AdminUser -P password setAuthTagRole.p
- Grant user-defined roles to authorized users.
The following example code grants the
PAYROLLrole toAdminUser:USING OpenEdge.DataAdmin.*. VAR DataAdminService oDAS. VAR IGrantedRole oRole. VAR IUser oUser. VAR LOGICAL lResult = FALSE. ASSIGN oDAS = NEW DataAdminService(LDBNAME("DICTDB")). oRole = oDAS:NewGrantedRole(). oRole:Role = oDAS:GetRole("Payroll"). oUser = oDAS:GetUser("AdminUser"). IF VALID-OBJECT(oRole:Role) AND VALID-OBJECT(oUser) THEN DO: oRole:Grantee = oUser:Name. IF oUser:Domain:Name NE "" THEN oRole:Grantee = oRole:Grantee + "@" + oUser:Domain:Name. oRole:CanGrant = false. // Cannot grant to others. // Granting Role to AdminUser lResult = oDAS:CreateGrantedRole(oRole). END.- Save the example code as grantRole.p.
- Run grantRole.p.
proenv>mpro mysports22 -U AdminUser -P password grantRole.p
- Add a mask to the field that specifies what a user sees if they are not
authorized to view the unmasked data. The types of masks available are: default,
literal, partial, and null.
- Default mask—To configure the default mask (prefix
D:), the following example code uses thesetDDMConfig()method and the#DDM_SEE_ContactInfoauthorization tag for thestatefield of theCustomertable.USING OpenEdge.DataAdmin.DataAdminService FROM PROPATH. DEFINE VARIABLE service AS DataAdminService NO-UNDO. DEFINE VARIABLE lResult AS LOGICAL NO-UNDO. service = NEW DataAdminService(LDBNAME("DICTDB")). lResult = service:setDDMConfig("customer","state","D:","#DDM_SEE_ContactInfo"). MESSAGE "Added Default mask". QUIT.- Save the example code as addDefaultMask.p.
-
Run addDefaultMask.p.
proenv>mpro mysports22 -U AdminUser -P password addDefaultMask.p
- Literal mask—To configure the literal mask (prefix
L:), the following example code uses thesetDDMConfig()method and the#DDM_SEE_ContactInfoauthorization tag for thecityfield of theCustomertable.USING OpenEdge.DataAdmin.DataAdminService FROM PROPATH. DEFINE VARIABLE service AS DataAdminService NO-UNDO. DEFINE VARIABLE lResult AS LOGICAL NO-UNDO. service = NEW DataAdminService(LDBNAME("DICTDB")). lResult = service:setDDMConfig("customer","city","L:MASKED","#DDM_SEE_ContactInfo"). MESSAGE "Added Literal mask". QUIT.- Save the example code as addLiteralMask.p.
-
Run addLiteralMask.p.
proenv>mpro mysports22 -U AdminUser -P password addLiteralMask.p
- Partial mask—To configure the partial mask (prefix
P:), the following example code uses thesetDDMConfig()method and the#DDM_SEE_ContactInfoauthorization tag for thephonefield of theCustomertable.USING OpenEdge.DataAdmin.DataAdminService FROM PROPATH. DEFINE VARIABLE service AS DataAdminService NO-UNDO. DEFINE VARIABLE lResult AS LOGICAL NO-UNDO. service = NEW DataAdminService(LDBNAME("DICTDB")). lResult = service:setDDMConfig("customer","phone","P:0,X,4","#DDM_SEE_ContactInfo"). MESSAGE "Added Partial mask". QUIT.-
Save the example code as addPartialMask.p.
- Run addPartialMask.p.
proenv>mpro mysports22 -U AdminUser -P password addPartialMask.p
-
- Null mask—To configure the null mask (prefix
N:), the following example code uses thesetDDMConfig()method and the#DDM_SEE_ContactInfoauthorization tag for theaddressfield of theCustomertable.USING OpenEdge.DataAdmin.DataAdminService FROM PROPATH. DEFINE VARIABLE service AS DataAdminService NO-UNDO. DEFINE VARIABLE lResult AS LOGICAL NO-UNDO. service = NEW DataAdminService(LDBNAME("DICTDB")). lResult = service:setDDMConfig("customer","address","N:","#DDM_SEE_ContactInfo"). MESSAGE "Added Null mask". QUIT.-
Save the example code as addNullMask.p.
-
Run addNullMask.p.
proenv>mpro mysports22 -U AdminUser -P password addNullMask.p
-
- Default mask—To configure the default mask (prefix
- To initiate the application of masks on the designated fields. activate
DDM
proenv>proutil mysports22 -C activateddmACTIVATEDDMensures that the DDM policies you have set up are honored. All connected clients must comply with the policies and mask configurations that have been set up.For more information, see PROUTIL ACTIVATEDDM qualifier.
-
View data from the
Customertable.-
Save the following example code as findFirstCustomer.p. This code displays the first row of the
Customertable, which includes theCustnum,Name,Address,State,City,Postalcode, andPhonefields.FIND FIRST Customer. DISPLAY custnum name address state city postalcode phone WITH 1 columns. PAUSE 60. QUIT. - Run
findFirstCustomer.pasAdminUser.
Output forproenv>mpro mysports22 -U AdminUser -P password findFirstCustomer.pAdminUser:Cust Num: 3000 Name: Lift Tours Address: 276 North Drive State: MA City: Burlington Postal Code: 01730 Phone: (617) 450-0086AdminUsercan access and view unmasked data in the DDM-configured fields. - RunOutput for
findFirstCustomer.pasGeneralUser.proenv>mpro mysports22 -U GeneralUser -P password findFirstCustomer.pGeneralUser:Cust Num: 3000 Name: Lift Tours Address: ? State: XX City: MASKED Postal Code: 01730 Phone: XXXXXXXXXX0086GeneralUserviews masked data in the DDM-configured fields.
-
-
For more information about how to deactivate or disable DDM, see PROUTIL DEACTIVATEDDM qualifier and PROUTIL DISABLEDDM qualifier.
- The
IDataAdminServiceinterface provides a set of methods that enable the execution of CRUD operations pertaining to DDM. These methods are utilized for managing:- User-defined roles
- Users
- Role grants or user-to-role mapping
- Authorization tags
- Setting or unsetting the mask and authorization tag for any field in a table
IDataAdminServicemethods, see IDataAdminService interface.