A SOGo API via direct database manipulation.

category OSS
package OSS_API
copyright Copyright (c) 2007 - 2013, Open Source Solutions Limited, Dublin, Ireland
license New BSD License

 Methods

Constructor - creates a new DBAL connection.

__construct(array $dbparams) : void

Parameters

$dbparams

array

Adds user profile to SOGo's database

addUserProfile(\strint $uid, bool | array $defaults, bool | array $settings) : bool

NOTICE: c_defaults and c_settings in database is stored as JSON array

access public

Parameters

$uid

\strint

New users id ( username )

$defaults

boolarray

Users profile defaults. If it false it will not be added.

$settings

boolarray

Users profile settings. If it false it will not be added.

Returns

bool

Get all exiting users profiles form SOGo database as an array.

getAllUsersProfiles() : array

NOTICE: c_defaults and c_settings in database is stored as json array

access public

Returns

arrayAll users profiles existing in the database

Gets calendar or contacts resource list for user.

getResourceNames(string $uid, bool $calendar) : array | bool

Return array structure: array(1) { [0] => array(3) { 'db_table' => string(23) "sogoopensolu00471298964" 'resource_name' => string(8) "personal" 'display_name' => string(17) "Personal Calendar" } }

Parameters

$uid

string

Users id (username) to have a list of his resources.

$calendar

bool

If it set to true then it will look for calendars. False for contacts.

Returns

arraybool

Get user's profile from the SOGo database as an array.

getUserProfile(\strint $uid) : array | bool

NOTICE: c_defaults and c_settings in database is stored as json array

access public

Parameters

$uid

\strint

User id ( usrname )

Returns

arraybool

Sets access privileges to resource for another SOGo user.

setAccessPrivileges(string $uid, string $own_uid, string $name, \strig | array $privileges, bool $calendar) : bool

First script fill find acl table name for resource. then it will remove privileges for the user and then it will add new ones.

Privileges array sample $privileges = ['ConfidentialDandTViewer','ObjectCreator','PublicViewer','ConfidentialViewer','ObjectEraser'];

Parameters

$uid

string

Users id (username) to share resource with.

$own_uid

string

Resource owner SOGo user id (username)

$name

string

Resource name for example personal.

$privileges

\strigarray

Privileges to set.

$calendar

bool

If it set to true then it will look for calendar. False for contacts.

Returns

bool

Subscribe resource

subscribeResource(string $uid, string $own_uid, string $name, bool $calendar, string $color) : bool

Parameters

$uid

string

Users id (username) which is suscribing

$own_uid

string

Resource owner SOGo user id (username)

$name

string

Resource name for subscribing

$calendar

bool

If it set to true then it will look for calendar. False for contacts.

$color

string

Color for new calendar. Applies only for calendars.

Returns

bool

Unsets access privileges to resource for another SOGo user.

unsetAccessPrivileges(string $uid, string $own_uid, string $name, bool $calendar) : bool

First script fill find acl table name for resource. then it will remove privileges for the user.

Parameters

$uid

string

Users id (username) to share resource with.

$own_uid

string

Resource owner SOGo user id (username)

$name

string

Resource name for example personal.

$calendar

bool

If it set to true then it will look for calendar. False for contacts.

Returns

bool

Updates SOGo users profile

updateUserProfile(\strint $uid, bool | array $defaults, bool | array $settings) : bool

To reset defaults or settings pass empty array. If defaults and settings will be false function will return false without even trying to process sql query.

NOTICE: c_defaults and c_settings in database is stored as JSON array

access public

Parameters

$uid

\strint

Users id to edit ( username )

$defaults

boolarray

Users profile defaults. If it false it will not be updated to null it will leave es it is.

$settings

boolarray

Users profile settings. If it false it will not be updated to null it will leave es it is.

Returns

bool