Skip to content

Commit

Permalink
add more info on current_user here and there
Browse files Browse the repository at this point in the history
  • Loading branch information
sckott committed Dec 10, 2024
1 parent 86d8284 commit f706160
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 2 deletions.
4 changes: 4 additions & 0 deletions R/policies.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ rls_permissions <- function() {
#' @export
#' @param con a postgres or redshift connection object
#' @return the current user, scalar
#' @references <https://www.postgresql.org/docs/current/functions-info.html>
#' <https://docs.aws.amazon.com/redshift/latest/dg/r_CURRENT_USER.html>
#' @details uses PostgreSQL or Redshift `current_user` system information
#' function
#' @examplesIf has_postgres()
#' library(DBI)
#' library(RPostgres)
Expand Down
2 changes: 2 additions & 0 deletions R/row_policy.R
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ commands <- function(.data, ...) {
#' if (!dbExistsTable(con, "passwd")) {
#' setup_example_table(con, "passwd")
#' }
#' # current_user is a special system function
#' rls_tbl(con, "passwd") %>%
#' row_policy("a_good_policy") %>%
#' commands(update) %>%
Expand Down Expand Up @@ -110,6 +111,7 @@ rows_existing <- function(.data, using = NULL, sql = NULL) {
#' rows_new(TRUE) %>%
#' to(jane)
#'
#' # current_user is a special system function
#' rls_tbl(con, "passwd") %>%
#' row_policy("that_policy") %>%
#' commands(update) %>%
Expand Down
8 changes: 8 additions & 0 deletions man/rls_current_user.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/rows_existing.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/rows_new.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vignettes/rls.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ rls_policies(con)
```

`user_mod` = Normal users can update their own records, but limit
which shells a normal user is allowed to set
which shells a normal user is allowed to set (Note: `current_user` is a special system function that's part of PostgreSQL and Redshift that returns the current user)


``` r
Expand Down
2 changes: 1 addition & 1 deletion vignettes/rls.Rmd.og
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ rls_policies(con)
```

`user_mod` = Normal users can update their own records, but limit
which shells a normal user is allowed to set
which shells a normal user is allowed to set (Note: `current_user` is a special system function that's part of PostgreSQL and Redshift that returns the current user)

```{r}
policy3 <- rls_tbl(con, "passwd") %>%
Expand Down

0 comments on commit f706160

Please sign in to comment.