The Security API topic is one of the most comprehensive in the IBM i Information Center API section. In release 6.1, the security APIs are divided into eight subcategories, including Security-related APIs, Digital Certificate Management APIs, User Function Registration APIs, and Validation List APIs, to mention a few. And each subcategory comprises many APIs. One of the largest groups is the Security-related APIs, from which I’ve picked an API for today’s issue of APIs by Example.
The API in question was given the rather lengthy name of List Objects a User Is Authorized to, Owns, or Is Primary Group of (QSYLOBJA) API. The API capacity demonstrated here relates to object ownership. For a specified user profile the QSYLOBJA API lists all objects owned by the user profile to a user space. From there on, the object list is processed using the Retrieve Pointer to User Space (QUSRPTRUS) API and pointer arithmetic. In this API example I use the QSYLOBJA API–produced object list as the foundation for a CL command that lets you transfer object ownership from one user profile to another.
Download the save file containing the source code.