本文整理汇总了PHP中Doctrine_Record::user_may_write方法的典型用法代码示例。如果您正苦于以下问题:PHP Doctrine_Record::user_may_write方法的具体用法?PHP Doctrine_Record::user_may_write怎么用?PHP Doctrine_Record::user_may_write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine_Record
的用法示例。
在下文中一共展示了Doctrine_Record::user_may_write方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: air_update
/**
* Update out_org_id
*
* @param Doctrine_Record $rec
* @param array $data
*/
protected function air_update($rec, $data)
{
// check perms
if (!$rec->user_may_write($this->user)) {
throw new Rframe_Exception(Rframe::BAD_DATA, "You do not have permission to update this PINfluence.");
return;
}
// unset bulk_op vars
$this->bulk_op = null;
$this->bulk_rs = null;
if (isset($data['org_uuid']) && $data['org_uuid']) {
$o = AIR2_Record::find('Organization', $data['org_uuid']);
if (!$o) {
throw new Rframe_Exception(Rframe::BAD_DATA, 'Invalid org_uuid');
}
$rec->out_org_id = $o->org_id;
$rec->Organization = $o;
}
$bulk_op = '';
foreach ($this->BULK_OPS as $op) {
if (isset($data[$op])) {
$bulk_op = $op;
break;
}
}
if ($bulk_op) {
// sanity
if (count($data) > 1) {
throw new Rframe_Exception(Rframe::BAD_DATA, "Bulk operation " . "{$bulk_op} cannot run with any other updates!");
}
$this->run_bulk($rec, $bulk_op, $data[$bulk_op]);
// touch timestamp, since bulk ops usually don't
$rec->out_upd_user = $this->user->user_id;
$rec->out_upd_dtim = air2_date();
}
}