Try OpenEdge Now
skip to main content
Programming Interfaces
Data Management : Multi-tenant ABL : Managing access to tables with groups
 

Managing access to tables with groups

Groups have an identity, similar to tenancy for tenants, which is identified by a group name and integer ID.
When creating new group records, you might chose to implement separate shared sequences to assign key values for each group defined for a table. In the CREATE trigger, where you typically assign the key values to a record, you can test the group identity for the record in order to determine the sequence used to assign the key value. You can return the group identity for any record in a group table using the following ABL elements:
*BUFFER-GROUP-NAME and BUFFER-GROUP-ID function — Returns the the tenant group identity that owns the current record in the specified buffer.
*BUFFER-GROUP-NAME and BUFFER-GROUP-ID attribute on a buffer handle — Returns the tenant group identity that owns the current record referenced by the specified buffer handle.
You might want to identify all the groups defined for a table with groups, and the tenant membership of each group. The _Partition-Set metaschema table defines all the groups in a database, with the following fields useful for identifying related tables and tenant membership:
*_Object-Number — An integer field with the object number of the multi-tenant table for which this group is defined, and is the same value as the _File.File-Number field in the _File record that defines the table.
*_PSetID — An integer field with the group ID assigned by OpenEdge.
*_PSet-Name — A character field with the group name that you assign when defining a group for a multi-tenant table.
The _Partition-Set table is related to a _Partition-Set-Detail table by the _Object-Number and _PSetID fields. You can therefore use the following fields of _Partition-Set-Detail to identify the tenants that are members of a given group for a table:
*_TenantID — An integer field containing the tenant ID that identifies a tenant defined in the _Tenant table. For more information, see Identifying the tenants defined in a database.
*_Partition-set.id — An integer field containing the group ID that identifies a group defined in the _Partition-Set table.