Skip to contents

These internal functions are used by the cf_user constructor function to ensure the user has a valid subscription to CliFlo.

Usage

cf_login(object, ...)

cf_logout(object, msg = TRUE, ...)

valid_cfuser(object)

Arguments

object

S4 object which inherits the cfUser class

...

Other options passed to the GET or POST functions.

msg

Display a 'successful logout' message, defaults to TRUE.

Details

cf_login initiates a curl handle storing the cookies in the current R session's temporary directory. It then POSTs the user credentials to the CliFlo login page and stores the resultant h1 heading to check for the string 'Info'. The cookies are kept for future (immediate) use.

cf_logout points the curl handle to the existing cookie session initiated with cf_login. It reads the header information from the cliflo logout page to ensure no HTTP error and logs the user out on cliflo and deletes the cookies. This should be (is) called immediately after cf_login in any function requiring a login, using on.exit to ensure the user isn't still logged in on the server, after the function call, for any reason.

valid_cfuser is the validation function for the cfUser class and uses cf_login to ensure the credentials are authenticated on the CliFlo server and then (cf_)logs out immediately afterwards. It also ensures the user provides exactly one username and password - except for 'public' users.

Examples

if (FALSE) { # \dontrun{
cf_user("public")                    # Returns a valid object
cf_user("bad_name", "bad_password")    # Bad Login
} # }