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

Adjust to atk4 3.0 #76

Merged
merged 92 commits into from
Oct 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
3a95b46
Align with atk4/core workflow
abbadon1334 Apr 23, 2021
88b854a
Add Behat test workflow from Atk4/Ui
abbadon1334 Apr 23, 2021
6d184a2
Remove js compilation from Behat tests
abbadon1334 Apr 23, 2021
8b22b4f
Update composer.json
abbadon1334 Apr 23, 2021
094bc33
Add phpstan.neon.dist from Atk4/Data, removed ignoreErrors
abbadon1334 Apr 23, 2021
1dde055
Remove creation of db
abbadon1334 Apr 23, 2021
1080792
Initial Fixes phpstan
abbadon1334 Apr 23, 2021
01acd93
Fix Namespace case
abbadon1334 Apr 23, 2021
97124d7
demo rename login.php to form-login.php
abbadon1334 Apr 23, 2021
157e26f
Re-Add create-sqlite-db.php
abbadon1334 Apr 23, 2021
c01258e
Fix path & fqcn
abbadon1334 Apr 23, 2021
260e685
Fix database creation
abbadon1334 Apr 23, 2021
8240c48
Fix release dep to 2.5
abbadon1334 Apr 23, 2021
f814c3e
Start fixing behat
abbadon1334 Apr 23, 2021
5b3b712
Drop inherited dependency from require-release
abbadon1334 Apr 23, 2021
1ee9044
Fix Behat
abbadon1334 Apr 23, 2021
27b1612
Fix add -> addTo
abbadon1334 Apr 23, 2021
774ec21
BugFix : hardcoded field login as email when use default Form/Login
abbadon1334 Apr 23, 2021
f5c1610
Fix access to array
abbadon1334 Apr 23, 2021
599e921
Remove useless [] when called new Array_()
abbadon1334 Apr 23, 2021
ab096e0
Fix UnitTest Array Access error using new way Array_/Db/Table/Rows
abbadon1334 Apr 23, 2021
adbfe14
CS-Fix
abbadon1334 Apr 23, 2021
62c482c
Add Stan generated baseline
abbadon1334 Apr 23, 2021
774e9d2
Add Stan generated baseline
abbadon1334 Apr 23, 2021
d213e23
Demo : Align layout form register to form login
abbadon1334 Apr 23, 2021
dfc8dcd
Rename basic.feature to login.feature
abbadon1334 Apr 23, 2021
3e94666
Add Behat register.feature
abbadon1334 Apr 23, 2021
35b2d41
Align Login and Register to internally use fieldLogin and fieldPasswo…
abbadon1334 Apr 23, 2021
e4bf506
CS-Fix
abbadon1334 Apr 23, 2021
d920c5e
Clean up
abbadon1334 Apr 24, 2021
37545e9
Change from GetProtected to Model->export
abbadon1334 Apr 24, 2021
b35c531
CS Fix
abbadon1334 Apr 24, 2021
b6bd1bd
Fix add sleep(1) to right file.
abbadon1334 Apr 26, 2021
2d70c57
change init.php to init-app.php like in Atk4/Ui, to avoid errors on i…
abbadon1334 Apr 26, 2021
e4ccc68
Add 1 phpstan-ignore
abbadon1334 Apr 26, 2021
60d07b9
FIX : one FQCN error and removed from stan
abbadon1334 Apr 26, 2021
7e615b6
Solving phpstan errors
abbadon1334 Apr 26, 2021
58e7d5b
fix array persistence test
DarkSide666 Apr 26, 2021
8ea3197
Merge branch 'feature/fix-table' of https://github.com/atk4/login int…
abbadon1334 Apr 26, 2021
8dd1849
Fix : removing Array_($a /* empty array */) to Array_()
abbadon1334 Apr 26, 2021
deb5d1d
test behat
DarkSide666 Apr 26, 2021
635e227
test
DarkSide666 Apr 26, 2021
581c94f
contains?
DarkSide666 Apr 26, 2021
09ac020
contains
DarkSide666 Apr 26, 2021
60d0e98
hmmm
DarkSide666 Apr 26, 2021
cb6fcd5
test
DarkSide666 Apr 26, 2021
126c8af
hmm2
DarkSide666 Apr 26, 2021
d20cef0
test again
DarkSide666 Apr 26, 2021
c0a9744
rollback
DarkSide666 Apr 26, 2021
eb4f5eb
test behat & rollback
DarkSide666 Apr 26, 2021
596e985
try to fix behat
abbadon1334 Apr 26, 2021
17a5100
Merge remote-tracking branch 'origin/update-release-workflow' into up…
abbadon1334 Apr 26, 2021
bbc35da
try to fix behat
abbadon1334 Apr 26, 2021
53f7904
try to fix behat
abbadon1334 Apr 26, 2021
1c50bc6
try to fix behat
abbadon1334 Apr 26, 2021
ea0a6f0
Remove failing tests. Not to be tested in this repo
abbadon1334 Apr 27, 2021
f0f6b20
Fix : Model::data now is private switch to &getDataRef()
abbadon1334 Apr 27, 2021
61d8acd
Use setMulti (getDataRef is internal)
abbadon1334 Apr 29, 2021
46a0854
Rollback [Unit-Burn] using ui settings for testing leaks + Behat [Chr…
abbadon1334 Apr 29, 2021
9bd9d8f
Use Atk4/Ui/Behat/Context
abbadon1334 May 12, 2021
27dc12e
Set require to atk4/ui 2.4 for release
abbadon1334 Jun 10, 2021
c2a6562
Add conditional to local run https://github.com/nektos/act
abbadon1334 Jun 10, 2021
26b8843
Fix password test for 2.4
abbadon1334 Jun 10, 2021
aef6b25
CS fix
abbadon1334 Jun 10, 2021
0ebdb38
Merge branch 'develop' into update-release-workflow
abbadon1334 Jun 10, 2021
db1a2df
Add Behat context file for 2.4 release
abbadon1334 Jun 10, 2021
1cb4c33
Rename deprecated filename for cs-fixer
abbadon1334 Jun 10, 2021
d0109c2
Adjust Behat conf
abbadon1334 Jun 10, 2021
67d4142
Merge remote-tracking branch 'origin/update-release-workflow' into up…
abbadon1334 Jun 10, 2021
82e0e2e
Fix phpstan
abbadon1334 Jun 10, 2021
9c12a8e
Fix memory leak
abbadon1334 Jun 10, 2021
f503010
remove condition, exception will throw before (in method fieldExists)
abbadon1334 Jun 10, 2021
1fff1b2
align composer to dev-develop
abbadon1334 Jun 11, 2021
6779a0d
Remove internal behat context
abbadon1334 Jun 11, 2021
a23cc24
Fix Behat with Atk4/Ui Behat context
abbadon1334 Jun 11, 2021
f11b858
Fix Entity 3.0
abbadon1334 Jun 11, 2021
1c1ae57
Fix Entity 3.0
abbadon1334 Jun 12, 2021
1a647a0
Add hook on afterload to recover passwordHash after createEntity
abbadon1334 Jun 12, 2021
63d691d
Add hook on afterunload cleanup passwordHash
abbadon1334 Jun 12, 2021
c2db1dc
Fix Entity 3.0
abbadon1334 Jun 12, 2021
af185fc
Drop support for PHP 7.3
abbadon1334 Jun 12, 2021
4916f02
Fix Cs-Fixer
abbadon1334 Jun 12, 2021
36af1e6
Fix Entity 3.0
abbadon1334 Jun 12, 2021
0da7709
Add type to anonymous function params
abbadon1334 Jun 12, 2021
8e9079e
clean behat file
abbadon1334 Jun 12, 2021
7479948
Add rule on phpstan
abbadon1334 Jun 12, 2021
d774916
Merge branch 'develop' into update/3.0
mvorisek Oct 14, 2021
5778382
Unify CI files and fix for atk4/ui 3.0
mvorisek Oct 15, 2021
8715468
Fix composer.json CS
mvorisek Oct 16, 2021
8990f11
Merge branch 'release/2.4' into update/3.0
mvorisek Oct 16, 2021
c25d272
fix/sync html with pug template
mvorisek Oct 16, 2021
f667cda
fix all pug
mvorisek Oct 16, 2021
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
1 change: 1 addition & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ categories:
- "Documentation :books:"
template: |
## What’s Changed

$CHANGES
2 changes: 1 addition & 1 deletion .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
name: Build Release
runs-on: ubuntu-latest
container:
image: atk4/image:latest
image: ghcr.io/mvorisek/image-php:latest
steps:
- uses: actions/checkout@v2
with:
Expand Down
297 changes: 242 additions & 55 deletions .github/workflows/test-unit.yml

Large diffs are not rendered by default.

12 changes: 7 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
docs/build
/build
/docs/build
/coverage
/vendor
/composer.lock
.idea
nbproject
.vscode
.DS_Store

local
*.local
*.local.*
cache
*.cache
*.cache.*

/demos/db.php
/demos/_demo-data/db.sqlite
/demos/_demo-data/db.sqlite-journal
/phpunit.xml
/phpunit-*.xml
/behat.yml

*.bak
/demos/data/db.sqlite
28 changes: 13 additions & 15 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
<?php

$finder = PhpCsFixer\Finder::create()
->in([__DIR__])
->exclude([
'cache',
'build',
'vendor',
])
->in(__DIR__)
;
]);

$config = new PhpCsFixer\Config();
$config->setRiskyAllowed(true)
return (new PhpCsFixer\Config())
->setRiskyAllowed(true)
->setRules([
'@PhpCsFixer' => true,
'@PhpCsFixer:risky' =>true,
'@PHP71Migration:risky' => true,
'@PHP73Migration' => true,
'@PhpCsFixer:risky' => true,
'@PHP74Migration:risky' => true,
'@PHP74Migration' => true,

// required by PSR-12
'concat_space' => [
Expand All @@ -37,10 +36,8 @@
'equal' => false,
'identical' => false,
],
'native_constant_invocation' => true,
'native_function_invocation' => false,
'non_printable_character' => [
'use_escape_sequences_in_strings' => true,
],
'void_return' => false,
'blank_line_before_statement' => [
'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'exit'],
Expand All @@ -58,15 +55,16 @@
'phpdoc_add_missing_param_annotation' => false,
'return_assignment' => false,
'comment_to_phpdoc' => false,
'list_syntax' => ['syntax' => 'short'],
'general_phpdoc_annotation_remove' => [
'annotations' => ['author', 'copyright', 'throws'],
],
'nullable_type_declaration_for_default_null_value' => [
'use_nullable_type_declaration' => false,
],

// fn => without curly brackets is less readable,
// also prevent bounding of unwanted variables for GC
'use_arrow_functions' => false,
])
->setFinder($finder)
->setCacheFile(__DIR__ . '/.php_cs.cache');

return $config;
->setCacheFile(sys_get_temp_dir() . '/php-cs-fixer.' . md5(__DIR__) . '.cache');
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Here are all the classes implemented:
- Populates user menu with name of current user
- Adds log-out link
- Adds Preferences page
- [Flexible ACL support](docs/acl.md)
- Flexible ACL support
- Field\Password - password hashing, safety, generation and validation
- Model\User - basic user entity that can be extended
- LoginForm - username/password login form
Expand Down
7 changes: 3 additions & 4 deletions behat.yml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ default:
paths:
features: '%paths.base%/tests-behat'
contexts:
- Atk4\Login\Behat\Context
- Behat\MinkExtension\Context\MinkContext
- Atk4\Ui\Behat\Context
extensions:
Behat\MinkExtension:
show_cmd: 'open %s'
base_url: 'http://172.18.0.2:8888/demos'
base_url: 'http://172.18.0.2:8888/demos'
sessions:
default:
selenium2:
Expand All @@ -20,4 +19,4 @@ default:
chrome:
args:
- '--headless'
- '--window-size=1930,1200'
- '--window-size=1920,1200'
6 changes: 2 additions & 4 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
ignore:
- src/Behat
- demos
- docs
- template
- tests
- tests-behat
comment: false
coverage:
status:
project:
default:
target: auto
threshold: 0.1
threshold: 0.025
patch: false
changes: false
124 changes: 61 additions & 63 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,65 +1,63 @@
{
"name": "atk4/login",
"type": "library",
"description": "Login and User module for Agile UI",
"keywords": [
"user",
"acl",
"auth",
"login",
"atk4",
"agile",
"agile ui",
"data",
"framework"
],
"homepage": "https://github.com/atk4/login",
"license": "MIT",
"authors": [
{
"name": "Romans Malinovskis",
"email": "romans@agiletoolkit.org",
"homepage": "https://nearly.guru/"
}
],
"minimum-stability": "dev",
"prefer-stable": true,
"config": {
"sort-packages": true
},
"require": {
"php": ">=7.3.0",
"atk4/ui": "2.4.*",
"atk4/data": "2.4.*"
},
"require-release": {
"php": ">=7.3.0",
"atk4/ui": "~2.4.0"
},
"require-dev": {
"behat/behat": "^3.8",
"behat/mink": "^1.8",
"behat/mink-extension": "^2.3.1",
"behat/mink-selenium2-driver": "^1.4",
"ergebnis/composer-normalize": "^2.13",
"friendsofphp/php-cs-fixer": "^2.17",
"johnkary/phpunit-speedtrap": "^3.2",
"instaclick/php-webdriver": "^1.4.7",
"phpstan/phpstan": "^0.12.82",
"phpunit/phpcov": "*",
"phpunit/phpunit": ">=9.3",
"symfony/contracts": ">=1.1"
},
"autoload": {
"psr-4": {
"Atk4\\Login\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Atk4\\Login\\Behat\\": "tests-behat/Bootstrap/",
"Atk4\\Login\\Demo\\": "demos/src/",
"Atk4\\Login\\Tests\\": "tests/"
}
}
"name": "atk4/login",
"type": "library",
"description": "Login and User module for Agile UI",
"keywords": [
"user",
"acl",
"auth",
"login",
"atk4",
"agile",
"agile ui",
"data",
"framework"
],
"homepage": "https://github.com/atk4/login",
"license": "MIT",
"authors": [
{
"name": "Romans Malinovskis",
"email": "romans@agiletoolkit.org",
"homepage": "https://nearly.guru/"
},
{
"name": "Michael Voříšek",
"homepage": "https://mvorisek.cz/"
}
],
"require": {
"php": ">=7.4 <8.2",
"atk4/ui": "~3.0.0"
},
"require-dev": {
"behat/behat": "^3.8.2 || dev-master#6f38d11",
"behat/gherkin": "^4.8.1 || dev-master#5fbf806",
"behat/mink": "^1.8.2 || dev-master#1ab79d6",
"behat/mink-extension": "^2.3.1",
"behat/mink-selenium2-driver": "^1.4",
"ergebnis/composer-normalize": "^2.13",
"friendsofphp/php-cs-fixer": "^3.0",
"instaclick/php-webdriver": "^1.4.7",
"johnkary/phpunit-speedtrap": "^3.3",
"phpstan/phpstan": "^0.12.82",
"phpunit/phpcov": "*",
"phpunit/phpunit": "^9.5.5",
"symfony/contracts": ">=1.1"
},
"config": {
"sort-packages": true
},
"autoload": {
"psr-4": {
"Atk4\\Login\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Atk4\\Login\\Tests\\": "tests/"
}
},
"minimum-stability": "dev",
"prefer-stable": true
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,40 @@

namespace Atk4\Login\Demos;

include __DIR__ . '/../../vendor/autoload.php';
use Atk4\Data\Model;
use Atk4\Schema\Migration;

$sqliteFile = __DIR__ . '/../data/db.sqlite';
if (file_exists($sqliteFile)) {
unlink($sqliteFile);
require_once __DIR__ . '/../init-autoloader.php';

$sqliteFile = __DIR__ . '/db.sqlite';
if (!file_exists($sqliteFile)) {
new \Atk4\Data\Persistence\Sql('sqlite:' . $sqliteFile);
}
unset($sqliteFile);

/** @var \Atk4\Data\Persistence\Sql $db */
require_once __DIR__ . '/../init-db.php';

$persistence = new \Atk4\Data\Persistence\Sql('sqlite:' . $sqliteFile);
$model = new \Atk4\Data\Model($persistence, ['table' => 'login_user']);
$model = new Model($db, ['table' => 'login_user']);
$model->addField('name', ['type' => 'string']);
$model->addField('email', ['type' => 'string']);
$model->addField('password', ['type' => 'string']);
$model->addField('role_id', ['type' => 'integer']);
(new \Atk4\Schema\Migration($model))->dropIfExists()->create();
(new Migration($model))->create();
$model->import([
1 => ['id' => 1, 'name' => 'Standard User', 'email' => 'user', 'password' => '$2y$10$BwEhcP8f15yOexf077VTHOnySn/mit49ZhpfeBkORQhrsmHr4U6Qy', 'role_id' => 1], // user/user
2 => ['id' => 2, 'name' => 'Administrator', 'email' => 'admin', 'password' => '$2y$10$p34ciRcg9GZyxukkLIaEnenGBao79fTFa4tFSrl7FvqrxnmEGlD4O', 'role_id' => 2], // admin/admin
]);

$model = new \Atk4\Data\Model($persistence, ['table' => 'login_role']);
$model = new Model($db, ['table' => 'login_role']);
$model->addField('name', ['type' => 'string']);
(new \Atk4\Schema\Migration($model))->dropIfExists()->create();
(new Migration($model))->create();
$model->import([
1 => ['id' => 1, 'name' => 'User Role'],
2 => ['id' => 2, 'name' => 'Admin Role'],
]);

$model = new \Atk4\Data\Model($persistence, ['table' => 'login_access_role']);
$model = new Model($db, ['table' => 'login_access_role']);
$model->addField('role_id', ['type' => 'integer']);
$model->addField('model', ['type' => 'string']);
$model->addField('all_visible', ['type' => 'boolean']);
Expand All @@ -42,11 +48,11 @@
$model->addField('actions', ['type' => 'boolean']);
$model->addField('conditions', ['type' => 'boolean']);

(new \Atk4\Schema\Migration($model))->dropIfExists()->create();
(new Migration($model))->create();
$model->import([
1 => ['id' => 1, 'role_id' => 1, 'model' => '\\Atk4\Login\\Model\\User', 'all_visible' => 1, 'visible_fields' => null, 'all_editable' => 0, 'editable_fields' => null, 'all_actions' => 1, 'actions' => null, 'conditions' => null],
2 => ['id' => 2, 'role_id' => 2, 'model' => '\\Atk4\Login\\Model\\User', 'all_visible' => 1, 'visible_fields' => null, 'all_editable' => 1, 'editable_fields' => null, 'all_actions' => 1, 'actions' => null, 'conditions' => null],
3 => ['id' => 3, 'role_id' => 2, 'model' => '\\Atk4\Login\\Model\\Role', 'all_visible' => 1, 'visible_fields' => null, 'all_editable' => 1, 'editable_fields' => null, 'all_actions' => 1, 'actions' => null, 'conditions' => null],
]);

echo 'import complete!' . "\n";
echo 'import complete!' . "\n\n";
4 changes: 2 additions & 2 deletions demos/src/App.php → demos/_includes/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Atk4\Login\Demo;
namespace Atk4\Login\Demos;

use Atk4\Login\Acl;
use Atk4\Login\Auth;
Expand All @@ -11,7 +11,7 @@
/**
* Example implementation of your Authenticated application.
*/
class App extends AbstractApp
class App extends \Atk4\Ui\App
{
public $auth;
public $title = 'Demo App';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Atk4\Login\Demo;
namespace Atk4\Login\Demos;

use Atk4\Core\AppScopeTrait;
use Atk4\Core\DynamicMethodTrait;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Atk4\Login\Demo\Model;
namespace Atk4\Login\Demos\Model;

use Atk4\Data\Model;

Expand Down
2 changes: 1 addition & 1 deletion demos/acl-clients.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Atk4\Login\Demo;
namespace Atk4\Login\Demos;

use Atk4\Ui\Crud;
use Atk4\Ui\Header;
Expand Down
Loading