本文整理汇总了PHP中Zend_Log::INFO方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Log::INFO方法的具体用法?PHP Zend_Log::INFO怎么用?PHP Zend_Log::INFO使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Log
的用法示例。
在下文中一共展示了Zend_Log::INFO方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getGrantsByOwner
/**
* returns grants by owner
*
* eGW has owner based grants whereas Tine 2.0 has container based grants.
* this class reads the egw owner grants and converts them into Tine 2.0 grants
* attacheable to a tine 2.0 container
*
* @param string $_application
* @param string $_accountId
* @return Tinebase_Record_RecordSet of Tinebase_Model_Grant
* @throws Tinebase_Exception_NotFound
*/
public function getGrantsByOwner($_application, $_accountId)
{
$egwAccountId = $this->mapAccountIdTine2Egw($_accountId);
$acl_account = array($egwAccountId);
if ($egwAccountId > 0) {
$user = Tinebase_User::getInstance()->getUserById($_accountId);
$groupIds = $user->getGroupMemberships();
foreach ($groupIds as $groupId) {
try {
$acl_account[] = $this->mapAccountIdTine2Egw($groupId, 'Group');
} catch (Exception $e) {
$this->_log->INFO(__METHOD__ . '::' . __LINE__ . " skipping group {$groupId} in grants migration cause: " . $e);
}
}
}
$select = $this->_egwDb->select()->from(array('grants' => 'egw_acl'))->where($this->_egwDb->quoteInto($this->_egwDb->quoteIdentifier('acl_appname') . ' = ?', $_application))->where($this->_egwDb->quoteInto($this->_egwDb->quoteIdentifier('acl_account') . ' IN (?)', $acl_account));
$egwGrantDatas = $this->_egwDb->fetchAll($select, NULL, Zend_Db::FETCH_ASSOC);
// print_r($egwGrantDatas);
// in a first run we merge grants from different sources
$effectiveGrants = array();
if ($egwAccountId > 0) {
// owner has implicitly all grants in egw
$effectiveGrants[$egwAccountId] = 31;
}
foreach ($egwGrantDatas as $egwGrantData) {
// grants are int != 0
if ((int) $egwGrantData['acl_location'] == 0) {
continue;
}
// NOTE: The grant source is not resolveable in Tine 2.0!
// In Tine 2.0 grants are directly given to a container
$grantsSource = $egwGrantData['acl_account'];
$grantsDestination = $egwGrantData['acl_location'];
$grantsGiven = $egwGrantData['acl_rights'];
if (!(isset($effectiveGrants[$grantsDestination]) || array_key_exists($grantsDestination, $effectiveGrants))) {
$effectiveGrants[$grantsDestination] = 0;
}
$effectiveGrants[$grantsDestination] |= $grantsGiven;
}
//print_r($effectiveGrants);
// convert to tine grants
$tineGrants = new Tinebase_Record_RecordSet('Tinebase_Model_Grants');
foreach ($effectiveGrants as $grantAccount => $egwGrants) {
$tineGrant = new Tinebase_Model_Grants(array('account_id' => $this->mapAccountIdEgw2Tine($grantAccount), 'account_type' => (int) $grantAccount > 0 ? Tinebase_Acl_Rights::ACCOUNT_TYPE_USER : Tinebase_Acl_Rights::ACCOUNT_TYPE_GROUP));
foreach ($this->_grantMap as $egwGrant => $tineGrantString) {
$tineGrant->{$tineGrantString} = (bool) ($egwGrants & $egwGrant);
}
// the owner also gets admin grants
if ($egwAccountId > 0 && $grantAccount == $egwAccountId) {
$tineGrant->{Tinebase_Model_Grants::GRANT_ADMIN} = TRUE;
}
$tineGrant->{Tinebase_Model_Grants::GRANT_EXPORT} = $tineGrant->{Tinebase_Model_Grants::GRANT_READ};
$tineGrant->{Tinebase_Model_Grants::GRANT_SYNC} = $tineGrant->{Tinebase_Model_Grants::GRANT_READ};
$tineGrant->{Tinebase_Model_Grants::GRANT_FREEBUSY} = $this->getApplication()->name == 'Calendar';
$tineGrants->addRecord($tineGrant);
}
// print_r($tineGrants->toArray());
// for group owners (e.g. group addressbooks) we need an container admin
if ($egwAccountId < 0) {
$adminGroup = Tinebase_Group::getInstance()->getDefaultAdminGroup();
$tineGrant = new Tinebase_Model_Grants(array('account_id' => $this->mapAccountIdEgw2Tine($_accountId), 'account_type' => Tinebase_Acl_Rights::ACCOUNT_TYPE_GROUP));
$tineGrant->{Tinebase_Model_Grants::GRANT_ADMIN} = TRUE;
$tineGrants->addRecord($tineGrant);
}
return $tineGrants;
}