Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: 960ac3b2a6
Fetching contributors…

Cannot retrieve contributors at this time

46 lines (33 sloc) 1.276 kB
<?php
abstract class PhortuneController extends PhabricatorController {
protected function createUserAccount(PhabricatorUser $user) {
$request = $this->getRequest();
$xactions = array();
$xactions[] = id(new PhortuneAccountTransaction())
->setTransactionType(PhortuneAccountTransaction::TYPE_NAME)
->setNewValue(pht('Account (%s)', $user->getUserName()));
$xactions[] = id(new PhortuneAccountTransaction())
->setTransactionType(PhabricatorTransactions::TYPE_EDGE)
->setMetadataValue(
'edge:type',
PhabricatorEdgeConfig::TYPE_ACCOUNT_HAS_MEMBER)
->setNewValue(
array(
'=' => array($user->getPHID() => $user->getPHID()),
));
$account = new PhortuneAccount();
$editor = id(new PhortuneAccountEditor())
->setActor($user)
->setContentSource(
PhabricatorContentSource::newForSource(
PhabricatorContentSource::SOURCE_WEB,
array(
'ip' => $request->getRemoteAddr(),
)));
// We create an account for you the first time you visit Phortune.
$unguarded = AphrontWriteGuard::beginScopedUnguardedWrites();
$editor->applyTransactions($account, $xactions);
unset($unguarded);
return $account;
}
}
Jump to Line
Something went wrong with that request. Please try again.