本文整理汇总了PHP中Tinebase_User类的典型用法代码示例。如果您正苦于以下问题:PHP Tinebase_User类的具体用法?PHP Tinebase_User怎么用?PHP Tinebase_User使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Tinebase_User类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: _setFromJson
/**
* fill record from json data
*
* @param array &$data
* @return void
*/
protected function _setFromJson(array &$data)
{
/************* add new relations *******************/
if (isset($data['relations'])) {
foreach ((array) $data['relations'] as $key => $relation) {
if (!isset($relation['id'])) {
$relationData = array('own_model' => 'Sales_Model_Contract', 'own_backend' => 'Sql', 'own_id' => isset($data['id']) ? $data['id'] : 0, 'own_degree' => Tinebase_Model_Relation::DEGREE_SIBLING, 'type' => $relation['type'], 'related_record' => isset($relation['related_record']) ? $relation['related_record'] : array(), 'related_id' => isset($relation['related_id']) ? $relation['related_id'] : NULL);
switch ($relation['type']) {
case self::RELATION_TYPE_ACCOUNT:
$relationData['related_model'] = 'Tinebase_Model_User';
$relationData['related_backend'] = Tinebase_User::getConfiguredBackend();
break;
case self::RELATION_TYPE_CUSTOMER:
$relationData['related_model'] = 'Addressbook_Model_Contact';
$relationData['related_backend'] = Addressbook_Backend_Factory::SQL;
break;
default:
throw new Sales_Exception_UnexpectedValue('Relation type not supported.');
}
// sanitize container id
if (isset($relation['related_record']['container_id']) && is_array($relation['related_record']['container_id'])) {
$data['related_record']['container_id'] = $relation['related_record']['container_id']['id'];
}
$data['relations'][$key] = $relationData;
}
}
}
}
开发者ID:rodrigofns,项目名称:ExpressoLivre3,代码行数:34,代码来源:Contract.php
示例2: update_1
/**
* update function (-> 3.2)
* - check all users with 'userEmailAccount' and update their accounts / preferences
*/
public function update_1()
{
// update account types for users with userEmailAccount preference
$imapConfig = Tinebase_Config::getInstance()->getConfigAsArray(Tinebase_Config::IMAP);
if (array_key_exists('host', $imapConfig)) {
$accounts = Felamimail_Controller_Account::getInstance()->getAll();
$accountBackend = new Felamimail_Backend_Account();
foreach ($accounts as $account) {
try {
if (Tinebase_Core::getPreference('Felamimail')->getValueForUser('userEmailAccount', $account->user_id)) {
$user = Tinebase_User::getInstance()->getFullUserById($account->user_id);
// account email == user->emailAddress && account->host == system account host -> type = system
if ($account->email == $user->accountEmailAddress && $account->host == $imapConfig['host']) {
$account->type = Felamimail_Model_Account::TYPE_SYSTEM;
Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . ' Switching to system account: ' . $account->name);
$accountBackend->update($account);
}
}
} catch (Exception $e) {
// do nothing
}
}
}
// rename preference
$this->_db->query('UPDATE ' . SQL_TABLE_PREFIX . "preferences SET name = 'useSystemAccount' WHERE name = 'userEmailAccount'");
$this->setApplicationVersion('Felamimail', '3.2');
}
开发者ID:rodrigofns,项目名称:ExpressoLivre3,代码行数:31,代码来源:Release3.php
示例3: toArray
/**
* returns array with the filter settings of this filter
*
* @param bool $_valueToJson resolve value for json api?
* @return array
*/
public function toArray($_valueToJson = false)
{
$result = parent::toArray($_valueToJson);
if ($this->_userOperator && $this->_userOperator == 'inGroup') {
$result['operator'] = $this->_userOperator;
$result['value'] = $this->_userValue;
}
if ($_valueToJson == true) {
if ($this->_userOperator && $this->_userOperator == 'inGroup' && $this->_userValue) {
$result['value'] = Tinebase_Group::getInstance()->getGroupById($this->_userValue)->toArray();
} else {
switch ($this->_operator) {
case 'equals':
$result['value'] = $result['value'] ? Tinebase_User::getInstance()->getUserById($this->_value)->toArray() : $result['value'];
break;
case 'in':
$result['value'] = array();
foreach ($this->_value as $userId) {
$result['value'][] = Tinebase_User::getInstance()->getUserById($userId)->toArray();
}
break;
default:
break;
}
}
}
return $result;
}
开发者ID:bitExpert,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:34,代码来源:User.php
示例4: resetSyncForUser
/**
* reset sync for user
*
* @param mixed $user
* @param array|string $classesToReset
* @return boolean
*/
public function resetSyncForUser($user, $classesToReset)
{
if (is_string($classesToReset)) {
$classesToReset = array($classesToReset);
}
if (!$user instanceof Tinebase_Model_User) {
try {
$user = Tinebase_User::getInstance()->getFullUserById($user);
} catch (Tinebase_Exception_NotFound $tenf) {
$user = Tinebase_User::getInstance()->getUserByPropertyFromSqlBackend('accountLoginName', $user);
}
}
if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) {
Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . ' Resetting sync for user ' . $user->accountDisplayName . ' collections: ' . print_r($classesToReset, true));
}
self::initSyncrotonRegistry();
$devices = $this->_getDevicesForUser($user->getId());
foreach ($devices as $device) {
if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) {
Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . ' Resetting device' . $device->friendlyname . ' / id: ' . $device->getId());
}
foreach ($classesToReset as $class) {
$folderToReset = $this->_getFoldersForDeviceAndClass($device, $class);
if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) {
Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . ' Resetting ' . count($folderToReset) . ' folder(s) for class ' . $class);
}
foreach ($folderToReset as $folderState) {
Syncroton_Registry::getSyncStateBackend()->resetState($device->getId(), $folderState->id);
}
}
}
return true;
}
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:40,代码来源:Controller.php
示例5: testEmailsToAttendeeWithGroups
/**
* @return void
*/
public function testEmailsToAttendeeWithGroups()
{
if (Tinebase_User::getConfiguredBackend() === Tinebase_User::LDAP || Tinebase_User::getConfiguredBackend() === Tinebase_User::ACTIVEDIRECTORY) {
$this->markTestSkipped('FIXME: Does not work with LDAP/AD backend');
}
$event = $this->_getEvent();
$persistentEvent = Calendar_Controller_Event::getInstance()->create($event);
$primaryGroup = Tinebase_Group::getInstance()->getGroupById(Tinebase_Core::getUser()->accountPrimaryGroup);
$newAttendees = array(array('userType' => Calendar_Model_Attender::USERTYPE_USER, 'firstName' => $this->_originalTestUser->accountFirstName, 'lastName' => $this->_originalTestUser->accountLastName, 'partStat' => Calendar_Model_Attender::STATUS_TENTATIVE, 'role' => Calendar_Model_Attender::ROLE_REQUIRED, 'email' => $this->_originalTestUser->accountEmailAddress), array('userType' => Calendar_Model_Attender::USERTYPE_GROUP, 'displayName' => $primaryGroup->name, 'partStat' => Calendar_Model_Attender::STATUS_NEEDSACTION, 'role' => Calendar_Model_Attender::ROLE_REQUIRED, 'email' => '[email protected]'));
Calendar_Model_Attender::emailsToAttendee($persistentEvent, $newAttendees, TRUE);
$persistentEvent = Calendar_Controller_Event::getInstance()->update($persistentEvent);
$attendees = clone $persistentEvent->attendee;
Calendar_Model_Attender::resolveAttendee($attendees);
$newAttendees = array();
foreach ($attendees as $attendee) {
$newAttendees[] = array('userType' => $attendee->user_type == 'group' ? Calendar_Model_Attender::USERTYPE_GROUP : Calendar_Model_Attender::USERTYPE_USER, 'partStat' => Calendar_Model_Attender::STATUS_TENTATIVE, 'role' => Calendar_Model_Attender::ROLE_REQUIRED, 'email' => $attendee->user_type == 'group' ? $attendee->user_id->getId() : $attendee->user_id->email, 'displayName' => $attendee->user_type == 'group' ? $attendee->user_id->name : $attendee->user_id->n_fileas);
}
Calendar_Model_Attender::emailsToAttendee($persistentEvent, $newAttendees, TRUE);
$persistentEvent = Calendar_Controller_Event::getInstance()->update($persistentEvent);
// print_r($persistentEvent->attendee->toArray());
// there must be more than 2 attendees the user, the group + the groupmembers
$this->assertGreaterThan(2, count($persistentEvent->attendee));
// current account must not be a groupmember
$this->assertFalse(!!Calendar_Model_Attender::getAttendee($persistentEvent->attendee, new Calendar_Model_Attender(array('user_type' => Calendar_Model_Attender::USERTYPE_GROUPMEMBER, 'user_id' => $this->_originalTestUser->contact_id))), 'found user as groupmember');
$this->assertEquals(Calendar_Model_Attender::STATUS_TENTATIVE, Calendar_Model_Attender::getOwnAttender($persistentEvent->attendee)->status);
}
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:29,代码来源:AttenderTests.php
示例6: update_0
/**
* update to 6.1
* - changepw config option has moved
*/
public function update_0()
{
$changepwSetting = Tinebase_User::getBackendConfiguration('changepw', TRUE);
if (!$changepwSetting) {
Tinebase_Config::getInstance()->set(Tinebase_Config::PASSWORD_CHANGE, FALSE);
}
$this->setApplicationVersion('Tinebase', '6.1');
}
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:12,代码来源:Release6.php
示例7: setUp
/**
* Sets up the fixture.
* This method is called before a test is executed.
*
* @access protected
*/
protected function setUp()
{
if (Tinebase_User::getConfiguredBackend() !== Tinebase_User::SQL) {
$this->markTestSkipped('SQL backend not enabled');
}
$this->_backend = Tinebase_User::factory(Tinebase_User::SQL);
parent::setUp();
}
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:14,代码来源:SqlTest.php
示例8: setUp
/**
* Sets up the fixture.
* This method is called before a test is executed.
*
* @access protected
*/
protected function setUp()
{
$this->_groupLDAP = Tinebase_Group::factory(Tinebase_Group::LDAP);
$this->_userLDAP = Tinebase_User::factory(Tinebase_User::LDAP);
$this->_groupSQL = Tinebase_Group::factory(Tinebase_Group::SQL);
$this->objects['initialGroup'] = new Tinebase_Model_Group(array('name' => 'tine20phpunit', 'description' => 'initial group'));
$this->objects['updatedGroup'] = new Tinebase_Model_Group(array('name' => 'tine20phpunit updated', 'description' => 'updated group'));
$this->objects['initialAccount'] = new Tinebase_Model_FullUser(array('accountLoginName' => 'tine20phpunit', 'accountStatus' => 'enabled', 'accountExpires' => NULL, 'accountPrimaryGroup' => 'must be set to valid groupid', 'accountLastName' => 'Tine 2.0', 'accountFirstName' => 'PHPUnit', 'accountEmailAddress' => '[email protected]'));
}
开发者ID:bitExpert,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:15,代码来源:LdapTest.php
示例9: createPersonalFolder
/**
* creates the initial folder for new accounts
*
* @param mixed[int|Tinebase_Model_User] $_account the accountd object
* @return Tinebase_Record_RecordSet of subtype Tinebase_Model_Container
*/
public function createPersonalFolder($_accountId)
{
$translation = Tinebase_Translation::getTranslation('ExampleApplication');
$account = Tinebase_User::getInstance()->getUserById($_accountId);
$newContainer = new Tinebase_Model_Container(array('name' => sprintf($translation->_("%s's personal example records"), $account->accountFullName), 'type' => Tinebase_Model_Container::TYPE_PERSONAL, 'owner_id' => $_accountId, 'backend' => 'Sql', 'application_id' => Tinebase_Application::getInstance()->getApplicationByName('ExampleApplication')->getId()));
$personalContainer = Tinebase_Container::getInstance()->addContainer($newContainer);
$container = new Tinebase_Record_RecordSet('Tinebase_Model_Container', array($personalContainer));
return $container;
}
开发者ID:rodrigofns,项目名称:ExpressoLivre3,代码行数:15,代码来源:Controller.php
示例10: setUp
/**
* Sets up the fixture.
* This method is called before a test is executed.
*
* @access protected
*/
protected function setUp()
{
if (Tinebase_User::getConfiguredBackend() === Tinebase_User::ACTIVEDIRECTORY) {
// account email addresses are empty with AD backend
$this->markTestSkipped('skipped for ad backend');
}
Calendar_Controller_Event::getInstance()->sendNotifications(false);
Tinebase_TransactionManager::getInstance()->startTransaction(Tinebase_Core::getDb());
}
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:15,代码来源:GenericTest.php
示例11: _initializeUserContacts
/**
* init/create user contacts
*/
protected function _initializeUserContacts()
{
foreach (Tinebase_User::getInstance()->getFullUsers() as $fullUser) {
$fullUser->container_id = $this->_getInternalAddressbook()->getId();
$contact = Admin_Controller_User::getInstance()->createOrUpdateContact($fullUser);
$fullUser->contact_id = $contact->getId();
Tinebase_User::getInstance()->updateUser($fullUser);
}
}
开发者ID:bitExpert,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:12,代码来源:Initialize.php
示例12: setUp
/**
* Sets up the fixture.
* This method is called before a test is executed.
*
* @access protected
*/
protected function setUp()
{
$this->_backend = Tinebase_User::getInstance();
if (!array_key_exists('Tinebase_EmailUser_Imap_Cyrus', $this->_backend->getPlugins())) {
$this->markTestSkipped('Cyrus IMAP plugin not enabled');
}
$this->_config = Tinebase_Config::getInstance()->getConfigAsArray(Tinebase_Config::IMAP);
$this->objects['users'] = array();
}
开发者ID:rodrigofns,项目名称:ExpressoLivre3,代码行数:15,代码来源:CyrusTest.php
示例13: setUp
/**
* Sets up the fixture.
* This method is called before a test is executed.
*
* @access protected
*/
protected function setUp()
{
$this->_backend = Tinebase_User::getInstance();
if (!array_key_exists('Tinebase_EmailUser_Imap_Dbmail', $this->_backend->getPlugins())) {
$this->markTestSkipped('Dbmail MySQL plugin not enabled');
}
$this->_config = Tinebase_Config::getInstance()->get(Tinebase_Config::IMAP, new Tinebase_Config_Struct())->toArray();
$this->objects['users'] = array();
}
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:15,代码来源:DbmailTest.php
示例14: createPersonalFolder
/**
* creates the initial folder for new accounts
*
* @param mixed[int|Tinebase_Model_User] $_account the accountd object
* @return Tinebase_Record_RecordSet of subtype Tinebase_Model_Container
*/
public function createPersonalFolder($_account)
{
$translation = Tinebase_Translation::getTranslation($this->_applicationName);
$account = Tinebase_User::getInstance()->getUserById($_account);
$newContainer = new Tinebase_Model_Container(array('name' => sprintf($translation->_("%s's personal Projects"), $account->accountFullName), 'type' => Tinebase_Model_Container::TYPE_PERSONAL, 'owner_id' => $account->getId(), 'backend' => 'Sql', 'application_id' => Tinebase_Application::getInstance()->getApplicationByName($this->_applicationName)->getId(), 'model' => static::$_defaultModel));
$personalContainer = Tinebase_Container::getInstance()->addContainer($newContainer);
$container = new Tinebase_Record_RecordSet('Tinebase_Model_Container', array($personalContainer));
return $container;
}
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:15,代码来源:Controller.php
示例15: validate
/**
* validate if user is allowed to use the software in maintenance mode
*
* @return bool
*/
public function validate()
{
if (Tinebase_Core::inMaintenanceMode()) {
$currentAccount = Tinebase_User::getInstance()->getFullUserById($this->getValidData());
if (!$currentAccount->hasRight('Tinebase', Tinebase_Acl_Rights::MAINTENANCE)) {
return false;
}
}
return true;
}
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:15,代码来源:MaintenanceMode.php
示例16: _setCredentials
/**
* set new password & credentials
*
* @param string $_username
* @param string $_password
*/
protected function _setCredentials($_username, $_password)
{
Tinebase_User::getInstance()->setPassword(Tinebase_Core::getUser(), $_password, true, false);
$oldCredentialCache = Tinebase_Core::get(Tinebase_Core::USERCREDENTIALCACHE);
// update credential cache
$credentialCache = Tinebase_Auth_CredentialCache::getInstance()->cacheCredentials($_username, $_password);
Tinebase_Core::set(Tinebase_Core::USERCREDENTIALCACHE, $credentialCache);
$event = new Tinebase_Event_User_ChangeCredentialCache($oldCredentialCache);
Tinebase_Event::fireEvent($event);
}
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:16,代码来源:AccountTest.php
示例17: setUp
/**
* Sets up the fixture.
* This method is called before a test is executed.
*
* @access protected
*/
protected function setUp()
{
if (Tinebase_User::getConfiguredBackend() !== Tinebase_User::LDAP) {
$this->markTestSkipped('LDAP backend not enabled');
}
$this->_backend = Tinebase_User::factory(Tinebase_User::LDAP);
if (!array_key_exists('Tinebase_User_Plugin_Samba', $this->_backend->getPlugins())) {
$this->markTestSkipped('Samba LDAP plugin not enabled');
}
$this->objects['users'] = array();
}
开发者ID:rodrigofns,项目名称:ExpressoLivre3,代码行数:17,代码来源:SambaTest.php
示例18: __construct
/**
* the constructor
*
*/
public function __construct(array $_options = array())
{
if (Tinebase_User::getConfiguredBackend() != Tinebase_User::LDAP) {
throw new Tinebase_Exception('No LDAP config found.');
}
$this->_options = array_merge($this->_options, Tinebase_EmailUser::getConfig($this instanceof Tinebase_EmailUser_Imap_Interface ? Tinebase_Config::IMAP : Tinebase_Config::SMTP));
$this->_options = array_merge($this->_options, $_options);
if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' ' . print_r($this->_options, true));
}
}
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:15,代码来源:LdapAbstract.php
示例19: _importRecord
/**
* import single record (create password if in data)
*
* @param Tinebase_Record_Abstract $_record
* @param string $_resolveStrategy
* @param array $_recordData
* @return Tinebase_Record_Interface
* @throws Tinebase_Exception_Record_Validation
*/
protected function _importRecord($_record, $_resolveStrategy = NULL, $_recordData = array())
{
if ($_record instanceof Tinebase_Model_FullUser && $this->_controller instanceof Admin_Controller_User) {
$record = $_record;
// create valid login name
if (!isset($record->accountLoginName)) {
$record->accountLoginName = Tinebase_User::getInstance()->generateUserName($record, $this->_options['userNameSchema']);
}
// add prefix to login name if given
if (!empty($this->_options['accountLoginNamePrefix'])) {
$record->accountLoginName = $this->_options['accountLoginNamePrefix'] . $record->accountLoginName;
}
// add home dir if empty and prefix is given (append login name)
if (empty($record->accountHomeDirectory) && !empty($this->_options['accountHomeDirectoryPrefix'])) {
$record->accountHomeDirectory = $this->_options['accountHomeDirectoryPrefix'] . $record->accountLoginName;
}
// create email address if accountEmailDomain if given
if (empty($record->accountEmailAddress) && !empty($this->_options['accountEmailDomain'])) {
$record->accountEmailAddress = $record->accountLoginName . '@' . $this->_options['accountEmailDomain'];
}
if (!empty($this->_options['samba'])) {
$this->_addSambaSettings($record);
}
Tinebase_Event::fireEvent(new Admin_Event_BeforeImportUser($record, $this->_options));
if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' ' . print_r($record->toArray(), true));
}
// generate passwd (use accountLoginName or password from options or password from csv in this order)
$password = $record->accountLoginName;
if (!empty($this->_options['password'])) {
$password = $this->_options['password'];
}
if (isset($_recordData['password']) && !empty($_recordData['password'])) {
$password = $_recordData['password'];
}
$this->_addEmailUser($record, $password);
//if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Adding record: ' . print_r($record->toArray(), TRUE));
// try to create record with password
if ($record->isValid()) {
if (!$this->_options['dryrun']) {
$record = $this->_controller->create($record, $password, $password);
} else {
$this->_importResult['results']->addRecord($record);
}
$this->_importResult['totalcount']++;
} else {
Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . ' Record invalid: ' . print_r($record->getValidationErrors(), TRUE));
throw new Tinebase_Exception_Record_Validation('Imported record is invalid.');
}
} else {
$record = parent::_importRecord($_record, $_resolveStrategy, $_recordData);
}
return $record;
}
开发者ID:rodrigofns,项目名称:ExpressoLivre3,代码行数:63,代码来源:Csv.php
示例20: setUp
/**
* Sets up the fixture.
* This method is called before a test is executed.
*
* @access protected
*/
protected function setUp()
{
if (Tinebase_User::getConfiguredBackend() !== Tinebase_User::LDAP) {
$this->markTestSkipped('LDAP backend not enabled');
}
$this->_backend = Tinebase_User::getInstance();
if (!array_key_exists('Tinebase_EmailUser_Smtp_LdapMailSchema', $this->_backend->getPlugins())) {
$this->markTestSkipped('Mail LDAP plugin not enabled');
}
$this->objects['users'] = array();
}
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:17,代码来源:LdapMailSchemaTest.php
注:本文中的Tinebase_User类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论