OCSManager Backend Requirements¶
User Registration¶
OCSManager introduces an asynchronous notification mechanism that let backends send a message when a user create or delete a context. Since notifications are specific to backends, we do not need to register a user unless a context is created for the specific backend. Furthermore, backends are responsible for the mapping between system users (OpenChange/AD ones) and users within their own backends.
mapistore_mgmt_backend_register_user¶
This function generates a message and push it onto a queue. The message is received by a remote process and used to distinguish currently logged users from unregistered ones. This function will generate a user command payload and set the status to register user. Be careful that log doesn't mean a user logged on OpenChange Server but a user who created a context on a backend. Since notifications are registered for folders - which are mapistore backend instances - we are only interested in monitoring creation and deletion of contexts.
Add a call to this function during add_context backend's call:
int mapistore_mgmt_backend_register_user(struct mapistore_connection_info *conn_info,
const char *backend,
const char *vuser);
The parameters to supply to this function are:
- a pointer on mapistore_connection_info, received in parameter to the add_context backend function
- backend: the name of the backend
- vuser: the name of the user that will be used for connection to the remote system. This username is generally specified within the mapistore URI.
You don't need to care about multiple/recurrent calls to mapistore_mgmt_backend_register_user as multiple register notifications will only result in increasing a reference counter on the notification process side. However it is mapistore backend's role to make a call to mapistore_mgmt_backend_unregister_user when the context is deleted.
mapistore_mgmt_backend_unregister_user¶
This function sends a message to the notification process and unregister the user. The notification process will decrease the reference counter and delete the user from the list when it hits 0.
int mapistore_mgmt_backend_unregister_user(struct mapistore_connection_info *conn_info,
const char *backend,
const char *vuser);
The same parameters than mapistore_mgmt_backend_register_user applies here.
This function must be called during context deletion (talloc_set_destructor call).
Manager interface for backends¶
Backends are required to implement the following methods to work with ocsmanager:
Backend patches¶
SOGo¶
To enable SOGo to register and unregister users, edit SOGo/OpenChange/MAPIStoreContext.m:- To register a user edits the openContext function (around line 174):
if (context) { *contextPtr = context; rc = MAPISTORE_SUCCESS; mapistore_mgmt_backend_register_user(newConnInfo, "SOGo", [[[context authenticator] username] UTF8String]); } } else NSLog (@"ERROR: unrecognized module name '%@'", module); } - To unregister a user edits the dealloc function and adds at the beginning of the function (around line 225):
- (void) dealloc { mapistore_mgmt_backend_unregister_user([self connectionInfo], "SOGo", [[[self authenticator] username] UTF8String]); [baseFolder release];