Permalink
Browse files

Update requirement of Members to BoltAuth

  • Loading branch information...
GawainLynch committed Jun 16, 2017
1 parent 2334802 commit 1189cfcd60fe2189d90204fdd47d7d296ca927a7
@@ -24,10 +24,6 @@
},
"repositories": {
"packagist": false,
"members": {
"type": "git",
"url": "https://github.com/BoltAuth/Auth.git"
},
"bolt": {
"type": "composer",
"url": "https://market.bolt.cm/satis/"
@@ -36,7 +32,7 @@
"require": {
"bolt/boltforms": "^4.0@beta",
"bolt/github": "^3.1",
"bolt/members": "dev-master@dev"
"boltauth/auth": "^3.0@beta"
},
"scripts": {
"post-autoload-dump": "Bolt\\Composer\\EventListener\\PackageEventListener::dump",
@@ -49,8 +49,8 @@ public function getAppService($name)
*/
public function getWebhookData(Entity\Package $package)
{
/** @var \Bolt\Extension\Bolt\Members\AccessControl\Session $members */
$members = $this->getAppService('members.session');
/** @var \Bolt\Extension\BoltAuth\Auth\AccessControl\Session $members */
$members = $this->getAppService('auth.session');
if (!$members->hasAuthorisation()) {
return false;
}
@@ -4,7 +4,7 @@
use Bolt\Extension\Bolt\MarketPlace\Storage\Entity;
use Bolt\Extension\Bolt\MarketPlace\Storage\Repository\Package;
use Bolt\Extension\Bolt\Members\AccessControl\Authorisation;
use Bolt\Extension\BoltAuth\Auth\AccessControl\Authorisation;
use Bolt\Storage\EntityManager;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
@@ -4,7 +4,7 @@
use Bolt\Extension\Bolt\MarketPlace\Storage\Entity;
use Bolt\Extension\Bolt\MarketPlace\Storage\Repository\Package;
use Bolt\Extension\Bolt\Members\AccessControl\Authorisation;
use Bolt\Extension\BoltAuth\Auth\AccessControl\Authorisation;
use Bolt\Storage\EntityManager;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
@@ -4,8 +4,8 @@
use Bolt\Extension\Bolt\MarketPlace\Storage\Entity;
use Bolt\Extension\Bolt\MarketPlace\Storage\Repository;
use Bolt\Extension\Bolt\Members\Storage\Entity\Account;
use Bolt\Extension\Bolt\Members\Storage\Records;
use Bolt\Extension\BoltAuth\Auth\Storage\Entity\Account;
use Bolt\Extension\BoltAuth\Auth\Storage\Records;
use Bolt\Storage\EntityManager;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
@@ -45,7 +45,7 @@ public function execute(Request $request, array $params)
}
/** @var Records $records */
$records = $this->getAppService('members.records');
$records = $this->getAppService('auth.records');
/** @var Account $account */
$account = $records->getAccountByGuid($package->getAccountId());
@@ -5,7 +5,7 @@
use Bolt\Extension\Bolt\MarketPlace\Service\PackageManager;
use Bolt\Extension\Bolt\MarketPlace\Storage\Entity;
use Bolt\Extension\Bolt\MarketPlace\Storage\Repository;
use Bolt\Extension\Bolt\Members\Storage\Entity\Account;
use Bolt\Extension\BoltAuth\Auth\Storage\Entity\Account;
use Bolt\Storage\EntityManager;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
@@ -27,7 +27,7 @@ public function execute(Request $request, array $params)
{
/** @var UrlGeneratorInterface $urlGen */
$urlGen = $this->getAppService('url_generator');
$route = $urlGen->generate('profile');
$route = $urlGen->generate('profilePackages');
/** @var Session $session */
$session = $this->getAppService('session');
@@ -65,7 +65,7 @@ protected function update(Entity\Package $package)
$session = $this->getAppService('session');
/** @var PackageManager $packageManager */
$packageManager = $this->getAppService('marketplace.manager_package');
$membersRecords = $this->getAppService('members.records');
$membersRecords = $this->getAppService('auth.records');
/** @var Account $account */
$account = $membersRecords->getAccountByGuid($package->getAccountId());
@@ -46,8 +46,8 @@ public function execute(Request $request, array $params)
*/
private function formatPackage(Entity\Package $package)
{
/** @var \Bolt\Extension\Bolt\Members\Storage\Records $membersRecords */
$membersRecords = $this->getAppService('members.records');
/** @var \Bolt\Extension\BoltAuth\Auth\Storage\Records $membersRecords */
$membersRecords = $this->getAppService('auth.records');
$account = $membersRecords->getAccountByGuid($package->getAccountId());
$accountMeta = $membersRecords->getAccountMeta($package->getAccountId(), 'username');
$updateEntities = $this->getUpdated($package);
@@ -5,7 +5,7 @@
use Bolt\Extension\Bolt\MarketPlace\Service\PackageManager;
use Bolt\Extension\Bolt\MarketPlace\Storage\Entity;
use Bolt\Extension\Bolt\MarketPlace\Storage\Repository;
use Bolt\Extension\Bolt\Members\AccessControl\Authorisation;
use Bolt\Extension\BoltAuth\Auth\AccessControl\Authorisation;
use Bolt\Storage\EntityManager;
use Symfony\Component\Form\FormFactory;
use Symfony\Component\HttpFoundation\RedirectResponse;
@@ -4,7 +4,7 @@
use Bolt\Extension\Bolt\MarketPlace\Service\PackageManager;
use Bolt\Extension\Bolt\MarketPlace\Storage\Entity;
use Bolt\Extension\Bolt\Members\AccessControl\Authorisation;
use Bolt\Extension\BoltAuth\Auth\AccessControl\Authorisation;
use Bolt\Storage\EntityManager;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
@@ -36,7 +36,7 @@ public function execute(Request $request, array $params)
/** @var PackageManager $packageManager */
$packageManager = $this->getAppService('marketplace.manager_package');
/** @var Authorisation $member */
$member = $this->getAppService('members.session')->getAuthorisation();
$member = $this->getAppService('auth.session')->getAuthorisation();
/** @var Entity\Package $package */
$package = $packageRepo->findOneBy(['id' => $params['package'], 'account_id' => $member->getGuid()]);
if (!$package || $package->getAccountId() !== $member->getGuid()) {
@@ -5,8 +5,8 @@
use Bolt\Extension\Bolt\MarketPlace\Service\PackageManager;
use Bolt\Extension\Bolt\MarketPlace\Storage\Entity;
use Bolt\Extension\Bolt\MarketPlace\Storage\Repository;
use Bolt\Extension\Bolt\Members\Storage\Entity\Account as MembersAccountEntity;
use Bolt\Extension\Bolt\Members\Storage\Repository\Account as MembersAccountRepository;
use Bolt\Extension\BoltAuth\Auth\Storage\Entity\Account as AuthAccountEntity;
use Bolt\Extension\BoltAuth\Auth\Storage\Repository\Account as AuthAccountRepository;
use Bolt\Nut\BaseCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
@@ -42,8 +42,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
$packageManager = $this->app['marketplace.manager_package'];
/** @var Repository\Package $packageRepo */
$packageRepo = $this->app['storage']->getRepository(Entity\Package::class);
/** @var MembersAccountRepository $accountRepo */
$accountRepo = $this->app['storage']->getRepository(MembersAccountEntity::class);
/** @var AuthAccountRepository $accountRepo */
$accountRepo = $this->app['storage']->getRepository(AuthAccountEntity::class);
if ($input->getOption('name')) {
$package = $packageRepo->findOneBy(['name' => $input->getOption('name')]);
@@ -81,8 +81,8 @@ protected function updatePackage(Repository\Package $repo, Entity\Package $packa
$output->writeln('<info>Updating ' . $package->getName() . '</info>');
try {
$packageManager->syncPackage($package);
/** @var MembersAccountEntity $account */
$account = $this->app['members.records']->getAccountByGuid($package->getAccountId());
/** @var AuthAccountEntity $account */
$account = $this->app['auth.records']->getAccountByGuid($package->getAccountId());
if ($account->isEnabled()) {
$package->setApproved(true);
}
@@ -166,7 +166,7 @@ public function connect(Application $app)
;
$ctr->match('/update/{package}', [$this, 'update'])
->bind('update')
->bind('updatePackage')
->before([$this, 'auth'])
->method(Request::METHOD_GET)
;
@@ -207,7 +207,7 @@ public function connect(Application $app)
*/
public function auth(Request $request, Application $app)
{
if ($app['members.session']->hasAuthorisation()) {
if ($app['auth.session']->hasAuthorisation()) {
return null;
}
@@ -295,7 +295,7 @@ public function searchJson(Application $app, Request $request)
public function edit(Application $app, Request $request, $package)
{
$params = [
'user' => $app['members.session']->getAuthorisation(),
'user' => $app['auth.session']->getAuthorisation(),
'package' => $package,
];
@@ -374,7 +374,7 @@ public function infoJson(Application $app, Request $request)
public function profile(Application $app, Request $request)
{
$params = [
'user' => $app['members.session']->getAuthorisation(),
'user' => $app['auth.session']->getAuthorisation(),
];
return $this->getAction($app, 'account_profile')->execute($request, $params);
@@ -383,7 +383,7 @@ public function profile(Application $app, Request $request)
public function profileStarred(Application $app, Request $request)
{
$params = [
'user' => $app['members.session']->getAuthorisation(),
'user' => $app['auth.session']->getAuthorisation(),
];
return $this->getAction($app, 'account_starred')->execute($request, $params);
@@ -487,7 +487,7 @@ public function register(Application $app, Request $request)
{
/** @var UrlGeneratorInterface $urlGen */
$urlGen = $app['url_generator'];
$route = $urlGen->generate('membersProfileRegister');
$route = $urlGen->generate('authProfileRegister');
return new RedirectResponse($route);
}
@@ -538,7 +538,7 @@ public function statCollectInstall(Application $app, Request $request, $author,
public function stats(Application $app, Request $request, $package)
{
$params = [
'user' => $app['members.session']->getAuthorisation(),
'user' => $app['auth.session']->getAuthorisation(),
'package' => $package,
];
@@ -555,7 +555,7 @@ public function stats(Application $app, Request $request, $package)
public function statsApi(Application $app, Request $request, $package)
{
$params = [
'user' => $app['members.session']->getAuthorisation(),
'user' => $app['auth.session']->getAuthorisation(),
'package' => $package,
];
@@ -571,7 +571,7 @@ public function statsApi(Application $app, Request $request, $package)
public function status(Application $app, Request $request)
{
$params = [
'user' => $app['members.session']->getAuthorisation(),
'user' => $app['auth.session']->getAuthorisation(),
];
return $this->getAction($app, 'status')->execute($request, $params);
@@ -586,7 +586,7 @@ public function status(Application $app, Request $request)
public function submit(Application $app, Request $request)
{
$params = [
'user' => $app['members.session']->getAuthorisation(),
'user' => $app['auth.session']->getAuthorisation(),
];
return $this->getAction($app, 'submit')->execute($request, $params);
@@ -2,7 +2,7 @@
namespace Bolt\Extension\Bolt\MarketPlace\Service;
use Bolt\Extension\Bolt\Members\AccessControl\Session as MembersSession;
use Bolt\Extension\BoltAuth\Auth\AccessControl\Session as AuthSession;
use Github\Client as GithubClient;
use Github\Exception\ApiLimitExceedException;
use Github\Exception\ExceptionInterface as GithubExceptionInterface;
@@ -214,14 +214,14 @@ protected function getGitHubClient()
}
/**
* Return the in-use access token from the Members session.
* Return the in-use access token from the Auth session.
*
* @return \League\OAuth2\Client\Token\AccessToken
*/
protected function getAccessToken()
{
/** @var MembersSession $membersSession */
$membersSession = $this->app['members.session'];
/** @var AuthSession $membersSession */
$membersSession = $this->app['auth.session'];
if ($membersSession->hasAuthorisation() === false) {
return null;
@@ -67,6 +67,6 @@ protected function setPrimaryKey()
*/
protected function addForeignKeyConstraints()
{
$this->table->addForeignKeyConstraint($this->tablePrefix . 'members_account', ['account_id'], ['guid'], ['onDelete' => 'CASCADE']);
$this->table->addForeignKeyConstraint($this->tablePrefix . 'auth_account', ['account_id'], ['guid'], ['onDelete' => 'CASCADE']);
}
}
@@ -47,6 +47,6 @@ protected function setPrimaryKey()
protected function addForeignKeyConstraints()
{
$this->table->addForeignKeyConstraint($this->tablePrefix . 'marketplace_package', ['package_id'], ['id'], ['onDelete' => 'CASCADE']);
$this->table->addForeignKeyConstraint($this->tablePrefix . 'members_account', ['account_id'], ['guid'], ['onDelete' => 'CASCADE']);
$this->table->addForeignKeyConstraint($this->tablePrefix . 'auth_account', ['account_id'], ['guid'], ['onDelete' => 'CASCADE']);
}
}

0 comments on commit 1189cfc

Please sign in to comment.