Class User.

Inherits EventHandler

The User class models a single Archiveopteryx user, which may be able to log in, own Mailbox objects, etc.

User::User()

Constructs an empty User. The result does not map to anything in the database.

Reimplements EventHandler::EventHandler().

Address * User::address()

Returns the address belonging to this User object, or a null pointer if this User has no Address.

Query * User::changeSecret( EventHandler * owner )

This function changes a user's password on behalf of owner.

It returns a pointer to a Query that can be used to track the progress of the operation. If (and only if) this Query hasn't already failed upon return from this function, the caller must call execute() to initiate the operation.

Query * User::create( EventHandler * owner )

This function is used to create a user on behalf of owner.

It returns a pointer to a Query that can be used to track the progress of the operation. If (and only if) this Query hasn't already failed upon return from this function, the caller must call execute() to initiate the operation.

The query may fail immediately if the user is not valid(), or if it already exists().

This function (indeed, this whole class) is overdue for change.

void User::createHelper()

This private function carries out create() work on behalf of execute().

void User::csHelper()

Finish the work of changeSecret().

EString User::error() const

Returns a textual description of the last error seen, or a null string if everything is in order. The string is set by valid() and perhaps other functions.

bool User::exists()

Returns true if this user is known to exist in the database, and false if it's unknown or doesn't exist.

Mailbox * User::home() const

Returns the user's "home directory" - the mailbox under which all of the user's mailboxes reside.

This is read-only since at the moment, the Archiveopteryx servers only permit one setting: "/users/" + login. However, the database permits more namespaces than just "/users", so one day this may change.

uint User::id() const

Returns the user's ID, ie. the primary key from the database, used to link various other tables to this user.

Mailbox * User::inbox() const

Returns a pointer to the user's inbox, or a null pointer if this object doesn't know it or if the user has none.

UString User::ldapdn() const

Returns the user's LDAP DN, or an empty string if this user doesn't have an LDAP DN. The LDAP DN is only used for performing LDAP authentication (by LdapRelay).

UString User::login() const

Returns the User's login string, which is an empty string initially and is set up by refresh().

Mailbox * User::mailbox( const UString & name ) const

Returns the mailbox to which name refers, or a null pointer if there is no such mailbox.

UString User::mailboxName( const UString & name ) const

Returns the canonical name of the mailbox to which name refers. This need not be the name of an existing mailbox, or even well-formed.

int64 User::quota() const

Returns the user's database quota, as recorderd by users.quota.

void User::refresh( EventHandler * user )

Starts refreshing this object from the database, and remembers to call user when the refresh is complete.

void User::refreshHelper()

Parses the query results for refresh().

Query * User::remove( Transaction * t )

Enqueues a query to remove this user in the Transaction t, and returns the Query. Does not commit the Transaction.

UString User::secret() const

Returns the User's secret (password), which is an empty string until refresh() has fetched the database contents.

void User::setAddress( Address * a )

Sets this User object to have address a. The database is not updated - a is not used except maybe to search in refresh().

void User::setId( uint id )

Sets this User's id() to id.

void User::setLogin( const UString & string )

Sets this User object to have login string. The database is not updated - string is not used except to create Query objects during e.g. refresh().

void User::setSecret( const UString & secret )

Sets this User to have secret as password. The database isn't updated unless e.g. create() is called.

State User::state() const

Returns the user's state, which is either Unverified (the object has made no attempt to refresh itself from the database), Refreshed (the object was successfully refreshed) or Nonexistent (the object tried to refresh itself, but there was no corresponsing user in the database).

The state is Unverified initially and is changed by refresh().

bool User::valid()

Returns true if this user is valid, that is, if it has the information that must be present in order to write it to the database and do not have defaults.

Sets error() if applicable.

This web page based on source code belonging to The Archiveopteryx Developers. All rights reserved.