bedatadriven / activityinfo-R

ActivityInfo R Language Client
https://www.activityinfo.org/support/docs/R/
18 stars 12 forks source link

Show `userLicenseType` in getDatabaseUsers() (Ticket: 8786) #128

Open Ryo-N7 opened 4 months ago

Ryo-N7 commented 4 months ago

Hi all,

This is already a ticket and I know you guys are working on it but since I made my own changes recently, I thought I'd contribute along with a few other minor improvements.

    null2na <- function(y) if (is.null(y) || !nzchar(y)) NA else y

    usersDF <- data.frame(
      databaseId = unlist(lapply(users, function(x) {x$databaseId})),
      userId = unlist(lapply(users, function(x) {x$userId})),
      name = unlist(lapply(users, function(x) {x$name})),
      email = unlist(lapply(users, function(x) {x$email})),
      version = unlist(lapply(users, function(x) {x$version})),
      inviteDate = as.Date(unlist(lapply(users, function(x) {x$inviteDate}))),
      lastLoginDate = as.Date(unlist(lapply(users, function(x) null2na(x$lastLoginDate)))),
      deliveryStatus = unlist(lapply(users, function(x) {x$deliveryStatus})),
      inviteAccepted = unlist(lapply(users, function(x) {x$inviteAccepted})),
      activationStatus = unlist(lapply(users, function(x) {x$activationStatus})),
      userLicenseType = unlist(lapply(users, function(x) {x$userLicenseType}))
      # role = lapply(users, function(x) {x$role})
    )