fix(fixtureavatar): fixcture auto avatar & timesession & font & menu & redirect #5
1
.env
1
.env
|
@ -1,6 +1,7 @@
|
||||||
# Symfony
|
# Symfony
|
||||||
APP_ENV=prod
|
APP_ENV=prod
|
||||||
APP_SECRET=changeme
|
APP_SECRET=changeme
|
||||||
|
APP_SESSIONTIME=1440
|
||||||
|
|
||||||
# Messenger
|
# Messenger
|
||||||
MESSENGER_TRANSPORT_DSN=doctrine://default?auto_setup=0
|
MESSENGER_TRANSPORT_DSN=doctrine://default?auto_setup=0
|
||||||
|
|
Binary file not shown.
|
@ -179,3 +179,11 @@ src: url('../fonts/theboldfont.ttf') format('truetype');
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Futura-Condensed-Extra-Bold';
|
||||||
|
src: url('../fonts/Futura-Condensed-Extra-Bold.otf') format('opentype');
|
||||||
|
font-weight: normal;
|
||||||
|
font-style: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -122,6 +122,7 @@
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"doctrine/doctrine-fixtures-bundle": "^3.4",
|
"doctrine/doctrine-fixtures-bundle": "^3.4",
|
||||||
|
"lasserafn/php-initial-avatar-generator": "^4.2",
|
||||||
"phpunit/phpunit": "^9.5",
|
"phpunit/phpunit": "^9.5",
|
||||||
"symfony/browser-kit": "6.1.*",
|
"symfony/browser-kit": "6.1.*",
|
||||||
"symfony/css-selector": "6.1.*",
|
"symfony/css-selector": "6.1.*",
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "d3be737db4f7ce5089c83be63c8dbf09",
|
"content-hash": "479a2464d612243533a7aa3eae4281d9",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "aws/aws-crt-php",
|
"name": "aws/aws-crt-php",
|
||||||
|
@ -11096,6 +11096,253 @@
|
||||||
],
|
],
|
||||||
"time": "2022-04-28T17:58:29+00:00"
|
"time": "2022-04-28T17:58:29+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "intervention/image",
|
||||||
|
"version": "2.7.2",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/Intervention/image.git",
|
||||||
|
"reference": "04be355f8d6734c826045d02a1079ad658322dad"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/Intervention/image/zipball/04be355f8d6734c826045d02a1079ad658322dad",
|
||||||
|
"reference": "04be355f8d6734c826045d02a1079ad658322dad",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"ext-fileinfo": "*",
|
||||||
|
"guzzlehttp/psr7": "~1.1 || ^2.0",
|
||||||
|
"php": ">=5.4.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"mockery/mockery": "~0.9.2",
|
||||||
|
"phpunit/phpunit": "^4.8 || ^5.7 || ^7.5.15"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"ext-gd": "to use GD library based image processing.",
|
||||||
|
"ext-imagick": "to use Imagick based image processing.",
|
||||||
|
"intervention/imagecache": "Caching extension for the Intervention Image library"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "2.4-dev"
|
||||||
|
},
|
||||||
|
"laravel": {
|
||||||
|
"providers": [
|
||||||
|
"Intervention\\Image\\ImageServiceProvider"
|
||||||
|
],
|
||||||
|
"aliases": {
|
||||||
|
"Image": "Intervention\\Image\\Facades\\Image"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Intervention\\Image\\": "src/Intervention/Image"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Oliver Vogel",
|
||||||
|
"email": "oliver@intervention.io",
|
||||||
|
"homepage": "https://intervention.io/"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Image handling and manipulation library with support for Laravel integration",
|
||||||
|
"homepage": "http://image.intervention.io/",
|
||||||
|
"keywords": [
|
||||||
|
"gd",
|
||||||
|
"image",
|
||||||
|
"imagick",
|
||||||
|
"laravel",
|
||||||
|
"thumbnail",
|
||||||
|
"watermark"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/Intervention/image/issues",
|
||||||
|
"source": "https://github.com/Intervention/image/tree/2.7.2"
|
||||||
|
},
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://paypal.me/interventionio",
|
||||||
|
"type": "custom"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://github.com/Intervention",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"time": "2022-05-21T17:30:32+00:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "lasserafn/php-initial-avatar-generator",
|
||||||
|
"version": "4.2.1",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/LasseRafn/php-initial-avatar-generator.git",
|
||||||
|
"reference": "49d0b10cc8819af831e0f6fb1056a7d5ed9512d0"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/LasseRafn/php-initial-avatar-generator/zipball/49d0b10cc8819af831e0f6fb1056a7d5ed9512d0",
|
||||||
|
"reference": "49d0b10cc8819af831e0f6fb1056a7d5ed9512d0",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"ext-json": "*",
|
||||||
|
"intervention/image": "^2.3",
|
||||||
|
"lasserafn/php-initials": "^3.0",
|
||||||
|
"lasserafn/php-string-script-language": "^0.3.0",
|
||||||
|
"meyfa/php-svg": "^0.9.0",
|
||||||
|
"overtrue/pinyin": "^4.0",
|
||||||
|
"php": "^7.0|^7.1|^7.2|^7.3|^7.4|^8.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"doctrine/instantiator": "1.0.*",
|
||||||
|
"phpunit/phpunit": "^6.5",
|
||||||
|
"satooshi/php-coveralls": "^1.0"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"LasseRafn\\InitialAvatarGenerator\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Lasse Rafn",
|
||||||
|
"email": "lasserafn@gmail.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "A package to generate avatars with initials for PHP",
|
||||||
|
"keywords": [
|
||||||
|
"Initials",
|
||||||
|
"avatar",
|
||||||
|
"image",
|
||||||
|
"svg"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/LasseRafn/php-initial-avatar-generator/issues",
|
||||||
|
"source": "https://github.com/LasseRafn/php-initial-avatar-generator/tree/4.2.1"
|
||||||
|
},
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://opencollective.com/ui-avatars",
|
||||||
|
"type": "open_collective"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"time": "2020-12-24T13:12:12+00:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "lasserafn/php-initials",
|
||||||
|
"version": "3.1",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/LasseRafn/php-initials.git",
|
||||||
|
"reference": "d287e1542687390eb68de779949bc0adc49e2d52"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/LasseRafn/php-initials/zipball/d287e1542687390eb68de779949bc0adc49e2d52",
|
||||||
|
"reference": "d287e1542687390eb68de779949bc0adc49e2d52",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": "^5.6|^7.0|^7.1|^8.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"phpunit/phpunit": "^5.7",
|
||||||
|
"satooshi/php-coveralls": "^1.0"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"LasseRafn\\Initials\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Lasse Rafn",
|
||||||
|
"email": "lasserafn@gmail.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "A package to generate initials in PHP",
|
||||||
|
"keywords": [
|
||||||
|
"Initials",
|
||||||
|
"php"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/LasseRafn/php-initials/issues",
|
||||||
|
"source": "https://github.com/LasseRafn/php-initials/tree/3.1"
|
||||||
|
},
|
||||||
|
"time": "2020-12-24T12:25:51+00:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "lasserafn/php-string-script-language",
|
||||||
|
"version": "0.3",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/LasseRafn/php-string-script-language.git",
|
||||||
|
"reference": "49a09d4a5e38c1e59a2656ac05b601d615c7cddb"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/LasseRafn/php-string-script-language/zipball/49a09d4a5e38c1e59a2656ac05b601d615c7cddb",
|
||||||
|
"reference": "49a09d4a5e38c1e59a2656ac05b601d615c7cddb",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": "^5.6|^7.0|^7.1|^8.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"doctrine/instantiator": "1.0.5",
|
||||||
|
"phpunit/phpunit": "^5.6",
|
||||||
|
"phpunit/phpunit-mock-objects": "3.2.4",
|
||||||
|
"satooshi/php-coveralls": "^1.0",
|
||||||
|
"sebastian/exporter": "^1.2"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"LasseRafn\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Lasse Rafn",
|
||||||
|
"email": "lasserafn@gmail.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Detect language/encoding of a string in PHP",
|
||||||
|
"keywords": [
|
||||||
|
"language",
|
||||||
|
"php",
|
||||||
|
"string"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/LasseRafn/php-string-script-language/issues",
|
||||||
|
"source": "https://github.com/LasseRafn/php-string-script-language/tree/0.3"
|
||||||
|
},
|
||||||
|
"time": "2020-12-24T12:43:59+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "masterminds/html5",
|
"name": "masterminds/html5",
|
||||||
"version": "2.7.6",
|
"version": "2.7.6",
|
||||||
|
@ -11165,6 +11412,56 @@
|
||||||
},
|
},
|
||||||
"time": "2022-08-18T16:18:26+00:00"
|
"time": "2022-08-18T16:18:26+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "meyfa/php-svg",
|
||||||
|
"version": "v0.9.1",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/meyfa/php-svg.git",
|
||||||
|
"reference": "34401edef1f724898f468f71b85505fbcc8351bb"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/meyfa/php-svg/zipball/34401edef1f724898f468f71b85505fbcc8351bb",
|
||||||
|
"reference": "34401edef1f724898f468f71b85505fbcc8351bb",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"ext-gd": "*",
|
||||||
|
"ext-simplexml": "*",
|
||||||
|
"php": ">=5.3.3"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"meyfa/phpunit-assert-gd": "^1.1",
|
||||||
|
"phpunit/phpunit": "^4.8"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"SVG\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Fabian Meyer",
|
||||||
|
"homepage": "http://meyfa.net"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Read, edit, write, and render SVG files with PHP",
|
||||||
|
"homepage": "https://github.com/meyfa/php-svg",
|
||||||
|
"keywords": [
|
||||||
|
"svg"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/meyfa/php-svg/issues",
|
||||||
|
"source": "https://github.com/meyfa/php-svg/tree/v0.9.1"
|
||||||
|
},
|
||||||
|
"time": "2019-07-30T18:41:25+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "myclabs/deep-copy",
|
"name": "myclabs/deep-copy",
|
||||||
"version": "1.11.0",
|
"version": "1.11.0",
|
||||||
|
@ -11224,6 +11521,79 @@
|
||||||
],
|
],
|
||||||
"time": "2022-03-03T13:19:32+00:00"
|
"time": "2022-03-03T13:19:32+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "overtrue/pinyin",
|
||||||
|
"version": "4.0.8",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/overtrue/pinyin.git",
|
||||||
|
"reference": "04bdb4d33d50e8fb1aa5a824064c5151c4b15dc2"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/overtrue/pinyin/zipball/04bdb4d33d50e8fb1aa5a824064c5151c4b15dc2",
|
||||||
|
"reference": "04bdb4d33d50e8fb1aa5a824064c5151c4b15dc2",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=7.1"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"brainmaestro/composer-git-hooks": "^2.7",
|
||||||
|
"friendsofphp/php-cs-fixer": "^2.16",
|
||||||
|
"phpunit/phpunit": "~8.0"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"hooks": {
|
||||||
|
"pre-commit": [
|
||||||
|
"composer test",
|
||||||
|
"composer fix-style"
|
||||||
|
],
|
||||||
|
"pre-push": [
|
||||||
|
"composer test",
|
||||||
|
"composer check-style"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"files": [
|
||||||
|
"src/const.php"
|
||||||
|
],
|
||||||
|
"psr-4": {
|
||||||
|
"Overtrue\\Pinyin\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "overtrue",
|
||||||
|
"email": "anzhengchao@gmail.com",
|
||||||
|
"homepage": "http://github.com/overtrue"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Chinese to pinyin translator.",
|
||||||
|
"homepage": "https://github.com/overtrue/pinyin",
|
||||||
|
"keywords": [
|
||||||
|
"Chinese",
|
||||||
|
"Pinyin",
|
||||||
|
"cn2pinyin"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/overtrue/pinyin/issues",
|
||||||
|
"source": "https://github.com/overtrue/pinyin/tree/4.0.8"
|
||||||
|
},
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://www.patreon.com/overtrue",
|
||||||
|
"type": "patreon"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"time": "2021-07-19T03:43:32+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "phar-io/manifest",
|
"name": "phar-io/manifest",
|
||||||
"version": "2.0.3",
|
"version": "2.0.3",
|
||||||
|
|
|
@ -10,6 +10,7 @@ framework:
|
||||||
handler_id: Symfony\Component\HttpFoundation\Session\Storage\Handler\RedisSessionHandler
|
handler_id: Symfony\Component\HttpFoundation\Session\Storage\Handler\RedisSessionHandler
|
||||||
name: '%env(APP_ALIAS)%'
|
name: '%env(APP_ALIAS)%'
|
||||||
gc_probability: null
|
gc_probability: null
|
||||||
|
gc_maxlifetime: '%env(resolve:APP_SESSIONTIME)%'
|
||||||
cookie_secure: auto
|
cookie_secure: auto
|
||||||
cookie_samesite: lax
|
cookie_samesite: lax
|
||||||
storage_factory_id: session.storage.factory.native
|
storage_factory_id: session.storage.factory.native
|
||||||
|
|
|
@ -2,6 +2,7 @@ parameters:
|
||||||
|
|
||||||
appEnv: '%env(resolve:APP_ENV)%'
|
appEnv: '%env(resolve:APP_ENV)%'
|
||||||
appSecret: '%env(resolve:APP_SECRET)%'
|
appSecret: '%env(resolve:APP_SECRET)%'
|
||||||
|
appSessiontime: '%env(resolve:APP_SESSIONTIME)%'
|
||||||
|
|
||||||
appWeburl: '%env(resolve:APP_WEBURL)%'
|
appWeburl: '%env(resolve:APP_WEBURL)%'
|
||||||
appAuth: '%env(resolve:APP_AUTH)%'
|
appAuth: '%env(resolve:APP_AUTH)%'
|
||||||
|
|
|
@ -202,8 +202,6 @@ class CropController extends AbstractController
|
||||||
$imageType = image_type_to_mime_type($imageType);
|
$imageType = image_type_to_mime_type($imageType);
|
||||||
$newImageWidth = ceil($width * $scale);
|
$newImageWidth = ceil($width * $scale);
|
||||||
$newImageHeight = ceil($height * $scale);
|
$newImageHeight = ceil($height * $scale);
|
||||||
$newImageWidth = 900;
|
|
||||||
$newImageHeight = 900;
|
|
||||||
$newImage = imagecreatetruecolor($newImageWidth, $newImageHeight);
|
$newImage = imagecreatetruecolor($newImageWidth, $newImageHeight);
|
||||||
$source = null;
|
$source = null;
|
||||||
|
|
||||||
|
@ -214,7 +212,6 @@ class CropController extends AbstractController
|
||||||
case 'image/pjpeg':
|
case 'image/pjpeg':
|
||||||
case 'image/jpeg':
|
case 'image/jpeg':
|
||||||
case 'image/jpg':
|
case 'image/jpg':
|
||||||
dump('here');
|
|
||||||
$source = imagecreatefromjpeg($image);
|
$source = imagecreatefromjpeg($image);
|
||||||
break;
|
break;
|
||||||
case 'image/png':
|
case 'image/png':
|
||||||
|
@ -232,7 +229,6 @@ class CropController extends AbstractController
|
||||||
case 'image/pjpeg':
|
case 'image/pjpeg':
|
||||||
case 'image/jpeg':
|
case 'image/jpeg':
|
||||||
case 'image/jpg':
|
case 'image/jpg':
|
||||||
dump($thumb_image_name);
|
|
||||||
imagejpeg($newImage, $thumb_image_name, 100);
|
imagejpeg($newImage, $thumb_image_name, 100);
|
||||||
break;
|
break;
|
||||||
case 'image/png':
|
case 'image/png':
|
||||||
|
|
|
@ -722,9 +722,9 @@ class UserController extends AbstractController
|
||||||
case 'manager':
|
case 'manager':
|
||||||
if ($this->getUser()->getNiveau03() && $this->getUser()->getNiveau03() == $entity->getNiveau03()) {
|
if ($this->getUser()->getNiveau03() && $this->getUser()->getNiveau03() == $entity->getNiveau03()) {
|
||||||
return true;
|
return true;
|
||||||
} elseif ($this->getUser()->getNiveau02() && $this->getUser()->getNiveau02() == $entity->getNiveau02()) {
|
} elseif (!$this->getUser()->getNiveau03() && $this->getUser()->getNiveau02() && $this->getUser()->getNiveau02() == $entity->getNiveau02()) {
|
||||||
return true;
|
return true;
|
||||||
} elseif ($this->getUser()->getNiveau01() && $this->getUser()->getNiveau01() == $entity->getNiveau01()) {
|
} elseif (!$this->getUser()->getNiveau02() && $this->getUser()->getNiveau01() && $this->getUser()->getNiveau01() == $entity->getNiveau01()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -759,6 +759,19 @@ class UserController extends AbstractController
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'manager':
|
||||||
|
if ($this->getUser()->getNiveau03() && $this->getUser()->getNiveau03() == $entity->getNiveau03()) {
|
||||||
|
return true;
|
||||||
|
} elseif (!$this->getUser()->getNiveau03() && $this->getUser()->getNiveau02() && $this->getUser()->getNiveau02() == $entity->getNiveau02()) {
|
||||||
|
return true;
|
||||||
|
} elseif (!$this->getUser()->getNiveau02() && $this->getUser()->getNiveau01() && $this->getUser()->getNiveau01() == $entity->getNiveau01()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw $this->createAccessDeniedException('Permission denied');
|
||||||
|
break;
|
||||||
|
|
||||||
case 'all':
|
case 'all':
|
||||||
if ($this->getUser()->getId() != $entity->getId()) {
|
if ($this->getUser()->getId() != $entity->getId()) {
|
||||||
throw $this->createAccessDeniedException('Permission denied');
|
throw $this->createAccessDeniedException('Permission denied');
|
||||||
|
|
|
@ -8,29 +8,41 @@ use App\Entity\Niveau03;
|
||||||
use App\Entity\Niveau04;
|
use App\Entity\Niveau04;
|
||||||
use App\Entity\User;
|
use App\Entity\User;
|
||||||
use App\Entity\UserModo;
|
use App\Entity\UserModo;
|
||||||
|
use App\Service\MinioService;
|
||||||
use Doctrine\Bundle\FixturesBundle\Fixture;
|
use Doctrine\Bundle\FixturesBundle\Fixture;
|
||||||
use Doctrine\ORM\Id\AssignedGenerator;
|
use Doctrine\ORM\Id\AssignedGenerator;
|
||||||
use Doctrine\ORM\Mapping\ClassMetadata;
|
use Doctrine\ORM\Mapping\ClassMetadata;
|
||||||
use Doctrine\Persistence\ObjectManager;
|
use Doctrine\Persistence\ObjectManager;
|
||||||
|
use LasseRafn\InitialAvatarGenerator\InitialAvatar;
|
||||||
use Symfony\Bundle\FrameworkBundle\Console\Application;
|
use Symfony\Bundle\FrameworkBundle\Console\Application;
|
||||||
use Symfony\Component\Console\Input\ArrayInput;
|
use Symfony\Component\Console\Input\ArrayInput;
|
||||||
use Symfony\Component\Console\Output\BufferedOutput;
|
use Symfony\Component\Console\Output\BufferedOutput;
|
||||||
use Symfony\Component\Console\Output\ConsoleOutput;
|
use Symfony\Component\Console\Output\ConsoleOutput;
|
||||||
|
use Symfony\Component\Filesystem\Filesystem;
|
||||||
use Symfony\Component\HttpKernel\KernelInterface;
|
use Symfony\Component\HttpKernel\KernelInterface;
|
||||||
|
|
||||||
class AppFixtures extends Fixture
|
class AppFixtures extends Fixture
|
||||||
{
|
{
|
||||||
private $kernel;
|
private $kernel;
|
||||||
private $output;
|
private $output;
|
||||||
|
private $minio;
|
||||||
|
private $colorbg;
|
||||||
|
private $colorft;
|
||||||
|
|
||||||
public function __construct(KernelInterface $kernel)
|
public function __construct(KernelInterface $kernel, MinioService $minio)
|
||||||
{
|
{
|
||||||
$this->kernel = $kernel;
|
$this->kernel = $kernel;
|
||||||
|
$this->minio = $minio;
|
||||||
$this->output = new ConsoleOutput();
|
$this->output = new ConsoleOutput();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function load(ObjectManager $manager): void
|
public function load(ObjectManager $manager): void
|
||||||
{
|
{
|
||||||
|
// Création Répertoire Avatar
|
||||||
|
$fs = new Filesystem();
|
||||||
|
$roottmp = $this->kernel->getProjectDir().'/var/tmp';
|
||||||
|
$fs->mkdir($roottmp.'/avatar');
|
||||||
|
|
||||||
// app:Init
|
// app:Init
|
||||||
$this->writeln('app:Init');
|
$this->writeln('app:Init');
|
||||||
$application = new Application($this->kernel);
|
$application = new Application($this->kernel);
|
||||||
|
@ -40,6 +52,10 @@ class AppFixtures extends Fixture
|
||||||
$application->run($input, $boutput);
|
$application->run($input, $boutput);
|
||||||
$manager->flush();
|
$manager->flush();
|
||||||
|
|
||||||
|
// Color
|
||||||
|
$this->colorbg = $manager->getRepository("App\Entity\Config")->find('colorbgbodydark')->getValue();
|
||||||
|
$this->colorft = $manager->getRepository("App\Entity\Config")->find('colorfttitledark')->getValue();
|
||||||
|
|
||||||
// app:Synchro
|
// app:Synchro
|
||||||
$manager->clear();
|
$manager->clear();
|
||||||
$this->writeln('app:Synchro');
|
$this->writeln('app:Synchro');
|
||||||
|
@ -196,10 +212,12 @@ class AppFixtures extends Fixture
|
||||||
$user->setEmail($username.'@noreply.fr');
|
$user->setEmail($username.'@noreply.fr');
|
||||||
$user->setIsvisible(true);
|
$user->setIsvisible(true);
|
||||||
$user->setIsactive(true);
|
$user->setIsactive(true);
|
||||||
$user->setAvatar('noavatar.png');
|
|
||||||
$user->setApikey($username);
|
$user->setApikey($username);
|
||||||
$user->setNiveau01($niveau01);
|
$user->setNiveau01($niveau01);
|
||||||
|
|
||||||
|
$this->generateavatar($username);
|
||||||
|
$user->setAvatar($username.'.png');
|
||||||
|
|
||||||
$manager->flush();
|
$manager->flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,11 +246,13 @@ class AppFixtures extends Fixture
|
||||||
$user->setEmail($username.'@noreply.fr');
|
$user->setEmail($username.'@noreply.fr');
|
||||||
$user->setIsvisible(true);
|
$user->setIsvisible(true);
|
||||||
$user->setIsactive(true);
|
$user->setIsactive(true);
|
||||||
$user->setAvatar('noavatar.png');
|
|
||||||
$user->setApikey($username);
|
$user->setApikey($username);
|
||||||
$user->setNiveau01($niveau02->getNiveau01());
|
$user->setNiveau01($niveau02->getNiveau01());
|
||||||
$user->setNiveau02($niveau02);
|
$user->setNiveau02($niveau02);
|
||||||
|
|
||||||
|
$this->generateavatar($username);
|
||||||
|
$user->setAvatar($username.'.png');
|
||||||
|
|
||||||
$manager->flush();
|
$manager->flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -261,12 +281,14 @@ class AppFixtures extends Fixture
|
||||||
$user->setEmail($username.'@noreply.fr');
|
$user->setEmail($username.'@noreply.fr');
|
||||||
$user->setIsvisible(true);
|
$user->setIsvisible(true);
|
||||||
$user->setIsactive(true);
|
$user->setIsactive(true);
|
||||||
$user->setAvatar('noavatar.png');
|
|
||||||
$user->setApikey($username);
|
$user->setApikey($username);
|
||||||
$user->setNiveau01($niveau03->getNiveau02()->getNiveau01());
|
$user->setNiveau01($niveau03->getNiveau02()->getNiveau01());
|
||||||
$user->setNiveau02($niveau03->getNiveau02());
|
$user->setNiveau02($niveau03->getNiveau02());
|
||||||
$user->setNiveau03($niveau03);
|
$user->setNiveau03($niveau03);
|
||||||
|
|
||||||
|
$this->generateavatar($username);
|
||||||
|
$user->setAvatar($username.'.png');
|
||||||
|
|
||||||
$manager->flush();
|
$manager->flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -295,12 +317,14 @@ class AppFixtures extends Fixture
|
||||||
$user->setEmail($username.'@noreply.fr');
|
$user->setEmail($username.'@noreply.fr');
|
||||||
$user->setIsvisible(true);
|
$user->setIsvisible(true);
|
||||||
$user->setIsactive(true);
|
$user->setIsactive(true);
|
||||||
$user->setAvatar('noavatar.png');
|
|
||||||
$user->setApikey($username);
|
$user->setApikey($username);
|
||||||
$user->setNiveau01($niveau03->getNiveau02()->getNiveau01());
|
$user->setNiveau01($niveau03->getNiveau02()->getNiveau01());
|
||||||
$user->setNiveau02($niveau03->getNiveau02());
|
$user->setNiveau02($niveau03->getNiveau02());
|
||||||
$user->setNiveau03($niveau03);
|
$user->setNiveau03($niveau03);
|
||||||
|
|
||||||
|
$this->generateavatar($username);
|
||||||
|
$user->setAvatar($username.'.png');
|
||||||
|
|
||||||
$manager->flush();
|
$manager->flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -337,4 +361,12 @@ class AppFixtures extends Fixture
|
||||||
|
|
||||||
return $r;
|
return $r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function generateavatar($username)
|
||||||
|
{
|
||||||
|
$avatar = new InitialAvatar();
|
||||||
|
$image = $avatar->name($username)->height(100)->width(100)->background($this->colorbg)->color($this->colorft)->generate();
|
||||||
|
file_put_contents($this->kernel->getProjectDir().'/var/tmp/avatar/'.$username.'.png', $image->stream('png', 90));
|
||||||
|
$this->minio->upload($this->kernel->getProjectDir().'/var/tmp/avatar/'.$username.'.png', 'avatar/'.$username.'.png', true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\EventListener;
|
||||||
|
|
||||||
|
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||||
|
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
use Symfony\Component\HttpKernel\Event\ExceptionEvent;
|
||||||
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||||
|
use Symfony\Component\HttpKernel\KernelEvents;
|
||||||
|
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||||
|
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
|
||||||
|
|
||||||
|
class ExceptionListener implements EventSubscriberInterface
|
||||||
|
{
|
||||||
|
private $router;
|
||||||
|
|
||||||
|
public function __construct(UrlGeneratorInterface $router)
|
||||||
|
{
|
||||||
|
$this->router = $router;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getSubscribedEvents(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
// the priority must be greater than the Security HTTP
|
||||||
|
// ExceptionListener, to make sure it's called before
|
||||||
|
// the default exception listener
|
||||||
|
KernelEvents::EXCEPTION => ['onKernelException', 2],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function onKernelException(ExceptionEvent $event): void
|
||||||
|
{
|
||||||
|
$exception = $event->getThrowable();
|
||||||
|
if (!$exception instanceof AccessDeniedException && !$exception instanceof NotFoundHttpException) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$response = new RedirectResponse($this->router->generate('app_home'));
|
||||||
|
|
||||||
|
// optionally set the custom response
|
||||||
|
$event->setResponse($response);
|
||||||
|
}
|
||||||
|
}
|
|
@ -76,6 +76,7 @@ class ConfigType extends AbstractType
|
||||||
'Chewy-Regular' => 'Chewy-Regular',
|
'Chewy-Regular' => 'Chewy-Regular',
|
||||||
'Courgette-Regular' => 'Courgette-Regular',
|
'Courgette-Regular' => 'Courgette-Regular',
|
||||||
'FredokaOne-Regular' => 'FredokaOne-Regular',
|
'FredokaOne-Regular' => 'FredokaOne-Regular',
|
||||||
|
'Futura-Condensed-Extra-Bold' => 'Futura-Condensed-Extra-Bold',
|
||||||
'Grandstander' => 'Grandstander',
|
'Grandstander' => 'Grandstander',
|
||||||
'Helvetica' => 'Helvetica',
|
'Helvetica' => 'Helvetica',
|
||||||
'Justanotherhand-Regular' => 'Justanotherhand-Regular',
|
'Justanotherhand-Regular' => 'Justanotherhand-Regular',
|
||||||
|
|
|
@ -157,6 +157,8 @@ class LdapService
|
||||||
break;
|
break;
|
||||||
case 'basedn': return $this->basedn;
|
case 'basedn': return $this->basedn;
|
||||||
break;
|
break;
|
||||||
|
case 'baseorganisation': return $this->baseorganisation;
|
||||||
|
break;
|
||||||
case 'filteruser': return $this->filteruser;
|
case 'filteruser': return $this->filteruser;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -187,12 +189,26 @@ class LdapService
|
||||||
return $this->resultToArray($result);
|
return $this->resultToArray($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function deleteByDN($dn)
|
public function deleteByDN($dn, $recursive = false)
|
||||||
{
|
{
|
||||||
$connection = $this->connect();
|
$connection = $this->connect();
|
||||||
$removed = ldap_delete($connection, $dn);
|
if (false == $recursive) {
|
||||||
if (!$removed) {
|
$removed = ldap_delete($connection, $dn);
|
||||||
$this->ldapError();
|
if (!$removed) {
|
||||||
|
$this->ldapError();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// searching for sub entries
|
||||||
|
$sr = ldap_list($connection, $dn, 'ObjectClass=*', ['']);
|
||||||
|
$info = ldap_get_entries($connection, $sr);
|
||||||
|
for ($i = 0; $i < $info['count']; ++$i) {
|
||||||
|
$result = $this->deleteByDN($info[$i]['dn'], $recursive);
|
||||||
|
if (!$result) {
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ldap_delete($connection, $dn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -87,7 +87,13 @@
|
||||||
<img src="{{ path('app_minio_image',{file:"logo/"~app.session.get("logodark")}) }}">
|
<img src="{{ path('app_minio_image',{file:"logo/"~app.session.get("logodark")}) }}">
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<a class="nav-link " href="{{ path('app_home')}}">Accueil</a>
|
<a class="nav-link ps-0" href="{{ path('app_home')}}">
|
||||||
|
{% if not app.session.get("fgheader") %}
|
||||||
|
{{app.session.get("appname")}}
|
||||||
|
{% else %}
|
||||||
|
Accueil
|
||||||
|
{% endif %}
|
||||||
|
</a>
|
||||||
|
|
||||||
<div class="collapse navbar-collapse" id="navbarNav">
|
<div class="collapse navbar-collapse" id="navbarNav">
|
||||||
<ul class="navbar-nav">
|
<ul class="navbar-nav">
|
||||||
|
|
Loading…
Reference in New Issue