* updated to Symfony 4.1 #149 * updated to phpunit 7 #149 * downgrade ocramius/proxy-manager for PHP 7.1 compatibility #149 * fixed symfony deprecations #149 * replaced AdvancedUserInterface with custom user checker * code sniffer fixes
This commit is contained in:
@@ -9,6 +9,7 @@
|
|||||||
"avanzu/admin-theme-bundle": "dev-kevinpapst",
|
"avanzu/admin-theme-bundle": "dev-kevinpapst",
|
||||||
"beberlei/DoctrineExtensions": "^1.0",
|
"beberlei/DoctrineExtensions": "^1.0",
|
||||||
"erusev/parsedown": "^1.6",
|
"erusev/parsedown": "^1.6",
|
||||||
|
"ocramius/proxy-manager": "2.1.1",
|
||||||
"sensio/framework-extra-bundle": "^5.1",
|
"sensio/framework-extra-bundle": "^5.1",
|
||||||
"symfony/asset": "^4.0",
|
"symfony/asset": "^4.0",
|
||||||
"symfony/console": "^4.0",
|
"symfony/console": "^4.0",
|
||||||
@@ -36,7 +37,7 @@
|
|||||||
"dama/doctrine-test-bundle": "^5.0",
|
"dama/doctrine-test-bundle": "^5.0",
|
||||||
"doctrine/doctrine-fixtures-bundle": "^3.0",
|
"doctrine/doctrine-fixtures-bundle": "^3.0",
|
||||||
"friendsofphp/php-cs-fixer": "^2.10",
|
"friendsofphp/php-cs-fixer": "^2.10",
|
||||||
"phpunit/phpunit": "^6.5",
|
"phpunit/phpunit": "^7.0",
|
||||||
"squizlabs/php_codesniffer": "^3.2",
|
"squizlabs/php_codesniffer": "^3.2",
|
||||||
"symfony/browser-kit": "^4.0",
|
"symfony/browser-kit": "^4.0",
|
||||||
"symfony/css-selector": "^4.0",
|
"symfony/css-selector": "^4.0",
|
||||||
|
|||||||
1502
composer.lock
generated
1502
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -14,12 +14,12 @@ security:
|
|||||||
security: false
|
security: false
|
||||||
|
|
||||||
secured_area:
|
secured_area:
|
||||||
# does what it says
|
|
||||||
logout_on_user_change: true
|
|
||||||
|
|
||||||
# this firewall applies to all URLs
|
# this firewall applies to all URLs
|
||||||
pattern: ^/
|
pattern: ^/
|
||||||
|
|
||||||
|
# make sure only allowed users have access to their time-tracking
|
||||||
|
user_checker: App\Security\UserChecker
|
||||||
|
|
||||||
# but the firewall does not require login on every page
|
# but the firewall does not require login on every page
|
||||||
# denying access is done in access_control or in your controllers
|
# denying access is done in access_control or in your controllers
|
||||||
anonymous: ~
|
anonymous: ~
|
||||||
|
|||||||
@@ -1,7 +1,14 @@
|
|||||||
|
home:
|
||||||
|
path: /
|
||||||
|
defaults:
|
||||||
|
_controller: Symfony\Bundle\FrameworkBundle\Controller\RedirectController::redirectAction
|
||||||
|
route: homepage
|
||||||
|
permanent: true
|
||||||
|
|
||||||
homepage:
|
homepage:
|
||||||
path: /{_locale}
|
path: /{_locale}
|
||||||
defaults:
|
defaults:
|
||||||
_controller: FrameworkBundle:Redirect:redirect
|
_controller: Symfony\Bundle\FrameworkBundle\Controller\RedirectController::redirectAction
|
||||||
route: timesheet
|
route: timesheet
|
||||||
permanent: true
|
permanent: true
|
||||||
|
|
||||||
|
|||||||
@@ -63,14 +63,21 @@ class CreateUserCommand extends Command
|
|||||||
*/
|
*/
|
||||||
protected function configure()
|
protected function configure()
|
||||||
{
|
{
|
||||||
|
$roles = implode(',', [User::DEFAULT_ROLE, User::ROLE_ADMIN]);
|
||||||
|
|
||||||
$this
|
$this
|
||||||
->setName('kimai:create-user')
|
->setName('kimai:create-user')
|
||||||
->setDescription('Create a new user')
|
->setDescription('Create a new user')
|
||||||
->setHelp('This command allows you to create a new user.')
|
->setHelp('This command allows you to create a new user.')
|
||||||
->addArgument('username', InputArgument::REQUIRED, 'The username of the user to be created (must be unique)')
|
->addArgument('username', InputArgument::REQUIRED, 'A name for the new user (must be unique)')
|
||||||
->addArgument('email', InputArgument::REQUIRED, 'Email address of the user to be created (must be unique)')
|
->addArgument('email', InputArgument::REQUIRED, 'Email address of the new user (must be unique)')
|
||||||
->addArgument('role', InputArgument::OPTIONAL, 'A comma separated list of roles to assign. Examples: "ROLE_USER,ROLE_SUPER_ADMIN"', User::DEFAULT_ROLE)
|
->addArgument(
|
||||||
->addArgument('password', InputArgument::OPTIONAL, 'Password for the user to be created')
|
'role',
|
||||||
|
InputArgument::OPTIONAL,
|
||||||
|
'A comma separated list of user roles, e.g. "'.$roles.'"',
|
||||||
|
User::DEFAULT_ROLE
|
||||||
|
)
|
||||||
|
->addArgument('password', InputArgument::OPTIONAL, 'Password for the new user (requested if not provided)')
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
|||||||
* @UniqueEntity("username")
|
* @UniqueEntity("username")
|
||||||
* @UniqueEntity("email")
|
* @UniqueEntity("email")
|
||||||
*/
|
*/
|
||||||
class User implements UserInterface, AdvancedUserInterface
|
class User implements UserInterface
|
||||||
{
|
{
|
||||||
const ROLE_CUSTOMER = 'ROLE_CUSTOMER';
|
const ROLE_CUSTOMER = 'ROLE_CUSTOMER';
|
||||||
const ROLE_USER = 'ROLE_USER';
|
const ROLE_USER = 'ROLE_USER';
|
||||||
@@ -405,30 +405,6 @@ class User implements UserInterface, AdvancedUserInterface
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritdoc
|
|
||||||
*/
|
|
||||||
public function isAccountNonExpired()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritdoc
|
|
||||||
*/
|
|
||||||
public function isAccountNonLocked()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritdoc
|
|
||||||
*/
|
|
||||||
public function isCredentialsNonExpired()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
|
|||||||
37
src/Security/UserChecker.php
Normal file
37
src/Security/UserChecker.php
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Kimai time-tracking app.
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Security;
|
||||||
|
|
||||||
|
use App\Entity\User;
|
||||||
|
use Symfony\Component\Security\Core\Exception\LockedException;
|
||||||
|
use Symfony\Component\Security\Core\User\UserCheckerInterface;
|
||||||
|
use Symfony\Component\Security\Core\User\UserInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Advanced checks during aithentication to make sure the user is allowed to use Kimai.
|
||||||
|
*/
|
||||||
|
class UserChecker implements UserCheckerInterface
|
||||||
|
{
|
||||||
|
public function checkPreAuth(UserInterface $user)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function checkPostAuth(UserInterface $user)
|
||||||
|
{
|
||||||
|
if (!$user instanceof User) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// user account is not enabled, the user may be notified
|
||||||
|
if (!$user->isEnabled()) {
|
||||||
|
throw new LockedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
18
symfony.lock
18
symfony.lock
@@ -11,6 +11,9 @@
|
|||||||
"composer/semver": {
|
"composer/semver": {
|
||||||
"version": "1.4.2"
|
"version": "1.4.2"
|
||||||
},
|
},
|
||||||
|
"composer/xdebug-handler": {
|
||||||
|
"version": "1.1.0"
|
||||||
|
},
|
||||||
"dama/doctrine-test-bundle": {
|
"dama/doctrine-test-bundle": {
|
||||||
"version": "4.0",
|
"version": "4.0",
|
||||||
"recipe": {
|
"recipe": {
|
||||||
@@ -113,9 +116,6 @@
|
|||||||
"ref": "bb31a3bbec00a8fc8aa1c9fbf9b0ef9fc492f93d"
|
"ref": "bb31a3bbec00a8fc8aa1c9fbf9b0ef9fc492f93d"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"gecko-packages/gecko-php-unit": {
|
|
||||||
"version": "v3.0"
|
|
||||||
},
|
|
||||||
"jdorn/sql-formatter": {
|
"jdorn/sql-formatter": {
|
||||||
"version": "v1.2.17"
|
"version": "v1.2.17"
|
||||||
},
|
},
|
||||||
@@ -125,6 +125,9 @@
|
|||||||
"myclabs/deep-copy": {
|
"myclabs/deep-copy": {
|
||||||
"version": "1.7.0"
|
"version": "1.7.0"
|
||||||
},
|
},
|
||||||
|
"nikic/php-parser": {
|
||||||
|
"version": "v4.0.2"
|
||||||
|
},
|
||||||
"ocramius/package-versions": {
|
"ocramius/package-versions": {
|
||||||
"version": "1.2.0"
|
"version": "1.2.0"
|
||||||
},
|
},
|
||||||
@@ -179,9 +182,6 @@
|
|||||||
"ref": "9d0927a518f631b4ae6508dac377b021761ff6d1"
|
"ref": "9d0927a518f631b4ae6508dac377b021761ff6d1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"phpunit/phpunit-mock-objects": {
|
|
||||||
"version": "5.0.6"
|
|
||||||
},
|
|
||||||
"psr/cache": {
|
"psr/cache": {
|
||||||
"version": "1.0.1"
|
"version": "1.0.1"
|
||||||
},
|
},
|
||||||
@@ -377,6 +377,9 @@
|
|||||||
"ref": "179470cb6492db92dffee208cfdb436f175c93b4"
|
"ref": "179470cb6492db92dffee208cfdb436f175c93b4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"symfony/polyfill-ctype": {
|
||||||
|
"version": "v1.8.0"
|
||||||
|
},
|
||||||
"symfony/polyfill-intl-icu": {
|
"symfony/polyfill-intl-icu": {
|
||||||
"version": "v1.6.0"
|
"version": "v1.6.0"
|
||||||
},
|
},
|
||||||
@@ -404,9 +407,6 @@
|
|||||||
"ref": "cda8b550123383d25827705d05a42acf6819fe4e"
|
"ref": "cda8b550123383d25827705d05a42acf6819fe4e"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"symfony/security": {
|
|
||||||
"version": "v4.0.3"
|
|
||||||
},
|
|
||||||
"symfony/security-bundle": {
|
"symfony/security-bundle": {
|
||||||
"version": "3.3",
|
"version": "3.3",
|
||||||
"recipe": {
|
"recipe": {
|
||||||
|
|||||||
Reference in New Issue
Block a user