本文整理汇总了PHP中PermissionPeer::disableForPartner方法的典型用法代码示例。如果您正苦于以下问题:PHP PermissionPeer::disableForPartner方法的具体用法?PHP PermissionPeer::disableForPartner怎么用?PHP PermissionPeer::disableForPartner使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PermissionPeer
的用法示例。
在下文中一共展示了PermissionPeer::disableForPartner方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postSave
/**
* Code to be run after persisting the object
* @param PropelPDO $con
*/
public function postSave(PropelPDO $con = null)
{
// update plugin permissions in the database
if (is_array($this->setEnabledPlugins)) {
foreach ($this->setEnabledPlugins as $pluginName => $enabled) {
if ($enabled) {
PermissionPeer::enablePlugin($pluginName, $this->getId());
} else {
PermissionPeer::disablePlugin($pluginName, $this->getId());
}
}
}
// update special services permissions in the database
if (is_array($this->setEnabledServices)) {
foreach ($this->setEnabledServices as $permissionName => $enabled) {
if ($enabled) {
PermissionPeer::enableForPartner($permissionName, PermissionType::SPECIAL_FEATURE, $this->getId());
} else {
PermissionPeer::disableForPartner($permissionName, $this->getId());
}
}
}
$this->setEnabledPlugins = array();
$this->setEnabledServices = array();
$ksObj = kSessionUtils::crackKs(kCurrentContext::$ks);
$currentKuser = null;
if (is_object($ksObj)) {
$currentKuser = kuserPeer::getKuserByEmail($ksObj->user, -2);
}
if ($currentKuser) {
$allowedPartners = $currentKuser->getAllowedPartners();
if (isset($allowedPartners) && !empty($allowedPartners)) {
$partnersArray = array_map('trim', explode(',', $allowedPartners));
if (!in_array($this->getId(), $partnersArray)) {
$currentKuser->setAllowedPartners($allowedPartners . ',' . $this->getId());
}
} else {
$currentKuser->setAllowedPartners($this->getId());
}
$currentKuser->save();
}
}
示例2: postSave
/**
* Code to be run after persisting the object
* @param PropelPDO $con
*/
public function postSave(PropelPDO $con = null)
{
// update plugin permissions in the database
if (is_array($this->setEnabledPlugins)) {
foreach ($this->setEnabledPlugins as $pluginName => $enabled) {
if ($enabled) {
PermissionPeer::enablePlugin($pluginName, $this->getId());
} else {
PermissionPeer::disablePlugin($pluginName, $this->getId());
}
}
}
// update special services permissions in the database
if (is_array($this->setEnabledServices)) {
foreach ($this->setEnabledServices as $permissionName => $enabled) {
if ($enabled) {
PermissionPeer::enableForPartner($permissionName, PermissionType::SPECIAL_FEATURE, $this->getId());
} else {
PermissionPeer::disableForPartner($permissionName, $this->getId());
}
}
}
$this->setEnabledPlugins = array();
$this->setEnabledServices = array();
parent::postSave($con);
}