How to report list of current users with dates, groups & co

NC v20

What is easiest way to output to file (eg csv) a full list of all NC users?

I need more or less the same info which is accessible from the web interface, for instance:-

  • username, displayname, email address,
  • last login date, account created date
  • Group memberships. Group Admin status.

Ideally this could be run on demand by members of the Admin group (our Admin group members are not system admins and do not have access to “occ” commands).

Thanks

Answering own question.

The best option for getting this information is via the command line “occ” commands.

That includes:-

  • List of users with all their attributes
  • List of Groups, each with the users who are members
  • Detail of how Group Folders are set up

Terminology:

  • System Admin - person with full access to system, including command line access to server
  • Application Admin - user who is a member of the Group “admin”

We don’t want the Application Admin to be system admin - so our Application Admin will not have command line access to the system.

We are solving this problem as follows:-

  • Created Python scripts which are run regularly via Cronjob or similar
  • Python scripts run various occ commands, and save data to file in a suitable format, mostly JSON, some as CSV
  • Files are saved to the output folder within the Group Folders area which is accessible to Application Admins
  • Once all files created, the script runs the "occ groupfolders:scan GFID " which refreshes the files to database synch, so making the files visible to regular users. Group folders are created in file system with a numeric code (1, 2, 3…). So GFID is the ID of the Group folder whose sub-tree contains the output folder
  • The Application Admins have access to regularly updated info, and the System Admin does not have to do anything further, since it is automated.