Learn R Programming

rdav (version 0.3.0)

ocs_create_share: Creates a share

Description

Creates different share types:

Usage

ocs_create_share(
  req,
  path,
  share_type,
  share_with = NULL,
  password = NULL,
  permissions = 1,
  public_upload = FALSE,
  expire_date = NULL,
  label = "",
  note = "",
  send_mail = FALSE,
  attributes = NULL
)

ocs_create_share_link( req, path, password = NULL, permissions = 1, public_upload = FALSE, expire_date = NULL, note = "", label = "" )

ocs_create_share_mail( req, path, email, password = NULL, permissions = 1, public_upload = FALSE, expire_date = NULL, note = "", label = "", send_mail = TRUE )

ocs_create_share_user( req, path, user, permissions = 1, public_upload = FALSE, expire_date = NULL, note = "", label = "", send_mail = TRUE )

ocs_create_share_group( req, path, group, permissions = 1, public_upload = FALSE, expire_date = NULL, note = "", label = "", send_mail = TRUE )

ocs_create_share_federated( req, path, cloud_id, permissions = 1, public_upload = FALSE, expire_date = NULL, note = "", label = "", send_mail = TRUE )

Value

information for the newly created share as data.frame

Arguments

req

WebDAV request as returned by wd_connect

path

folder or file path

share_type

integer 0:user, 1:group, 3:link, 4:e-mail, 6:federated

share_with

depending on share type: user id, group id, e-mail address or federated cloud id (only for ocs_create_share)

password

optional password for link and e-mail shares

permissions

integer or char vector (1:read, 2:update, 4:create, 8:delete, 16:share), default is 1:read

public_upload

TRUE if public upload should be enabled

expire_date

expiration date as string in the format YYYY-MM-DD

label

label for the share

note

note for the share

send_mail

if TRUE the user is notified via e-mail

attributes

optional attributes

email

e-mail address (only for ocs_create_share_mail)

user

id of the user (only for ocs_create_share_user)

group

id of the group (only for ocs_create_share_group)

cloud_id

cloud id (only for ocs_create_share_federated)

Details

  • ocs_create_share - generic method that takes share type as argument

  • ocs_create_share_user - creates a share for a nextcloud user

  • ocs_create_share_group - creates a share for a nextcloud group

  • ocs_create_share_link - create a public share link

  • ocs_create_share_mail - creates an e-mail share

  • ocs_create_share_federated - creates a federated share

Notice: if protecting a public link or e-mail share with a password, make sure that the password meets the services' password policy.

Share permissions can be given as vector of integers or characters, e.g. c(1, 2, 8) or c("read", "update", "delete"), or as their sum or concatenation, e.g. 11 or "read,update,delete".

Examples

Run this code
if (FALSE) {
r <- wd_connect("https://example.com/remote.php/dav/files/johndoe")
ocs_create_share(r, "myfolder/share", 4)
ocs_create_share_link(r, "myfolder/share")
ocs_create_share_mail(r, "myfolder/share", "jack@example.com")
ocs_create_share_user(r, "myfolder/share", "jackdoe", c("read", "update"))

}

Run the code above in your browser using DataLab