| ocsManager | R Documentation |
ocsManager
ocsManager
R6Class object.
Object of R6Class for modelling an ocsManager
ocs4R::ocs4RLogger -> ocsManager
apislist of APIs
new()This method is used to instantiate an ocsManager. The user/pwd are mandatory in order to connect to 'ocs'. The logger can be either NULL, "INFO" (with minimum logs), or "DEBUG" (for complete curl http calls logs).
The keyring_backend can be set to use a different backend for storing
the user password with keyring (Default value is NULL, meaning the password
is stored as private field).
ocsManager$new(url, user, pwd, logger = NULL, keyring_backend = NULL)
urlurl
useruser
pwdpwd
loggerlogger type
keyring_backendkeyring back-end. Default is NULL
connect()Method to connect to 'ocs' and set version/capabilities
ocsManager$connect()
getVersion()Get the 'ocs' server version
ocsManager$getVersion()
getCapabilities()Get the 'ocs' server capabilities
ocsManager$getCapabilities()
getAPIWebdavManager()Get the Webdav API manager
ocsManager$getAPIWebdavManager()
an instance of ocsApiWebdavManager
getAPISharingManager()Get the Sharing API manager
ocsManager$getAPISharingManager()
an instance of ocsApiSharingManager
getAPIUserProvisioningManager()Get the User Provisioning API manager
ocsManager$getAPIUserProvisioningManager()
an instance of ocsApiUserProvisioningManager
clone()The objects of this class are cloneable with this method.
ocsManager$clone(deep = FALSE)
deepWhether to make a deep clone.
Emmanuel Blondel <emmanuel.blondel1@gmail.com>
## Not run:
#Not Run:
#Connect to an OCS API
OCS <- ocsManager$new(url = ocs_url, user = ocs_user, pwd = ocs_pwd, logger = "DEBUG")
version <- OCS$getVersion()
caps <- OCS$getCapabilities()
#OCS User Provisioning API
#-------------------------------------
#users
users <- OCS$getUsers() #get users
user <- OCS$getUser("admin") #get a user
user.df <- OCS$getUser("admin", TRUE) #the same user as data.frame
added <- OCS$addUser("john.doe", password = "ocs4john") #add a user
disabled <- OCS$disableUser("john.doe") #disable a user
enabled <- OCS$enableUser("john.doe") #enable auser
edited <- OCS$editUser("john.doe", key = "display", value = "John Doe") #edit user
#edit some user field
edited2 <- OCS$editUserDisplayName("john.doe", displayName = "John Doe Jr.")
deleted <- OCS$deleteUser("john.doe")
#groups
admingroups <- OCS$getUserGroups("admin")
groups <- OCS$getGroups()
added <- OCS$addGroup("scientists") #add a new group
sc_group <- OCS$getGroup("scientists") #get group details
added <- OCS$addToGroup("john.doe", "scientists") #add user to group
removed <- OCS$removeFromGroup("john.doe", "scientists") #remove user from group
deleted <- OCS$deleteGroup("scientists")
#OCS Webdav API
#-------------------------------------
#list files
files <- OCS$listFiles()
subfiles <- OCS$listFiles("Documents")
#make collection
OCS$makeCollection("myfolder")
subfiles <- OCS$listFiles("myfolder")
#upload a file?
filename <- "magic.txt"
file.create(filename); writeLines("ocs4R is great", filename)
#we upload the file in 'Documents' folder
OCS$uploadFile(filename, "/Documents")
#check if file is uploaded
OCS$listFiles('Documents')
#OCS Sharing API
#-------------------------------------
#let's add a user with User provisioning API
added <- OCS$addUser("john.doe", password = "ocs4john") #add a user
#let's share the previously uploaded file with John Doe
OCS$shareWithUser("/Documents", filename, "john.doe")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.