本文整理汇总了PHP中AppModel::isOwn方法的典型用法代码示例。如果您正苦于以下问题:PHP AppModel::isOwn方法的具体用法?PHP AppModel::isOwn怎么用?PHP AppModel::isOwn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AppModel
的用法示例。
在下文中一共展示了AppModel::isOwn方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: admin_delete
/**
* undocumented function
*
* @param string $id
* @return void
* @access public
*/
function admin_delete($id)
{
$filter = $this->Filter->find('first', array('conditions' => array('Filter.id' => $id), 'contain' => false, 'fields' => array('id', 'user_id')));
Assert::notEmpty($filter, '404');
Assert::true(AppModel::isOwn($filter, 'Filter'), '403');
$this->Filter->del($id);
$msg = __('Filter deleted.', true);
$this->Message->add($msg, 'ok', true, $this->referer());
}
示例2: isOwn
/**
* undocumented function
*
* @param string $comment
* @return void
* @access public
*/
static function isOwn($comment)
{
$isAuthor = $comment['Comment']['user_id'] == User::get('id');
$isOwned = false;
if (!$isAuthor) {
$models = $this->belongsTo;
foreach ($models as $model => $data) {
$row = $this->{$model}->find('first', array('conditions' => array($model . '.id' => $comment['Comment']['foreign_id'])));
if (!empty($row) && AppModel::isOwn($row, $model)) {
$isOwned = true;
break;
}
}
Assert::true($isOwned, '403');
}
return true;
}
示例3: admin_delete_item
/**
* undocumented function
*
* @param string $segmentId
* @param string $foreignId
* @return void
* @access public
*/
function admin_delete_item($segmentId, $foreignId)
{
$segment = $this->Segment->find('first', array('conditions' => array('id' => $segmentId), 'fields' => array('user_id')));
Assert::notEmpty($segment);
Assert::true(AppModel::isOwn($segment, 'Segment'), '403');
$this->SegmentItem->deleteAll(array('segment_id' => $segmentId, 'foreign_id' => $foreignId));
$msg = 'The item was successfully removed from segment.';
$this->Message->add($msg, 'ok', true, $this->referer());
}