本文整理匯總了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();
}
}