If you wanted to do this in SAS you could use the macrocore library as follows:
/* get all users */
%mv_getusers(outds=users)
/* get all groups */
%mv_getgroups(outds=groups)
/* get users in a group */
%mv_getgroupmembers(GROUPNAME,outds=users)
/* get groups for a user */
%mv_getusergroups(USERNAME,outds=groups)
A guide to setting up the access token is available here.
Note - this only includes the users & groups that have been explicitly added to viya, ie - it's not necessarily the full list of users who can access the box.
/Allan
MacroCore library for app developers
Data Workflows, Data Contracts, Data Lineage, Drag & drop excel EUCs to SAS 9 & Viya - Data Controller
DevOps and AppDev on SAS 9 / Viya / Base SAS - SASjs