Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v23.0.0 PROTOTYPE! [WIP] Authentication [back-end] #583

Open
wants to merge 143 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
143 commits
Select commit Hold shift + click to select a range
2e3183a
prototype! - event listeners (for demo)
eugene-matvejev Mar 21, 2016
2c77684
Merge branch 'prototype!-event-listeners' into v7.2.0_event_dispacher
eugene-matvejev Mar 27, 2016
d7c7b5d
comments
eugene-matvejev Mar 27, 2016
40897d5
Merge branch 'v19.2.3' into prototype!_event_dispacher
eugene-matvejev Jun 18, 2016
999fc10
save progress
eugene-matvejev Jun 19, 2016
0c44a4f
Merge branch 'v20.0.1_update_git_ignore' into v21.0.0_prototype!_even…
eugene-matvejev Jun 19, 2016
ff8c51f
Merge branch 'v20.1.0' into v21.0.0_prototype!_event_dispacher
eugene-matvejev Jun 20, 2016
d2b5999
save progress
eugene-matvejev Jun 23, 2016
2f519d4
Merge branch 'v20.2.2' into v21.0.0_prototype!_event_dispacher
eugene-matvejev Jun 26, 2016
ef2b8e6
Merge branch 'v21.2.1' into prototype!_event_dispacher
eugene-matvejev Jun 29, 2016
5c8f631
save progress
eugene-matvejev Jul 1, 2016
160000b
Merge branch 'v21.2.5' into prototype!_event_dispacher
eugene-matvejev Jul 5, 2016
3df1d9a
Merge branch 'v21.2.6' into prototype!_event_dispacher
eugene-matvejev Jul 5, 2016
d88a98e
save progress
eugene-matvejev Jul 11, 2016
b5a48b1
save progress
eugene-matvejev Jul 11, 2016
43a7662
save progress - working version
eugene-matvejev Jul 11, 2016
78449ce
optimize migrations
eugene-matvejev Jul 11, 2016
22a8166
Merge branch 'v21.2.7' into prototype!_event_dispacher
eugene-matvejev Jul 11, 2016
5ee472b
save progress, optimise structure
eugene-matvejev Jul 11, 2016
ebbd90d
save progress
eugene-matvejev Jul 11, 2016
aa44afb
prototype - cleanup
eugene-matvejev Jul 11, 2016
1757b02
Merge branch 'v21.2.8' into prototype!_event_dispacher
eugene-matvejev Jul 11, 2016
b08dc18
save progress
eugene-matvejev Jul 12, 2016
360583c
remove front-end part of authorization prototype - will be in separat…
eugene-matvejev Jul 12, 2016
f97506f
remove front-end part of authorization prototype - will be in separat…
eugene-matvejev Jul 12, 2016
a804203
cleanup config
eugene-matvejev Jul 12, 2016
3f236f6
save progress
eugene-matvejev Jul 13, 2016
b62ab0e
save progress
eugene-matvejev Jul 13, 2016
4a17ac5
save progress
eugene-matvejev Jul 14, 2016
d7c1d58
save progress
eugene-matvejev Jul 14, 2016
56189f7
Merge pull request #547 from eugene-matvejev/master
eugene-matvejev Jul 17, 2016
4d2f82a
Merge branch 'v22.1.11' into prototype!_event_dispacher
eugene-matvejev Jul 24, 2016
9f120bc
Merge branch 'prototype!_event_dispacher2' into fetch-prototype
eugene-matvejev Jul 24, 2016
9beb324
v23.0.0 update migrations
eugene-matvejev Jul 24, 2016
4838006
update travis/prepare tests again SQLite
eugene-matvejev Jul 24, 2016
3001575
v22.2.0 update migrations
eugene-matvejev Jul 24, 2016
5898664
v22.2.1 try to run tests against SQLite
eugene-matvejev Jul 24, 2016
4cef728
v22.2.1 try run tests agains SQLite
eugene-matvejev Jul 24, 2016
abb4273
save for rollback
eugene-matvejev Jul 24, 2016
194c168
Revert "save for rollback"
eugene-matvejev Jul 24, 2016
7205208
Merge branch 'update_prototype_migrations' into prototype!_event_disp…
eugene-matvejev Jul 24, 2016
57243bd
Merge branch 'update_prototype_migrations' into prototype_authorization
eugene-matvejev Jul 24, 2016
12577c5
Merge branch 'prototype!_event_dispacher2' into prototype_authorization
eugene-matvejev Jul 24, 2016
e383882
Merge branch 'prototype_save_progress' into prototype_authorization_m…
eugene-matvejev Jul 24, 2016
4a0c17d
Merge branch 'master' into prototype_authorization
eugene-matvejev Jul 24, 2016
333f9b8
Merge branch 'master' into prototype_authorization
eugene-matvejev Jul 28, 2016
6b47a72
Merge branch 'v22.4.3' into prototype_authorization
eugene-matvejev Jul 28, 2016
251666d
Merge branch 'v22.5.1' into prototype_authorization
eugene-matvejev Jul 31, 2016
76e133c
Revert "cleanup"
eugene-matvejev Jul 31, 2016
563fc84
Merge branch 'master' into prototype_authorization
eugene-matvejev Aug 2, 2016
6976d1d
authorisation prototype - fix shared env.
eugene-matvejev Aug 2, 2016
963248b
Merge branch 'v22.6.2' into prototype_authorization
eugene-matvejev Aug 2, 2016
004e231
save progress
eugene-matvejev Aug 8, 2016
4923a13
auhotization prototype: optimze MySQL migration
eugene-matvejev Aug 8, 2016
e591e37
authorization prototype: improve PostgreSQL migration
eugene-matvejev Aug 8, 2016
013769a
Merge branch 'master' into prototype_authorization
eugene-matvejev Aug 8, 2016
579532a
Merge branch 'master' into prototype_authorization
eugene-matvejev Aug 11, 2016
a81c14c
save progress
eugene-matvejev Aug 14, 2016
03b5189
Update services.yml
eugene-matvejev Sep 15, 2016
cac26a2
Merge branch 'master' into prototype_authorization
eugene-matvejev Nov 13, 2016
e5f6097
cleanup AppKernel.php
eugene-matvejev Nov 20, 2016
a4d0f97
fix PlayerController::LogoutAction
eugene-matvejev Nov 20, 2016
74f494b
fixes after merge
eugene-matvejev Nov 20, 2016
f1e2a1c
Merge branch 'master' into prototype_authorization
eugene-matvejev Nov 20, 2016
81d624a
Update GameController.php
eugene-matvejev Nov 20, 2016
3b975ce
Delete IntegrationTestSuite.php
eugene-matvejev Nov 20, 2016
2edbcb6
Update services.yml
eugene-matvejev Nov 20, 2016
5950311
Merge branch 'master' into prototype_authorization
eugene-matvejev Nov 20, 2016
ff70d97
improve LoadGameData fixture
eugene-matvejev Nov 20, 2016
26e82e6
improve LoadGameData fixture
eugene-matvejev Nov 20, 2016
d9d85e9
fix PHPDoc @since
eugene-matvejev Nov 20, 2016
772d51b
move class fields to private
eugene-matvejev Nov 20, 2016
f6e7cd2
improve PlayerSessionToken
eugene-matvejev Nov 20, 2016
9aa260c
Merge branch 'prototype_authorization' of github.com:eugene-matvejev/…
eugene-matvejev Nov 20, 2016
dc0f0a0
Merge branch 'master' into prototype_authorization
eugene-matvejev Nov 21, 2016
c0e330c
Merge branch 'master' into prototype_authorization
eugene-matvejev Nov 21, 2016
8ac7ce3
Update PlayerException.php
eugene-matvejev Nov 21, 2016
b46dde4
Merge branch 'master' into prototype_authorization
eugene-matvejev Nov 21, 2016
e7b316e
Update AuthorizationListener.php
eugene-matvejev Nov 21, 2016
fb7f537
Update PlayerSession.php
eugene-matvejev Nov 21, 2016
9454165
Delete MockFactory.php
eugene-matvejev Nov 21, 2016
6116b15
Update PlayerModel.php
eugene-matvejev Nov 21, 2016
bda6b72
fix authorization
eugene-matvejev Nov 21, 2016
b2bab18
fix serialization
eugene-matvejev Nov 21, 2016
b52432b
fix GameController tests
eugene-matvejev Nov 21, 2016
c868714
fix phpunit tests
eugene-matvejev Nov 21, 2016
3432413
Update PlayerSessionModel.php
eugene-matvejev Nov 21, 2016
c6bd7cc
Merge branch 'master' into prototype_authorization
eugene-matvejev Nov 22, 2016
a3a102d
fix build
eugene-matvejev Nov 22, 2016
953b1f4
improve build
eugene-matvejev Nov 22, 2016
80e34e0
Merge branch 'prototype_authorization' of github.com:eugene-matvejev/…
eugene-matvejev Nov 22, 2016
1e24d62
Merge branch 'master' into prototype_authorization
eugene-matvejev Nov 25, 2016
cf8e805
improve PlayerModel
eugene-matvejev Nov 26, 2016
8aab7de
save progress
eugene-matvejev Dec 2, 2016
9ac7fc6
save progress
eugene-matvejev Dec 2, 2016
22db887
save progress
eugene-matvejev Dec 3, 2016
b634a0a
Merge branch 'master' into prototype_authorization
eugene-matvejev Dec 7, 2016
44b7f73
Merge branch 'master' into prototype_authorization
eugene-matvejev Dec 7, 2016
2764d0d
Merge branch 'update_gitignore' into prototype_authorization
eugene-matvejev Dec 8, 2016
2bb89ce
update documentation; fix coverage
eugene-matvejev Dec 9, 2016
a93076a
Merge branch 'prototype_authorization' of github.com:eugene-matvejev/…
eugene-matvejev Dec 9, 2016
f65b212
add missing test case
eugene-matvejev Dec 9, 2016
059f4ca
Merge branch 'master' into prototype_authorization
eugene-matvejev Dec 9, 2016
c214e1a
fix build
eugene-matvejev Dec 9, 2016
8645771
Merge branch 'prototype_authorization' of github.com:eugene-matvejev/…
eugene-matvejev Dec 9, 2016
45aef6b
improve behat.yml
eugene-matvejev Dec 10, 2016
3836004
try fix builld
eugene-matvejev Dec 10, 2016
3be05c7
Update services.yml
eugene-matvejev Dec 10, 2016
ac229d6
save progress
eugene-matvejev Dec 19, 2016
8fdcb0a
try fix build
eugene-matvejev Dec 19, 2016
ba09139
save progress
eugene-matvejev Dec 27, 2016
f7663f7
Merge branch 'prototype_authorization' of github.com:eugene-matvejev/…
eugene-matvejev Dec 27, 2016
fc19e85
Merge branch 'master' into prototype_authorization
eugene-matvejev Mar 5, 2017
c95b515
Merge branch 'master' into prototype_authorization
eugene-matvejev Mar 5, 2017
d46e65e
Update behat.yml
eugene-matvejev Mar 5, 2017
20bc71c
Merge pull request #732 from eugene-matvejev/eugene-matvejev-patch-1
eugene-matvejev Mar 5, 2017
ad235ea
Merge branch 'master' into prototype_authorization
eugene-matvejev Aug 4, 2017
2d5002a
Merge branch 'master' into prototype_authorization
eugene-matvejev Aug 4, 2017
06c292d
Merge branch 'master' into prototype_authorization
eugene-matvejev Aug 4, 2017
6be8f45
Merge branch 'master' into prototype_authorization
eugene-matvejev Aug 10, 2017
f1a2953
Merge branch 'master' into prototype_authorization
eugene-matvejev Aug 24, 2017
cc02f9c
Merge branch 'master' into prototype_authorization
eugene-matvejev Sep 6, 2017
ad59b48
Merge branch 'master' into prototype_authorization
eugene-matvejev Jan 9, 2018
5a2e57c
Update MockFactory.php
eugene-matvejev Jan 9, 2018
3c6744d
Update valid-1-opponent-7x7.json
eugene-matvejev Jan 9, 2018
ae20e29
Update MockFactory.php
eugene-matvejev Jan 9, 2018
f0fdffa
Update MockFactory.php
eugene-matvejev Jan 9, 2018
d7a9f0d
Update MockFactory.php
eugene-matvejev Jan 9, 2018
8c94636
Update AbstractControllerTestCase.php
eugene-matvejev Jan 9, 2018
adc3e96
Update WsseFactory.php
eugene-matvejev Jan 9, 2018
6b00397
Merge branch 'master' into prototype_authorization
Jan 9, 2018
3c4a989
fix typos
Jan 9, 2018
a2b6ecd
Merge branch 'master' into prototype_authorization
Jan 9, 2018
52a34df
Update WsseProvider.php
eugene-matvejev Jan 9, 2018
7d48552
Update MockFactory.php
eugene-matvejev Jan 9, 2018
de1fad9
Merge branch 'master' into prototype_authorization
eugene-matvejev Jan 9, 2018
f4eea10
Update CommonControllerContext.php
eugene-matvejev Jan 9, 2018
875495d
Update GameResultController.php
eugene-matvejev Jan 9, 2018
931e21f
Update CommonControllerContext.php
eugene-matvejev Jan 9, 2018
c1630bc
Merge branch 'master' into prototype_authorization
Jan 10, 2018
798e184
Update AbstractControllerTestCase.php
eugene-matvejev Jan 10, 2018
b072cbe
Merge branch 'master' into prototype_authorization
Jan 10, 2018
e5d8dfd
typo
Jan 10, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/AppKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ public function registerBundles() : array
$bundles = [
/** SYMFONY */
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
/* new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(), */
/* new Symfony\Bundle\SecurityBundle\SecurityBundle(), */
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
/** EXTRA */
new JMS\SerializerBundle\JMSSerializerBundle(),
Expand Down
50 changes: 50 additions & 0 deletions app/DoctrineMigrations/Version20160724000000.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php

namespace Application\Migrations;

use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

/**
* Auto-generated Migration: Please modify to your needs!
*/
class Version20160724000000 extends AbstractMigration
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
// this up() migration is auto-generated, please modify it to your needs
$this->skipIf($this->connection->getDatabasePlatform()->getName() != 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');

$this->addSql('CREATE TABLE player_sessions (id SERIAL NOT NULL, player INT NOT NULL, hash VARCHAR(40) NOT NULL, timestamp TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_9CB7DCF398197A65 ON player_sessions (player)');
$this->addSql('CREATE INDEX INDEX_SESSION_HASH ON player_sessions (hash)');
$this->addSql('ALTER TABLE player_sessions ADD CONSTRAINT FK_9CB7DCF398197A65 FOREIGN KEY (player) REFERENCES players (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('DROP INDEX index_player_name');
$this->addSql('ALTER TABLE players ADD passwordHash VARCHAR(40) NOT NULL');
$this->addSql('ALTER TABLE players RENAME COLUMN name TO email');
$this->addSql('ALTER TABLE players ALTER email TYPE VARCHAR(255)');
$this->addSql('CREATE INDEX INDEX_PLAYER_EMAIL ON players (email)');
$this->addSql('CREATE INDEX INDEX_PLAYER_EMAIL_AND_PASSWORD ON players (email, passwordHash)');
}

/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
// this down() migration is auto-generated, please modify it to your needs
$this->skipIf($this->connection->getDatabasePlatform()->getName() != 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');

$this->addSql('CREATE SCHEMA public');
$this->addSql('DROP TABLE player_sessions');
$this->addSql('DROP INDEX INDEX_PLAYER_EMAIL');
$this->addSql('DROP INDEX INDEX_PLAYER_EMAIL_AND_PASSWORD');
$this->addSql('ALTER TABLE players DROP passwordHash');
$this->addSql('ALTER TABLE players RENAME COLUMN email TO name');
$this->addSql('ALTER TABLE players ALTER name TYPE VARCHAR(25)');
$this->addSql('CREATE INDEX index_player_name ON players (name)');
}
}
45 changes: 45 additions & 0 deletions app/DoctrineMigrations/Version20160724000001.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

namespace Application\Migrations;

use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

/**
* Auto-generated Migration: Please modify to your needs!
*/
class Version20160724000001 extends AbstractMigration
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
// this up() migration is auto-generated, please modify it to your needs
$this->skipIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');

$this->addSql('RENAME TABLE players TO users');
$this->addSql('CREATE TABLE user_sessions (id INT AUTO_INCREMENT NOT NULL, player INT NOT NULL, hash VARCHAR(40) NOT NULL, timestamp DATETIME NOT NULL, INDEX IDX_7AED791398197A65 (player), INDEX INDEX_SESSION_HASH (hash), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
$this->addSql('ALTER TABLE user_sessions ADD CONSTRAINT FK_7AED791398197A65 FOREIGN KEY (player) REFERENCES users (id)');
$this->addSql('DROP INDEX INDEX_PLAYER_NAME ON users');
$this->addSql('ALTER TABLE users CHANGE name email VARCHAR(255) NOT NULL, ADD passwordHash VARCHAR(40) NOT NULL');
$this->addSql('CREATE INDEX INDEX_USER_EMAIL ON users (email)');
$this->addSql('CREATE INDEX INDEX_USER_EMAIL_AND_PASSWORD ON users (email, passwordHash)');
}

/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
// this down() migration is auto-generated, please modify it to your needs
$this->skipIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');

$this->addSql('RENAME TABLE users TO players');
$this->addSql('DROP TABLE user_sessions');
$this->addSql('DROP INDEX INDEX_USER_EMAIL ON users');
$this->addSql('DROP INDEX INDEX_USER_EMAIL_AND_PASSWORD ON users');
$this->addSql('ALTER TABLE users CHANGE email name VARCHAR(25) NOT NULL COLLATE utf8_unicode_ci, DROP passwordHash');
$this->addSql('CREATE INDEX INDEX_PLAYER_NAME ON users (name)');
}
}
110 changes: 110 additions & 0 deletions app/DoctrineMigrations/Version20160724000002.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
<?php

namespace Application\Migrations;

use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

/**
* Auto-generated Migration: Please modify to your needs!
*/
class Version20160724000002 extends AbstractMigration
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
// this up() migration is auto-generated, please modify it to your needs
$this->skipIf($this->connection->getDatabasePlatform()->getName() != 'sqlite', 'Migration can only be executed safely on \'sqlite\'.');

$this->addSql('CREATE TABLE player_sessions (id INTEGER NOT NULL, player INTEGER NOT NULL, hash VARCHAR(40) NOT NULL, timestamp DATETIME NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_9CB7DCF398197A65 ON player_sessions (player)');
$this->addSql('CREATE INDEX INDEX_SESSION_HASH ON player_sessions (hash)');
$this->addSql('DROP INDEX INDEX_BATTLEFIELDS_PLAYER');
$this->addSql('DROP INDEX INDEX_BATTLEFIELDS_GAME');
$this->addSql('CREATE TEMPORARY TABLE __temp__battlefields AS SELECT id, game, player FROM battlefields');
$this->addSql('DROP TABLE battlefields');
$this->addSql('CREATE TABLE battlefields (id INTEGER NOT NULL, game INTEGER NOT NULL, player INTEGER NOT NULL, PRIMARY KEY(id), CONSTRAINT FK_EDE65EA6232B318C FOREIGN KEY (game) REFERENCES games (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_EDE65EA698197A65 FOREIGN KEY (player) REFERENCES players (id) NOT DEFERRABLE INITIALLY IMMEDIATE)');
$this->addSql('INSERT INTO battlefields (id, game, player) SELECT id, game, player FROM __temp__battlefields');
$this->addSql('DROP TABLE __temp__battlefields');
$this->addSql('CREATE INDEX INDEX_BATTLEFIELDS_PLAYER ON battlefields (player)');
$this->addSql('CREATE INDEX INDEX_BATTLEFIELDS_GAME ON battlefields (game)');
$this->addSql('DROP INDEX UNIQUE_CELL_PER_BATTLEFIELD');
$this->addSql('DROP INDEX INDEX_CELLS_BATTLEFIELD');
$this->addSql('CREATE TEMPORARY TABLE __temp__cells AS SELECT id, battlefield, coordinate, flags FROM cells');
$this->addSql('DROP TABLE cells');
$this->addSql('CREATE TABLE cells (id INTEGER NOT NULL, battlefield INTEGER NOT NULL, coordinate VARCHAR(3) NOT NULL COLLATE BINARY, flags INTEGER NOT NULL, PRIMARY KEY(id), CONSTRAINT FK_55C1CBD851B7F6D5 FOREIGN KEY (battlefield) REFERENCES battlefields (id) NOT DEFERRABLE INITIALLY IMMEDIATE)');
$this->addSql('INSERT INTO cells (id, battlefield, coordinate, flags) SELECT id, battlefield, coordinate, flags FROM __temp__cells');
$this->addSql('DROP TABLE __temp__cells');
$this->addSql('CREATE UNIQUE INDEX UNIQUE_CELL_PER_BATTLEFIELD ON cells (battlefield, coordinate)');
$this->addSql('CREATE INDEX INDEX_CELLS_BATTLEFIELD ON cells (battlefield)');
$this->addSql('DROP INDEX INDEX_GAME_RESULT_WINNER');
$this->addSql('DROP INDEX INDEX_GAME_RESULT_GAME');
$this->addSql('DROP INDEX UNIQ_A619B3B232B318C');
$this->addSql('CREATE TEMPORARY TABLE __temp__game_results AS SELECT id, game, player, timestamp FROM game_results');
$this->addSql('DROP TABLE game_results');
$this->addSql('CREATE TABLE game_results (id INTEGER NOT NULL, game INTEGER NOT NULL, player INTEGER NOT NULL, timestamp DATETIME NOT NULL, PRIMARY KEY(id), CONSTRAINT FK_A619B3B232B318C FOREIGN KEY (game) REFERENCES games (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_A619B3B98197A65 FOREIGN KEY (player) REFERENCES players (id) NOT DEFERRABLE INITIALLY IMMEDIATE)');
$this->addSql('INSERT INTO game_results (id, game, player, timestamp) SELECT id, game, player, timestamp FROM __temp__game_results');
$this->addSql('DROP TABLE __temp__game_results');
$this->addSql('CREATE INDEX INDEX_GAME_RESULT_WINNER ON game_results (player)');
$this->addSql('CREATE INDEX INDEX_GAME_RESULT_GAME ON game_results (game)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_A619B3B232B318C ON game_results (game)');
$this->addSql('DROP INDEX INDEX_PLAYER_NAME');
$this->addSql('CREATE TEMPORARY TABLE __temp__players AS SELECT id, name, flags FROM players');
$this->addSql('DROP TABLE players');
$this->addSql('CREATE TABLE players (id INTEGER NOT NULL, flags INTEGER NOT NULL, email VARCHAR(25) NOT NULL, passwordHash VARCHAR(40) NOT NULL, PRIMARY KEY(id))');
$this->addSql('INSERT INTO players (id, email, flags) SELECT id, name, flags FROM __temp__players');
$this->addSql('DROP TABLE __temp__players');
$this->addSql('CREATE INDEX INDEX_PLAYER_EMAIL ON players (email)');
$this->addSql('CREATE INDEX INDEX_PLAYER_EMAIL_AND_PASSWORD ON players (email, passwordHash)');
}

/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
// this down() migration is auto-generated, please modify it to your needs
$this->skipIf($this->connection->getDatabasePlatform()->getName() != 'sqlite', 'Migration can only be executed safely on \'sqlite\'.');

$this->addSql('DROP TABLE player_sessions');
$this->addSql('DROP INDEX INDEX_BATTLEFIELDS_GAME');
$this->addSql('DROP INDEX INDEX_BATTLEFIELDS_PLAYER');
$this->addSql('CREATE TEMPORARY TABLE __temp__battlefields AS SELECT id, game, player FROM battlefields');
$this->addSql('DROP TABLE battlefields');
$this->addSql('CREATE TABLE battlefields (id INTEGER NOT NULL, game INTEGER NOT NULL, player INTEGER NOT NULL, PRIMARY KEY(id))');
$this->addSql('INSERT INTO battlefields (id, game, player) SELECT id, game, player FROM __temp__battlefields');
$this->addSql('DROP TABLE __temp__battlefields');
$this->addSql('CREATE INDEX INDEX_BATTLEFIELDS_GAME ON battlefields (game)');
$this->addSql('CREATE INDEX INDEX_BATTLEFIELDS_PLAYER ON battlefields (player)');
$this->addSql('DROP INDEX INDEX_CELLS_BATTLEFIELD');
$this->addSql('DROP INDEX UNIQUE_CELL_PER_BATTLEFIELD');
$this->addSql('CREATE TEMPORARY TABLE __temp__cells AS SELECT id, battlefield, coordinate, flags FROM cells');
$this->addSql('DROP TABLE cells');
$this->addSql('CREATE TABLE cells (id INTEGER NOT NULL, battlefield INTEGER NOT NULL, coordinate VARCHAR(3) NOT NULL, flags INTEGER NOT NULL, PRIMARY KEY(id))');
$this->addSql('INSERT INTO cells (id, battlefield, coordinate, flags) SELECT id, battlefield, coordinate, flags FROM __temp__cells');
$this->addSql('DROP TABLE __temp__cells');
$this->addSql('CREATE INDEX INDEX_CELLS_BATTLEFIELD ON cells (battlefield)');
$this->addSql('CREATE UNIQUE INDEX UNIQUE_CELL_PER_BATTLEFIELD ON cells (battlefield, coordinate)');
$this->addSql('DROP INDEX UNIQ_A619B3B232B318C');
$this->addSql('DROP INDEX INDEX_GAME_RESULT_GAME');
$this->addSql('DROP INDEX INDEX_GAME_RESULT_WINNER');
$this->addSql('CREATE TEMPORARY TABLE __temp__game_results AS SELECT id, game, player, timestamp FROM game_results');
$this->addSql('DROP TABLE game_results');
$this->addSql('CREATE TABLE game_results (id INTEGER NOT NULL, game INTEGER NOT NULL, player INTEGER NOT NULL, timestamp DATETIME NOT NULL, PRIMARY KEY(id))');
$this->addSql('INSERT INTO game_results (id, game, player, timestamp) SELECT id, game, player, timestamp FROM __temp__game_results');
$this->addSql('DROP TABLE __temp__game_results');
$this->addSql('CREATE UNIQUE INDEX UNIQ_A619B3B232B318C ON game_results (game)');
$this->addSql('CREATE INDEX INDEX_GAME_RESULT_GAME ON game_results (game)');
$this->addSql('CREATE INDEX INDEX_GAME_RESULT_WINNER ON game_results (player)');
$this->addSql('DROP INDEX INDEX_PLAYER_EMAIL');
$this->addSql('DROP INDEX INDEX_PLAYER_EMAIL_AND_PASSWORD');
$this->addSql('CREATE TEMPORARY TABLE __temp__players AS SELECT id, email, flags FROM players');
$this->addSql('DROP TABLE players');
$this->addSql('CREATE TABLE players (id INTEGER NOT NULL, flags INTEGER NOT NULL, name VARCHAR(25) NOT NULL COLLATE BINARY, PRIMARY KEY(id))');
$this->addSql('INSERT INTO players (id, name, flags) SELECT id, email, flags FROM __temp__players');
$this->addSql('DROP TABLE __temp__players');
$this->addSql('CREATE INDEX INDEX_PLAYER_NAME ON players (name)');
}
}
1 change: 1 addition & 0 deletions app/config/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
imports:
- { resource: parameters.yml }
- { resource: security.yml }
- { resource: services.yml }

# Put parameters here that don't need to change on each machine where the app is deployed
Expand Down
25 changes: 25 additions & 0 deletions app/config/security.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# To get started with security, check out the documentation:
# http://symfony.com/doc/current/book/security.html
security:
# http://symfony.com/doc/current/book/security.html#where-do-users-come-from-user-providers
providers:
in_memory:
memory: ~

database_users:
entity: { class: GameBundle:PlayerSession, property: hash }

firewalls:
# disables authentication for assets and the profiler, adapt it according to your needs
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
main:
anonymous: ~
# activate different ways to authenticate

# http_basic: ~
# http://symfony.com/doc/current/book/security.html#a-configuring-how-your-users-will-authenticate

# form_login: ~
# http://symfony.com/doc/current/cookbook/security/form_login_setup.html
1 change: 1 addition & 0 deletions app/config/services.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
imports:
- { resource: "@FoundationBundle/Resources/config/services.yml" }
- { resource: "@GameBundle/Resources/config/services.yml" }
3 changes: 3 additions & 0 deletions behat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ default:
- EM\Tests\Behat\GameBundle\Controller\GameResultControllerContext:
filters:
tags: "@api"
api.player.management:
paths:
- "%paths.base%/tests/behat/suites/api/api.player_management.feature"
api.response.validation.against.schema:
paths: [ "%paths.base%/tests/behat/suites/api/api.json.validation.against.schema.feature" ]
contexts:
Expand Down
Loading