| 1 |
#' Lookup Users and Groups on a system |
| 2 |
#' |
| 3 |
#' These functions use the GETPWENT(3) and GETGRENT(3) system calls to query |
| 4 |
#' users and groups respectively. |
| 5 |
#' |
| 6 |
#' @return They return their results in a `data.frame`. On windows both |
| 7 |
#' functions return an empty `data.frame` because windows does not have user |
| 8 |
#' or group ids. |
| 9 |
#' @name id |
| 10 |
#' @export |
| 11 |
#' @examples |
| 12 |
#' # list first 6 groups |
| 13 |
#' head(group_ids()) |
| 14 |
#' |
| 15 |
#' # list first 6 users |
| 16 |
#' head(user_ids()) |
| 17 |
group_ids <- function() { |
| 18 |
res <- .Call(fs_groups_) |
| 19 |
res <- unique(res[order(res$group_id), ]) |
| 20 |
row.names(res) <- NULL |
| 21 |
res |
| 22 |
} |
| 23 |
|
| 24 |
|
| 25 |
#' @rdname id |
| 26 |
#' @export |
| 27 |
user_ids <- function() { |
| 28 |
res <- .Call(fs_users_) |
| 29 |
res <- unique(res[order(res$user_id), ]) |
| 30 |
row.names(res) <- NULL |
| 31 |
res |
| 32 |
} |