Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members  

StrongroomCore Class Reference

#include <StrongroomCore.h>

List of all members.

Public Methods

 StrongroomCore (string coreConfFile)
 ~StrongroomCore ()
CoreError coreStart ()
CoreError systemShutdown (const UserProfile &admin)
void log (const string &message, int level=0)
CoreError createDocument (const UserProfile &user, const Document &document, NumID &docid)
CoreError deleteDocument (const UserProfile &user, NumID docid)
CoreError changeDocument (const UserProfile &user, NumID docid, NumID fileid, string mimetype, NumID &revid)
CoreError deleteRevision (const UserProfile &user, NumID docid, NumID revid)
CoreError addRendition (const UserProfile &user, NumID docid, NumID revid, NumID fileid, string mimetype)
CoreError getDocumentInfo (const UserProfile &user, NumID docid, Document &document)
CoreError changeDocumentInfo (const UserProfile &user, NumID docid, const Document &document)
CoreError getDocument (const UserProfile &user, NumID docid, NumID revid, string mimetype, NumID &fileid, int64_t &length)
CoreError queryUpdates (const UserProfile &user, NumID first, int maxlen, map< NumID, NumID > &updates)
CoreError getLoginChallenge (string username, string &challenge)
CoreError loginUser (string username, string challenge, string response, UserProfile &user)
CoreError addUser (const UserProfile &admin, const UserProfile &userProfile, string challenge, string password, NumID &userid)
CoreError deleteUser (const UserProfile &admin, NumID userid)
CoreError getUserProfile (const UserProfile &admin, NumID userid, UserProfile &userProfile)
CoreError changeUserProfile (const UserProfile &admin, NumID userid, const UserProfile &userProfile)
CoreError setPassword (const UserProfile &user, string challenge, string oldPassword, string newPassword)
CoreError clearPassword (const UserProfile &admin, NumID userid)
CoreError listUsers (const UserProfile &admin, vector< NumID > &users)
CoreError createNewFile (const UserProfile &user, NumID docid, NumID revid, NumID &fileid)
CoreError deleteNewFile (NumID fileid)
int readFromFile (NumID fileid, uint8_t *buffer, int maxlen)
int writeToFile (NumID fileid, const uint8_t *buffer, int length)
CoreError closeFile (NumID fileid)
CoreStatus coreStatus ()


Detailed Description

The StrongroomCore class is the heart of the running Strongroom system. It loads and configures all the modules and it makes sure all the necessary subtasks are performed when a user initiates an action.

The core provides the User module with an interface to all the major functions of the Strongroom system. The core has methods to manage files, metadata and security issues. It will also ensure that the security module performs security checks on all sensitive operations.

Security checks are done by supplying the users NumID to the core. It is very important that the User module retrieves these ID's from the security module. Users must NEVER be able to supply NumID's themselves, or they could freely access sensitive information.


Constructor & Destructor Documentation

StrongroomCore::StrongroomCore (  string    coreConfFile ) 
 

Constructs a new StrongroomCore object using the supplied configuration file.

Parameters:
coreConfFile 

StrongroomCore::~StrongroomCore (    ) 
 

Destructor


Member Function Documentation

CoreError StrongroomCore::addRendition (  const UserProfile &    user,
NumID    docid,
NumID    revid,
NumID    fileid,
string    mimetype
) 
 

Add rendition to existing document revision.

Parameters:
user  the user that wishes to add a rendition
docid  the document ID
revid  the revision ID
fileid  the ID of the new rendition file
mimetype  the mimetype for the rendition
Returns:
status code

CoreError StrongroomCore::addUser (  const UserProfile &    admin,
const UserProfile &    userProfile,
string    challenge,
string    password,
NumID &    userid
) 
 

Adds a new user to the system.

Parameters:
admin  the user that is requesting this operation
userProfile  the profile for the new user
challenge  the challenge that was presented to the user
password  the password for the new user
userid  the reference that receives the ID of the newly created user
Returns:
status code.

CoreError StrongroomCore::changeDocument (  const UserProfile &    user,
NumID    docid,
NumID    fileid,
string    mimetype,
NumID &    revid
) 
 

Makes a revision of an existing document.

Parameters:
user  the user that wishes to revise the document
docid  the ID of the document that is to be revised
fileid  the ID of the new revision file
mimetype  the mimetype for the revision
revid  the variable that will be filled with the id of the revision
Returns:
status code

CoreError StrongroomCore::changeDocumentInfo (  const UserProfile &    user,
NumID    docid,
const Document &    document
) 
 

Changes a document's metadata.

Parameters:
user  the user that is requesting this operation.
docid  the document's ID.
document  the new metadata.
Returns:
status code

CoreError StrongroomCore::changeUserProfile (  const UserProfile &    admin,
NumID    userid,
const UserProfile &    userProfile
) 
 

Changes a user's profile.

Parameters:
admin  the user that is requesting this operation
userid  the ID of the user of which to change the user profile
userProfile  the new user profile
Returns:
status code.

CoreError StrongroomCore::clearPassword (  const UserProfile &    admin,
NumID    userid
) 
 

Clear user password.

Parameters:
admin  the user that is requesting this operation
userid  the ID of the user of which to clear the password
Returns:
status code.

CoreError StrongroomCore::closeFile (  NumID    fileid ) 
 

Close the file.

Parameters:
fileid  the file to close
Returns:
status code

CoreError StrongroomCore::coreStart (    ) 
 

Starts the core. This is called by main() only. It passes control to the usermodule. It returns control to main() after an admin has logged in and ordered coreShutdown()

Returns:
status code describing possible errors during startup.

CoreStatus StrongroomCore::coreStatus (    ) 
 

Reports on the core's current status.

Returns:
the core's current status.

CoreError StrongroomCore::createDocument (  const UserProfile &    user,
const Document &    document,
NumID &    docid
) 
 

Creates a new, empty document.

Parameters:
user  the user submitting the document.
document  the metadata associated with the document.
docid  address that will be filled with the new doc id.
Returns:
status code.

CoreError StrongroomCore::createNewFile (  const UserProfile &    user,
NumID    docid,
NumID    revid,
NumID &    fileid
) 
 

Create new file for changeDocument or addRendition.

Parameters:
user  the user requesting a file
docid  the document that will eventually own the file
revid  the revision (only for addRendition)
fileid  the reference that receives the new file ID on success
Returns:
status code.

CoreError StrongroomCore::deleteDocument (  const UserProfile &    user,
NumID    docid
) 
 

Deletes a document from the system completely!

Parameters:
user  the user that wants to delete the document.
docid  the ID of the document that is to be deleted.
Returns:
status code.

CoreError StrongroomCore::deleteNewFile (  NumID    fileid ) 
 

Cancel, delete (temporary) new file.

Parameters:
fileid  the file to delete
Returns:
status code.

CoreError StrongroomCore::deleteRevision (  const UserProfile &    user,
NumID    docid,
NumID    revid
) 
 

Deletes a specific revision.

Parameters:
user  the user requesting the revision.
docid  the document ID.
revid  the revision ID.
Returns:
status code.

CoreError StrongroomCore::deleteUser (  const UserProfile &    admin,
NumID    userid
) 
 

Deletes a user from the system.

Parameters:
admin  the user that is requesting this operation
userid  the ID of the user to be deleted from the system
Returns:
status code.

CoreError StrongroomCore::getDocument (  const UserProfile &    user,
NumID    docid,
NumID    revid,
string    mimetype,
NumID &    fileid,
int64_t &    length
) 
 

Retrieves documents from the system.

Parameters:
user  the user that is requesting the file.
docid  the document's ID.
revision  the revision id.
mimeType  the desired document format.
fileid  the reference that receives the file id
length  the reference that receives the length of the file
Returns:
status code.

CoreError StrongroomCore::getDocumentInfo (  const UserProfile &    user,
NumID    docid,
Document &    document
) 
 

Retrieves document metadata from the system.

Parameters:
user  the user that is requesting the metadata.
docid  the document's ID.
document  to a location that will be filled with a new Metadata object.
Returns:
status code.

CoreError StrongroomCore::getLoginChallenge (  string    username,
string &    challenge
) 
 

Get login challenge for generic challenge-response protocol.

Parameters:
username  the name of the user trying to login
challenge  the reference that receives the challenge
Returns:
status code.

CoreError StrongroomCore::getUserProfile (  const UserProfile &    admin,
NumID    userid,
UserProfile &    userProfile
) 
 

Retrieves a user's profile.

Parameters:
admin  the user that is requesting the user profile
userid  the ID of the user for the user profile
userProfile  the reference that receives the user profile
Returns:
status code.

CoreError StrongroomCore::listUsers (  const UserProfile &    admin,
vector< NumID > &    users
) 
 

Retrieves a list of all users (list of IDs).

Parameters:
admin  the user that is requesting the list
users  the reference that receives the user IDs
Returns:
status code.

void StrongroomCore::log (  const string &    message,
int    level = 0
) 
 

Writes messages to the logplugin.

CoreError StrongroomCore::loginUser (  string    username,
string    challenge,
string    response,
UserProfile &    user
) 
 

Login user.

Parameters:
username  the name of the user trying to login
challenge  the challenge returned by getLoginChallenge()
response  the response for challenge
user  the reference that receives the user on success
Returns:
status code.

CoreError StrongroomCore::queryUpdates (  const UserProfile &    user,
NumID    first,
int    maxlen,
map< NumID, NumID > &    updates
) 
 

Query document changes since 'first'.

Parameters:
user  the user that is requesting the updates
first  the first update to return
maxlen  the maximum number of updates to return
updates  the reference that receives the updates
Returns:
error code

int StrongroomCore::readFromFile (  NumID    fileid,
uint8_t *    buffer,
int    maxlen
) 
 

Read binary data from the file.

Parameters:
fileid  the file to read from
buffer  a pointer to the data.
maxlen  the maximum number of bytes to read.
Returns:
the number of bytes actually read or -1 on failure.

CoreError StrongroomCore::setPassword (  const UserProfile &    user,
string    challenge,
string    oldPassword,
string    newPassword
) 
 

Change current user's password.

Parameters:
user  the user that is requesting this operation
challenge  the challenge that was presented to the user
oldPassword  the old password of the user
newPassword  the new password for the user
Returns:
status code.

CoreError StrongroomCore::systemShutdown (  const UserProfile &    admin ) 
 

Prepares the system for shutdown. The core will shut down all modules one by one before returning control to main().

Returns:
possible errors during shutdown.

int StrongroomCore::writeToFile (  NumID    fileid,
const uint8_t *    buffer,
int    length
) 
 

Write binary data to the file.

Parameters:
fileid  the file to write to
buffer  a pointer to the data.
length  the length of the data buffer in bytes.
Returns:
the number of bytes actually written or -1 on failure


The documentation for this class was generated from the following files:
Generated on Wed Feb 18 13:45:57 2004 for strongroom by doxygen1.2.18