Grassroots Infrastructure
The Grassroots Infrastructure is a suite of computing tools to help users and developers use scientific data infrastructure that can easily be interconnected.
User Struct Reference

A datatype to store user credentials. More...

#include <user_details.h>

Public Member Functions

GRASSROOTS_USERS_API UserAllocateUser (bson_oid_t *id_p, const char *email_s, const char *forename_s, const char *surname_s, const char *org_s, const char *orcid_s)
 Allocate a User with the given details. More...
 
GRASSROOTS_USERS_API void FreeUser (User *user_p)
 Free a User. More...
 
GRASSROOTS_USERS_API json_t * GetUserAsJSON (const User *user_p, const ViewFormat vf)
 Get the json for a User. More...
 
GRASSROOTS_USERS_API UserGetUserFromJSON (const json_t *user_json_p)
 Get a User from a json representation. More...
 
GRASSROOTS_USERS_API UserGetUserFromNamedJSON (const json_t *json_p, const char *user_key_s)
 Get a User from a json representation which is the named child object of the given json. More...
 
GRASSROOTS_USERS_API bool AddUserToJSON (const User *user_p, json_t *json_p, const char *const user_key_s, const ViewFormat vf)
 Add a compound User json to another piece of json. More...
 
GRASSROOTS_USERS_API char * GetFullUsername (const User *user_p)
 Get the full name of a a User. More...
 
GRASSROOTS_USERS_API void FreeFullUsername (char *name_s)
 Free a username that was previously generated by a call to GetFullUsername(). More...
 

Data Fields

bson_oid_t * us_id_p
 
char * us_email_s
 The user's email address. More...
 
char * us_surname_s
 The user's surname(s) More...
 
char * us_forename_s
 The user's forename(s) More...
 
char * us_org_s
 The organisation that the user is associated with. More...
 
char * us_orcid_s
 The user's orcid. More...
 

Detailed Description

A datatype to store user credentials.

Member Function Documentation

◆ AllocateUser()

GRASSROOTS_USERS_API User * AllocateUser ( bson_oid_t *  id_p,
const char *  email_s,
const char *  forename_s,
const char *  surname_s,
const char *  org_s,
const char *  orcid_s 
)

Allocate a User with the given details.

Parameters
email_sThe email address of the user. This is required.
forename_sThe first name of this user. This is required.
forename_sThe last name of this user. This is required.
org_sThe organisation that this User belongs to. This can be NULL.
orcid_sThe ORCID for this User. This can be NULL.
Returns
A newly-allocated User or NULL upon error.

◆ FreeUser()

GRASSROOTS_USERS_API void FreeUser ( User user_p)

Free a User.

Parameters
user_pThe User to free.

◆ GetUserAsJSON()

GRASSROOTS_USERS_API json_t * GetUserAsJSON ( const User user_p,
const ViewFormat  vf 
)

Get the json for a User.

Parameters
user_pThe User to get the json for.
Returns
The json representation or NULL upon error.

◆ GetUserFromJSON()

GRASSROOTS_USERS_API User * GetUserFromJSON ( const json_t *  user_json_p)

Get a User from a json representation.

Parameters
user_json_pThe json representation.
Returns
The User or NULL upon error.

◆ GetUserFromNamedJSON()

GRASSROOTS_USERS_API User * GetUserFromNamedJSON ( const json_t *  json_p,
const char *  user_key_s 
)

Get a User from a json representation which is the named child object of the given json.

Parameters
json_pThe json object containing the user json representation as a child object.
user_key_sThe key for the child object.
Returns
The User or NULL upon error.

◆ AddUserToJSON()

GRASSROOTS_USERS_API bool AddUserToJSON ( const User user_p,
json_t *  json_p,
const char *const  user_key_s,
const ViewFormat  vf 
)

Add a compound User json to another piece of json.

Parameters
user_pThe User to add the json for.
json_pThe json object to add the user json to.
user_key_sThe key to use to add the user's json value to json_p.
Returns
true if the User's json was added successfully, code>false otherwise.

◆ GetFullUsername()

GRASSROOTS_USERS_API char * GetFullUsername ( const User user_p)

Get the full name of a a User.

Parameters
user_pThe User to get the name for
Returns
The newly-allocated string containing the User's name or NULL upon error. This should be freed using FreeFullUsername()
See also
FreeFullUsername

◆ FreeFullUsername()

GRASSROOTS_USERS_API void FreeFullUsername ( char *  name_s)

Free a username that was previously generated by a call to GetFullUsername().

Parameters
name_sThe name to free
See also
GetFullUsername

Field Documentation

◆ us_id_p

bson_oid_t* us_id_p

◆ us_email_s

char* us_email_s

The user's email address.

◆ us_surname_s

char* us_surname_s

The user's surname(s)

◆ us_forename_s

char* us_forename_s

The user's forename(s)

◆ us_org_s

char* us_org_s

The organisation that the user is associated with.

This can be NULL

◆ us_orcid_s

char* us_orcid_s

The user's orcid.


The documentation for this struct was generated from the following file: