Minor - Update symfony packages, update code to avoid php errors

pull/2528/head
jmontoyaa 7 years ago
parent 4f242daec0
commit 2467e561ee
  1. 54
      composer.json
  2. 8
      config/bundles.php
  3. 1
      config/packages/chamilo.yaml
  4. 2
      config/packages/doctrine.yaml
  5. 2
      config/packages/framework.yaml
  6. 41
      config/packages/security.yaml
  7. 1
      config/packages/sonata_formatter.yaml
  8. 6
      config/packages/sonata_page.yaml
  9. 2
      config/routes.yaml
  10. 40
      config/routes/hwi_oauth.yaml
  11. 23
      config/services.yaml
  12. 1
      main/inc/global.inc.php
  13. 1
      main/inc/local.inc.php
  14. 6
      src/CoreBundle/Controller/FrontController.php
  15. 33
      src/CoreBundle/Controller/IndexController.php
  16. 18
      src/CoreBundle/EventListener/LegacyListener.php
  17. 2
      src/CoreBundle/EventListener/LegacyLoginListener.php
  18. 23
      src/CoreBundle/EventListener/LoginSuccessHandler.php
  19. 3
      src/CoreBundle/EventListener/LogoutSuccessHandler.php
  20. 6
      src/CoreBundle/Framework/Container.php
  21. 4
      src/CoreBundle/Menu/LeftMenuBuilder.php
  22. 4
      src/CoreBundle/Menu/NavBuilder.php
  23. 2
      src/CoreBundle/Resources/config/services.yml
  24. 4
      src/CourseBundle/EventListener/CourseListener.php
  25. 16
      src/ThemeBundle/Resources/views/Sidebar/left_menu.html.twig
  26. 764
      src/UserBundle/Entity/User.php
  27. 18
      yarn.lock

@ -50,10 +50,10 @@
"ext-mbstring": "*",
"ext-bcmath": "*",
"twig/twig": "2.*",
"doctrine/orm": "^2.5.11",
"doctrine/dbal": "~2.5",
"doctrine/orm": "^2.6",
"doctrine/dbal": "~2.7",
"doctrine/data-fixtures": "~1.0@dev",
"doctrine/doctrine-bundle": "^1.6.10",
"doctrine/doctrine-bundle": "^1.9",
"doctrine/doctrine-fixtures-bundle": "^3.0",
"doctrine/doctrine-migrations-bundle": "^1.3",
@ -63,7 +63,7 @@
"sensiolabs/security-checker": "^4.1",
"symfony/asset": "^4.0",
"symfony/expression-language": "^3.0|^4.0",
"symfony/expression-language": "^4.0",
"symfony/flex": "^1.0",
"symfony/form": "^3.0|^4.0",
"symfony/framework-bundle": "^3.0|^4.0",
@ -72,9 +72,9 @@
"symfony/security-bundle": "^4.0",
"symfony/swiftmailer-bundle": "^3.2",
"symfony/translation": "^4.0",
"symfony/twig-bundle": "^3.0|^4.0",
"symfony/validator": "^3.0|^4.0",
"symfony/yaml": "^3.0|^4.0",
"symfony/twig-bundle": "^4.0",
"symfony/validator": "^4.0",
"symfony/yaml": "^4.0",
"symfony/annotations-pack": "^1.0",
"symfony/webpack-encore-pack": "^1.0",
"symfony/apache-pack": "^1.0",
@ -82,40 +82,42 @@
"twig/extensions": "^1.5",
"white-october/pagerfanta-bundle": "^1.1",
"chamilo/settings-bundle": "dev-master",
"sonata-project/admin-bundle": "3.x-dev",
"sonata-project/admin-bundle": "~3.0",
"sonata-project/block-bundle": "~3.0",
"sonata-project/cache": "1.x-dev",
"sonata-project/cache-bundle": "~2.1@dev",
"sonata-project/cache": "~1.0",
"sonata-project/cache-bundle": "~2.0",
"sonata-project/classification-bundle": "~3.0",
"sonata-project/timeline-bundle" : "~3.0",
"sonata-project/core-bundle": "~3.0",
"sonata-project/datagrid-bundle": "^2.2",
"sonata-project/datagrid-bundle": "^2.3",
"sonata-project/doctrine-extensions": "~1@dev",
"sonata-project/doctrine-orm-admin-bundle": "~3.0",
"sonata-project/easy-extends-bundle": "~2.1@dev",
"sonata-project/easy-extends-bundle": "~2.5",
"sonata-project/exporter": "~1",
"sonata-project/formatter-bundle": "~3.0",
"sonata-project/intl-bundle": "~2.4.0",
"sonata-project/media-bundle": "~3.0",
"sonata-project/notification-bundle": "~3.0",
"sonata-project/page-bundle": "~3.0",
"sonata-project/seo-bundle": "~2.0",
"sonata-project/sonata-composer": "dev-master",
"sonata-project/user-bundle": "~4.0",
"sonata-project/formatter-bundle": "~3.0",
"egeloen/ckeditor-bundle": "~5.0|~6.0",
"stephpy/timeline-bundle": "~2.5",
"stephpy/timeline-bundle": "~3.0",
"stof/doctrine-extensions-bundle": "~1.0",
"sunra/php-simple-html-dom-parser": "~1.5.0",
"sylius/resource-bundle": "1.0.4",
"sylius/resource": "~1.0",
"sylius/resource-bundle": "dev-master",
"sylius/resource": "dev-master",
"sylius/registry": "dev-master",
"friendsofsymfony/jsrouting-bundle": "~2.0",
"gedmo/doctrine-extensions": "~2.4",
"gregwar/captcha-bundle": "^2.0",
"helios-ag/fm-elfinder-bundle": "~6.0",
"helios-ag/fm-elfinder-bundle": "~8.0",
"knplabs/gaufrette": "~0.3",
"knplabs/gaufrette": "~0.5",
"knplabs/doctrine-behaviors": "~1.5",
"knplabs/knp-components": "^1.3",
@ -147,22 +149,23 @@
"graphp/graphviz": "~0.2.0",
"graphp/algorithms": "~0.8.0",
"php-ffmpeg/php-ffmpeg": "0.5.1",
"imagine/imagine": "~0.6",
"imagine/imagine": "~0.7",
"jeroendesloovere/vcard": "~1.5",
"jimmiw/php-time-ago": "2.0.*",
"phpoffice/phpword": "^0.14.0",
"kigkonsult/icalcreator": "2.24",
"essence/essence": "~3.0",
"paragonie/random-lib": "2.0.0",
"lunetics/locale-bundle": "2.5.*",
"hwi/oauth-bundle": "^0.6.0",
"lunetics/locale-bundle": "^2.6",
"hwi/oauth-bundle": "~0.6",
"php-http/guzzle6-adapter": "^1.1",
"php-http/httplug-bundle": "^1.8",
"knplabs/knp-menu-bundle": "^2.0"
"knplabs/knp-menu-bundle": "^2.0",
"symfony/requirements-checker": "^1.1"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.7",
"symfony/browser-kit": "^3.0|^4.0",
"symfony/browser-kit": "^4.0",
"symfony/css-selector": "^4.0",
"symfony/debug-bundle": "^4.0",
"symfony/dotenv": "^4.0",
@ -192,7 +195,8 @@
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install --symlink --relative %PUBLIC_DIR%": "symfony-cmd",
"security-checker security:check": "script"
"security-checker security:check": "script",
"requirements-checker": "script"
}
}
}

@ -32,9 +32,6 @@ return [
Spy\TimelineBundle\SpyTimelineBundle::class => ['all' => true],
Sonata\IntlBundle\SonataIntlBundle::class => ['all' => true],
Sonata\TimelineBundle\SonataTimelineBundle::class => ['all' => true],
Knp\Bundle\MarkdownBundle\KnpMarkdownBundle::class => ['all' => true],
Ivory\CKEditorBundle\IvoryCKEditorBundle::class => ['all' => true],
Sonata\FormatterBundle\SonataFormatterBundle::class => ['all' => true],
JMS\SerializerBundle\JMSSerializerBundle::class => ['all' => true],
Sonata\MediaBundle\SonataMediaBundle::class => ['all' => true],
FOS\JsRoutingBundle\FOSJsRoutingBundle::class => ['all' => true],
@ -56,7 +53,6 @@ return [
Chamilo\MediaBundle\ChamiloMediaBundle::class => ['all' => true],
Chamilo\NotificationBundle\ChamiloNotificationBundle::class => ['all' => true],
Chamilo\SettingsBundle\ChamiloSettingsBundle::class => ['all' => true],
HWI\Bundle\OAuthBundle\HWIOAuthBundle::class => ['all' => true],
winzou\Bundle\StateMachineBundle\winzouStateMachineBundle::class => ['all' => true],
Bazinga\Bundle\HateoasBundle\BazingaHateoasBundle::class => ['all' => true],
Sylius\Bundle\ResourceBundle\SyliusResourceBundle::class => ['all' => true],
@ -65,4 +61,8 @@ return [
Http\HttplugBundle\HttplugBundle::class => ['all' => true],
Oneup\FlysystemBundle\OneupFlysystemBundle::class => ['all' => true],
Sonata\CacheBundle\SonataCacheBundle::class => ['all' => true],
Ivory\CKEditorBundle\IvoryCKEditorBundle::class => ['all' => true],
Knp\Bundle\MarkdownBundle\KnpMarkdownBundle::class => ['all' => true],
Sonata\FormatterBundle\SonataFormatterBundle::class => ['all' => true],
HWI\Bundle\OAuthBundle\HWIOAuthBundle::class => ['all' => true],
];

@ -68,7 +68,6 @@ sonata_doctrine_orm_admin:
sylius_settings:
driver: doctrine/orm
# Course settings
chamilo_course:
driver: doctrine/orm

@ -14,6 +14,8 @@ doctrine:
naming_strategy: doctrine.orm.naming_strategy.underscore
auto_mapping: true
mappings:
SonataUserBundle: ~
FOSUserBundle: ~
# App:
# is_bundle: false
# type: annotation

@ -13,7 +13,7 @@ framework:
session:
# handler_id set to null will use default session handler from php.ini
handler_id: ~
name: ch_sid
name: chamilo2
fragments: ~
http_method_override: true
assets:

@ -1,16 +1,21 @@
# To get started with security, check out the documentation:
# http://symfony.com/doc/current/book/security.html
security:
encoders:
FOS\UserBundle\Model\UserInterface:
id: chamilo_user.security.encoder
# http://symfony.com/doc/current/book/security.html#where-do-users-come-from-user-providers
providers:
fos_userbundle:
id: fos_user.user_provider.username
access_control:
- {path: ^/administrator, role: ROLE_ADMIN}
- {path: ^/efconnect, role: ROLE_USER}
- {path: ^/elfinder, role: ROLE_USER}
- {path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY}
encoders:
FOS\UserBundle\Model\UserInterface:
id: chamilo_user.security.encoder
role_hierarchy:
ROLE_SONATA_ADMIN: ROLE_USER
ROLE_ADMIN:
@ -37,14 +42,10 @@ security:
- ROLE_SONATA_PAGE_ADMIN_BLOCK_EDIT
ROLE_ANONYMOUS: [ROLE_ANONYMOUS]
access_decision_manager:
#access_decision_manager:
# strategy can be: affirmative, unanimous or consensus
strategy: unanimous
# http://symfony.com/doc/current/book/security.html#where-do-users-come-from-user-providers
providers:
fos_userbundle:
id: fos_user.user_provider.username
# only grant access if none of the voters has denied access
#strategy: unanimous
firewalls:
# disables authentication for assets and the profiler, adapt it according to your needs
@ -52,24 +53,24 @@ security:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
admin:
pattern: .*
context: user
pattern: ^/
context: admin
anonymous: true
form_login:
provider: fos_userbundle
csrf_token_generator: security.csrf.token_manager
login_path: /login
use_forward: false
check_path: /login_check
success_handler: chamilo_core.listener.login_success_handler
failure_path: null
remember_me:
secret: '%secret%'
lifetime: 604800 # 1 week in seconds
path: /
# success_handler: chamilo_core.listener.login_success_handler
failure_path: null
# remember_me:
# secret: '%secret%'
# lifetime: 604800 # 1 week in seconds
# path: /
logout:
path: /logout
target: /
anonymous: ~
switch_user: false
oauth:
resource_owners:

@ -1,4 +1,5 @@
sonata_formatter:
default_formatter: text
formatters:
markdown:
service: sonata.formatter.text.markdown

@ -1,13 +1,15 @@
# more information can be found here http://sonata-project.org/bundles/page
sonata_page:
slugify_service: sonata.core.slugify.cocur
multisite: host_with_path_by_locale # host
use_streamed_response: false # set the value to false in debug mode or if the reverse proxy does not handle streamed response
class:
page: Chamilo\PageBundle\Entity\Page
site: Chamilo\PageBundle\Entity\Site
block: Chamilo\PageBundle\Entity\Block
snapshot: Chamilo\PageBundle\Entity\Snapshot
multisite: host_with_path_by_locale # host
use_streamed_response: false # set the value to false in debug mode or if the reverse proxy does not handle streamed response
ignore_uri_patterns:
- ^/administration(.*) # sonata admin
- ^/admin(.*) # chamilo admin

@ -10,7 +10,7 @@
logout:
path: /logout
sonata_user_admin_security_logout:
path: /logout
path: /administration/logout
_admin:
resource: routes/sonata_admin.yaml
prefix: /administration

@ -1,21 +1,21 @@
# HWIOAuthBundle routes
hwi_oauth_redirect:
resource: "@HWIOAuthBundle/Resources/config/routing/redirect.xml"
prefix: /connect
hwi_oauth_connect:
resource: "@HWIOAuthBundle/Resources/config/routing/connect.xml"
prefix: /connect
hwi_oauth_login:
resource: "@HWIOAuthBundle/Resources/config/routing/login.xml"
prefix: /connect
facebook_login:
path: /connect/facebook
google_login:
path: /connect/google
github_login:
path: /connect/github
#hwi_oauth_redirect:
# resource: "@HWIOAuthBundle/Resources/config/routing/redirect.xml"
# prefix: /connect
#
#hwi_oauth_connect:
# resource: "@HWIOAuthBundle/Resources/config/routing/connect.xml"
# prefix: /connect
#
#hwi_oauth_login:
# resource: "@HWIOAuthBundle/Resources/config/routing/login.xml"
# prefix: /connect
#
#facebook_login:
# path: /connect/facebook
#
#google_login:
# path: /connect/google
#
#github_login:
# path: /connect/github

@ -20,26 +20,3 @@ parameters:
sonata_media.cdn.host: /uploads/media
sonata_page.varnish.command: 'if [ ! -r "/etc/varnish/secret" ]; then echo "VALID ERROR :/"; else varnishadm -S /etc/varnish/secret -T 127.0.0.1:6082 {{ COMMAND }} "{{ EXPRESSION }}"; fi;'
router.request_context.base_url: '%url_append%'
services:
# default configuration for services in *this* file
_defaults:
autowire: true # Automatically injects dependencies in your services.
autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.
public: false # Allows optimizing the container by removing unused services; this also means
# fetching services directly from the container via $container->get() won't work.
# The best practice is to be explicit about your dependencies anyway.
# makes classes in src/ available to be used as services
# this creates a service per class whose id is the fully-qualified class name
# Chamilo\:
# resource: '../src/*'
# exclude: '../src/{Entity,Migrations,Tests}'
# controllers are imported separately to make sure services can be injected
# as action arguments even if you don't extend any base controller class
# App\Controller\:
# resource: '../src/Controller'
# tags: ['controller.service_arguments']
# add more service definitions when explicit configuration is needed
# please note that last definitions always *replace* previous ones

@ -595,4 +595,5 @@ try {
var_dump($e->getCode());
var_dump($e->getLine());
var_dump($e->getTraceAsString());
exit;
}

@ -354,7 +354,6 @@ if (!empty($_SESSION['_user']['user_id']) && !($login || $logout)) {
$password,
$uData['salt']
);
// Check the user's password
if (($validPassword || $cas_login) &&
(trim($login) == $uData['username'])

@ -28,8 +28,8 @@ class FrontController extends Controller
public function editorTemplates()
{
$editor = new CkEditor(
$this->container->get('translator.default'),
$this->container->get('router')
$this->get('translator.default'),
$this->get('router')
);
$templates = $editor->simpleFormatTemplates();
@ -78,7 +78,7 @@ class FrontController extends Controller
$connector = new Connector(
$this->container->get('doctrine')->getManager(),
[],
$this->container->get('router'),
$this->get('router'),
$this->container->get('translator.default'),
$this->container->get('security.authorization_checker'),
$this->getUser(),

@ -41,34 +41,9 @@ class IndexController extends BaseController
/** @var \PageController $pageController */
//$pageController = $this->get('page_controller');
$pageController = new PageController();
/*
if (api_get_setting('display_categories_on_homepage') == 'true') {
//$template->assign('course_category_block', $pageController->return_courses_in_categories());
}
if (!api_is_anonymous()) {
if (api_is_platform_admin()) {
$pageController->setCourseBlock();
} else {
$pageController->return_teacher_link();
}
}
// Hot courses & announcements
$hotCourses = null;
$announcementsBlock = null;
// Navigation links
//$pageController->returnNavigationLinks($template->getNavigationLinks());
$pageController->returnNotice();
$pageController->returnHelp();
if (api_is_platform_admin() || api_is_drh()) {
$pageController->returnSkillsLinks();
}*/
$sessionHandler = $request->getSession();
$sessionHandler->remove('coursesAlreadyVisited');
//$sessionHandler = $request->getSession();
//$sessionHandler->remove('coursesAlreadyVisited');
$user = $this->getUser();
$userId = 0;
@ -114,7 +89,7 @@ class IndexController extends BaseController
$user->addAttribute($smallSize);
$userManager->updateUser($user);
*/
$this->get('session')->remove('id_session');
//$this->get('session')->remove('id_session');
return $this->render(
'@ChamiloCore/Index/index.html.twig',

@ -31,22 +31,6 @@ class LegacyListener
}
$request = $event->getRequest();
$controller = $request->get('_controller');
// Only process legacy listener when loading legacy controller
/*if ($controller != 'Chamilo\CoreBundle\Controller\LegacyController::classicAction') {
return;
}*/
/*$skipControllers = [
'web_profiler.controller.profiler:toolbarAction', //
'fos_js_routing.controller:indexAction'//
];
// Skip legacy listener
if (in_array($controller, $skipControllers)) {
return;
}*/
$session = $request->getSession();
/** @var ContainerInterface $container */
@ -58,7 +42,7 @@ class LegacyListener
Container::setRequest($request);
// Legacy way of detect current access_url
$installed = $this->container->getParameter('installed');
$installed = $container->getParameter('installed');
$urlId = 1;
if (!empty($installed)) {

@ -62,7 +62,7 @@ class LegacyLoginListener implements EventSubscriberInterface
$username = $_SESSION['_user']['username'];
$criteria = ['username' => $username];
/** @var User $user */
$user = $container->get('sonata.user.user_manager')->findOneBy($criteria);
$user = $container->get('fos_user.user_manager')->findOneBy($criteria);
if ($user) {
$em = $container->get('doctrine');
/** @var User $completeUser */

@ -42,6 +42,25 @@ class LoginSuccessHandler implements AuthenticationSuccessHandlerInterface
Request $request,
TokenInterface $token
) {
$url = $this->router->generate('home');
if (!empty($url)) {
$response = new RedirectResponse($url);
}
// Redirect the user to where they were before the login process begun.
if (empty($response)) {
$url = $request->headers->get('referer');
/*// if the referer is the login use the home.
if (strpos($url, 'login') !== false) {
$url = $this->router->generate('home');
}*/
$response = new RedirectResponse($url);
}
return $response;
/** @var User $user */
$user = $token->getUser();
$userId = $user->getId();
@ -65,6 +84,8 @@ class LoginSuccessHandler implements AuthenticationSuccessHandlerInterface
$session->set('is_allowedCreateCourse', true);
}
error_log('siccesss');
// Setting last login datetime
$session->set('user_last_login_datetime', api_get_utc_datetime());
@ -129,6 +150,8 @@ class LoginSuccessHandler implements AuthenticationSuccessHandlerInterface
}
}
$url = $this->router->generate('home');
if (!empty($url)) {
$response = new RedirectResponse($url);
}

@ -23,7 +23,7 @@ class LogoutSuccessHandler implements LogoutSuccessHandlerInterface
/**
* @param UrlGeneratorInterface $urlGenerator
* @param AuthorizationChecker $checker
* @param Storage $storage
* @param TokenStorage $storage
*/
public function __construct(
UrlGeneratorInterface $urlGenerator,
@ -76,7 +76,6 @@ class LogoutSuccessHandler implements LogoutSuccessHandlerInterface
}
$online_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE);
$query = "DELETE FROM ".$online_table." WHERE login_user_id = $userId";
Database::query($query);

@ -187,7 +187,7 @@ class Container
*/
public static function getUrlGenerator()
{
return self::$container->get('router');
return self::$container->get('router.default');
}
/**
@ -199,7 +199,7 @@ class Container
return self::$request;
}
return self::$container->get('request');
return self::$container->get('request_stack');
}
public static function setRequest($request)
@ -400,7 +400,7 @@ class Container
\CourseManager::setEntityManager($em);
Container::setSettingsManager($container->get('chamilo.settings.manager'));
Container::setUserManager($container->get('sonata.user.user_manager'));
Container::setUserManager($container->get('fos_user.user_manager'));
Container::setSiteManager($container->get('sonata.page.manager.site'));
\CourseManager::setCourseSettingsManager($container->get('chamilo_course.settings.manager'));

@ -401,7 +401,7 @@ class LeftMenuBuilder implements ContainerAwareInterface
public function loginMenu(FactoryInterface $factory, array $options)
{
$menu = $factory->createItem('main');
$translator = $this->container->get('translator.default');
$translator = $this->container->get('translator');
$settingManager = $this->container->get('chamilo.settings.manager');
if ($settingManager->getSetting('allow_registration') == 'true') {
@ -446,7 +446,7 @@ class LeftMenuBuilder implements ContainerAwareInterface
*/
public function helpMenu(FactoryInterface $factory, array $options)
{
$translator = $this->container->get('translator.default');
$translator = $this->container->get('translator');
$menu = $factory->createItem('main');
$menu->addChild(
$translator->trans('Forum'),

@ -3,6 +3,7 @@
namespace Chamilo\CoreBundle\Menu;
use Chamilo\FaqBundle\Entity\Category;
use Chamilo\PageBundle\Entity\Page;
use Chamilo\PageBundle\Entity\Site;
use Knp\Menu\FactoryInterface;
@ -133,7 +134,8 @@ class NavBuilder implements ContainerAwareInterface
}
}
$categories = $this->container->get('Chamilo\FaqBundle\Repository\CategoryRepository')->retrieveActive();
$categories = $this->container->get('doctrine')->getRepository('ChamiloFaqBundle:Category')->retrieveActive();
//$categories = $this->container->get('Chamilo\FaqBundle\Repository\CategoryRepository')->retrieveActive();
if ($categories) {
$faq = $menu->addChild(
'FAQ',

@ -100,7 +100,7 @@ services:
# html editor
chamilo_core.html_editor:
class: Chamilo\CoreBundle\Component\Editor\CkEditor\CkEditor
arguments: ['@translator.default', '@router']
arguments: ['@translator', '@router']
public: true
# Listeners
# chamilo.doctrine.entity_listener_resolver:

@ -48,12 +48,10 @@ class CourseListener
return;
}
var_dump(get_class($request));
$sessionHandler = $event->getRequest()->getSession();
$container = $this->container;
$translator = $container->get('translator.default');
$translator = $container->get('translator');
$courseCode = $request->get('course');
// Detect if the course was set with a cidReq:

@ -4,23 +4,23 @@
{% if is_granted('IS_AUTHENTICATED_FULLY') %}
{{ macro.panel(
'Profile' | trans,
mopa_bootstrap_menu('ChamiloCoreBundle:LeftMenuBuilder:profileMenu', {'automenu': 'pills', 'stacked':true})
'Profile' | trans,
mopa_bootstrap_menu('ChamiloCoreBundle:LeftMenuBuilder:profileMenu', {'automenu': 'pills', 'stacked':true})
) }}
{{ macro.panel(
'Courses' | trans,
mopa_bootstrap_menu('ChamiloCoreBundle:LeftMenuBuilder:courseMenu', {'automenu': 'pills', 'stacked':true})
'Courses' | trans,
mopa_bootstrap_menu('ChamiloCoreBundle:LeftMenuBuilder:courseMenu', {'automenu': 'pills', 'stacked':true})
) }}
{{ macro.panel(
'Sessions' | trans,
mopa_bootstrap_menu('ChamiloCoreBundle:LeftMenuBuilder:sessionMenu', {'automenu': 'pills', 'stacked':true})
'Sessions' | trans,
mopa_bootstrap_menu('ChamiloCoreBundle:LeftMenuBuilder:sessionMenu', {'automenu': 'pills', 'stacked':true})
) }}
{{ macro.panel(
'Skills' | trans,
mopa_bootstrap_menu('ChamiloCoreBundle:LeftMenuBuilder:skillsMenu', {'automenu': 'pills', 'stacked':true})
'Skills' | trans,
mopa_bootstrap_menu('ChamiloCoreBundle:LeftMenuBuilder:skillsMenu', {'automenu': 'pills', 'stacked':true})
) }}
{% else %}
{# Plugin login before/after tpls #}

@ -14,11 +14,12 @@ use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Event\LifecycleEventArgs;
use Doctrine\ORM\Mapping as ORM;
use FOS\UserBundle\Model\GroupInterface;
use FOS\UserBundle\Model\UserInterface;
//use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Security\Core\User\UserInterface;
use Sonata\UserBundle\Entity\BaseUser;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\Security\Core\User\EquatableInterface;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Validator\Mapping\ClassMetadata;
@ -79,7 +80,7 @@ use Symfony\Component\Validator\Mapping\ClassMetadata;
* )
* })
*/
class User extends BaseUser implements ThemeUser //implements ParticipantInterface, ThemeUser
class User extends BaseUser implements ThemeUser, EquatableInterface //implements ParticipantInterface, ThemeUser
{
const COURSE_MANAGER = 1;
const TEACHER = 1;
@ -330,27 +331,6 @@ class User extends BaseUser implements ThemeUser //implements ParticipantInterfa
*/
protected $commentedUserSkills;
/**
* @var string
*
* @ORM\Column(name="lastname", type="string", length=60, nullable=true, unique=false)
*/
//protected $lastname;
/**
* @var string
*
* @ORM\Column(name="firstname", type="string", length=60, nullable=true, unique=false)
*/
//protected $firstname;
/**
* @var string
*
* @ORM\Column(name="password", type="string", length=255, nullable=false, unique=false)
*/
//protected $password;
/**
* @var string
*
@ -378,13 +358,6 @@ class User extends BaseUser implements ThemeUser //implements ParticipantInterfa
*/
private $pictureUri;
/**
* ORM\ManyToOne(targetEntity="Application\Sonata\MediaBundle\Entity\Media", cascade={"all"} ).
*
* @ORM\JoinColumn(name="picture_uri", referencedColumnName="id")
*/
//protected $pictureUri;
/**
* @var int
*
@ -481,8 +454,8 @@ class User extends BaseUser implements ThemeUser //implements ParticipantInterfa
*/
public function __construct()
{
$this->status = self::STUDENT;
parent::__construct();
$this->status = self::STUDENT;
$this->salt = sha1(uniqid(null, true));
$this->active = true;
$this->registrationDate = new \DateTime();
@ -517,17 +490,14 @@ class User extends BaseUser implements ThemeUser //implements ParticipantInterfa
/**
* Updates the id with the user_id.
*
* @ORM\PostPersist()
* @ORM\PostPersist()
*
* @param LifecycleEventArgs $args
*/
public function postPersist(LifecycleEventArgs $args)
{
//parent::postPersist();
// Updates the user_id field
$user = $args->getEntity();
$this->setUserId($user->getId());
/*$em = $args->getEntityManager();
$em->persist($user);
$em->flush();*/
}
/**
@ -556,14 +526,6 @@ class User extends BaseUser implements ThemeUser //implements ParticipantInterfa
return $this->id;
}
/**
* @return string
*/
public function getEncoderName()
{
return "legacy_encoder";
}
/**
* @return ArrayCollection
*/
@ -646,30 +608,6 @@ class User extends BaseUser implements ThemeUser //implements ParticipantInterfa
);*/
}
/**
* {@inheritdoc}
*/
public function isEqualTo(UserInterface $user)
{
if (!$user instanceof User) {
return false;
}
/*if ($this->password !== $user->getPassword()) {
return false;
}*/
/*if ($this->getSalt() !== $user->getSalt()) {
return false;
}*/
/*if ($this->username !== $user->getUsername()) {
return false;
}*/
return true;
}
/**
* @return ArrayCollection
*/
@ -1637,51 +1575,17 @@ class User extends BaseUser implements ThemeUser //implements ParticipantInterfa
*
* @return bool
*/
public function isPasswordRequestNonExpired($ttl)
/*public function isPasswordRequestNonExpired($ttl)
{
return $this->getPasswordRequestedAt() instanceof \DateTime &&
$this->getPasswordRequestedAt()->getTimestamp() + $ttl > time();
}
}*/
public function getUsername()
{
return $this->username;
}
/**
* Returns the creation date.
*
* @return \DateTime|null
*/
public function getCreatedAt()
{
return $this->createdAt;
}
/**
* Sets the last update date.
*
* @param \DateTime|null $updatedAt
*
* @return User
*/
public function setUpdatedAt(\DateTime $updatedAt = null)
{
$this->updatedAt = $updatedAt;
return $this;
}
/**
* Returns the last update date.
*
* @return \DateTime|null
*/
public function getUpdatedAt()
{
return $this->updatedAt;
}
/**
* Returns the expiration date.
*
@ -1732,366 +1636,6 @@ class User extends BaseUser implements ThemeUser //implements ParticipantInterfa
return $this;
}
/**
* Sets the two-step verification code.
*
* @param string $twoStepVerificationCode
*
* @return User
*/
public function setTwoStepVerificationCode($twoStepVerificationCode)
{
$this->twoStepVerificationCode = $twoStepVerificationCode;
return $this;
}
/**
* Returns the two-step verification code.
*
* @return string
*/
public function getTwoStepVerificationCode()
{
return $this->twoStepVerificationCode;
}
/**
* @param string $biography
*
* @return User
*/
public function setBiography($biography)
{
$this->biography = $biography;
return $this;
}
/**
* @return string
*/
public function getBiography()
{
return $this->biography;
}
/**
* @param \DateTime $dateOfBirth
*
* @return User
*/
public function setDateOfBirth($dateOfBirth)
{
$this->dateOfBirth = $dateOfBirth;
return $this;
}
/**
* @return \DateTime
*/
public function getDateOfBirth()
{
return $this->dateOfBirth;
}
/**
* @param string $facebookData
*
* @return User
*/
public function setFacebookData($facebookData)
{
$this->facebookData = $facebookData;
return $this;
}
/**
* @return string
*/
public function getFacebookData()
{
return $this->facebookData;
}
/**
* @param string $facebookName
*
* @return User
*/
public function setFacebookName($facebookName)
{
$this->facebookName = $facebookName;
return $this;
}
/**
* @return string
*/
public function getFacebookName()
{
return $this->facebookName;
}
/**
* @param string $facebookUid
*
* @return User
*/
public function setFacebookUid($facebookUid)
{
$this->facebookUid = $facebookUid;
return $this;
}
/**
* @return string
*/
public function getFacebookUid()
{
return $this->facebookUid;
}
/**
* @return string
*/
public function getFirstname()
{
return $this->firstname;
}
/**
* @param string $gender
*
* @return User
*/
public function setGender($gender)
{
$this->gender = $gender;
return $this;
}
/**
* @return string
*/
public function getGender()
{
return $this->gender;
}
/**
* @param string $gplusData
*
* @return User
*/
public function setGplusData($gplusData)
{
$this->gplusData = $gplusData;
return $this;
}
/**
* @return string
*/
public function getGplusData()
{
return $this->gplusData;
}
/**
* @param string $gplusName
*
* @return User
*/
public function setGplusName($gplusName)
{
$this->gplusName = $gplusName;
return $this;
}
/**
* @return string
*/
public function getGplusName()
{
return $this->gplusName;
}
/**
* @param string $gplusUid
*
* @return User
*/
public function setGplusUid($gplusUid)
{
$this->gplusUid = $gplusUid;
return $this;
}
/**
* @return string
*/
public function getGplusUid()
{
return $this->gplusUid;
}
/**
* @return string
*/
public function getLastname()
{
return $this->lastname;
}
/**
* @param string $locale
*
* @return User
*/
public function setLocale($locale)
{
$this->locale = $locale;
return $this;
}
/**
* @return string
*/
public function getLocale()
{
return $this->locale;
}
/**
* @param string $timezone
*
* @return User
*/
public function setTimezone($timezone)
{
$this->timezone = $timezone;
return $this;
}
/**
* @return string
*/
public function getTimezone()
{
return $this->timezone;
}
/**
* @param string $twitterData
*
* @return User
*/
public function setTwitterData($twitterData)
{
$this->twitterData = $twitterData;
return $this;
}
/**
* @return string
*/
public function getTwitterData()
{
return $this->twitterData;
}
/**
* @param string $twitterName
*
* @return User
*/
public function setTwitterName($twitterName)
{
$this->twitterName = $twitterName;
return $this;
}
/**
* @return string
*/
public function getTwitterName()
{
return $this->twitterName;
}
/**
* @param string $twitterUid
*
* @return User
*/
public function setTwitterUid($twitterUid)
{
$this->twitterUid = $twitterUid;
return $this;
}
/**
* @return string
*/
public function getTwitterUid()
{
return $this->twitterUid;
}
/**
* @param string $website
*
* @return User
*/
public function setWebsite($website)
{
$this->website = $website;
return $this;
}
/**
* @return string
*/
public function getWebsite()
{
return $this->website;
}
/**
* @param string $token
*
* @return User
*/
public function setToken($token)
{
$this->token = $token;
return $this;
}
/**
* @return string
*/
public function getToken()
{
return $this->token;
}
/**
* @return string
*/
@ -2100,60 +1644,6 @@ class User extends BaseUser implements ThemeUser //implements ParticipantInterfa
return sprintf('%s %s', $this->getFirstname(), $this->getLastname());
}
/**
* @return array
*/
public function getRealRoles()
{
return $this->roles;
}
/**
* @param array $roles
*
* @return User
*/
public function setRealRoles(array $roles)
{
$this->setRoles($roles);
return $this;
}
/**
* Removes sensitive data from the user.
*/
public function eraseCredentials()
{
$this->plainPassword = null;
}
/**
* @return string
*/
public function getUsernameCanonical()
{
return $this->usernameCanonical;
}
/**
* @return string
*/
public function getEmailCanonical()
{
return $this->emailCanonical;
}
/**
* @return mixed
*/
public function getPlainPassword()
{
if (isset($this->plainPassword)) {
return $this->plainPassword;
}
}
/**
* Returns the user roles.
*
@ -2173,89 +1663,38 @@ class User extends BaseUser implements ThemeUser //implements ParticipantInterfa
return array_unique($roles);
}
/**
* Never use this to check if this user has access to anything!
*
* Use the SecurityContext, or an implementation of AccessDecisionManager
* instead, e.g.
*
* $securityContext->isGranted('ROLE_USER');
*
* @param string $role
*
* @return bool
*/
public function hasRole($role)
{
return in_array(strtoupper($role), $this->getRoles(), true);
}
public function isAccountNonExpired()
{
if (true === $this->expired) {
/*if (true === $this->expired) {
return false;
}
if (null !== $this->expiresAt && $this->expiresAt->getTimestamp() < time()) {
return false;
}
}*/
return true;
}
public function isAccountNonLocked()
{
return !$this->locked;
return true;
//return !$this->locked;
}
public function isCredentialsNonExpired()
{
if (true === $this->credentialsExpired) {
/*if (true === $this->credentialsExpired) {
return false;
}
if (null !== $this->credentialsExpireAt && $this->credentialsExpireAt->getTimestamp() < time()) {
return false;
}
}*/
return true;
}
public function isCredentialsExpired()
{
return !$this->isCredentialsNonExpired();
}
public function isExpired()
{
return !$this->isAccountNonExpired();
}
public function isLocked()
{
return !$this->isAccountNonLocked();
}
public function isSuperAdmin()
{
return $this->hasRole(static::ROLE_SUPER_ADMIN);
}
public function isUser(UserInterface $user = null)
{
return null !== $user && $this->getId() === $user->getId();
}
public function removeRole($role)
{
if (false !== $key = array_search(strtoupper($role), $this->roles, true)) {
unset($this->roles[$key]);
$this->roles = array_values($this->roles);
}
return $this;
}
/**
* @param bool $boolean
*
@ -2301,24 +1740,6 @@ class User extends BaseUser implements ThemeUser //implements ParticipantInterfa
return $this;
}
public function setSuperAdmin($boolean)
{
if (true === $boolean) {
$this->addRole(static::ROLE_SUPER_ADMIN);
} else {
$this->removeRole(static::ROLE_SUPER_ADMIN);
}
return $this;
}
public function setPlainPassword($password)
{
$this->plainPassword = $password;
return $this;
}
public function setLocked($boolean)
{
$this->locked = $boolean;
@ -2326,13 +1747,6 @@ class User extends BaseUser implements ThemeUser //implements ParticipantInterfa
return $this;
}
public function setPasswordRequestedAt(\DateTime $date = null)
{
$this->passwordRequestedAt = $date;
return $this;
}
public function setRoles(array $roles)
{
$this->roles = [];
@ -2344,110 +1758,6 @@ class User extends BaseUser implements ThemeUser //implements ParticipantInterfa
return $this;
}
/**
* Gets the groups granted to the user.
*
* @return Collection
*/
public function getGroups()
{
return $this->groups ?: $this->groups = new ArrayCollection();
}
public function getGroupNames()
{
$names = [];
foreach ($this->getGroups() as $group) {
$names[] = $group->getName();
}
return $names;
}
public function hasGroup($name)
{
return in_array($name, $this->getGroupNames());
}
public function addGroup(GroupInterface $group)
{
if (!$this->getGroups()->contains($group)) {
$this->getGroups()->add($group);
}
return $this;
}
public function removeGroup(GroupInterface $group)
{
if ($this->getGroups()->contains($group)) {
$this->getGroups()->removeElement($group);
}
return $this;
}
public function addRole($role)
{
$role = strtoupper($role);
if ($role === static::ROLE_DEFAULT) {
return $this;
}
if (!in_array($role, $this->roles, true)) {
$this->roles[] = $role;
}
return $this;
}
/**
* Serializes the user.
*
* The serialized data have to contain the fields used by the equals method and the username.
*
* @return string
*/
public function serialize()
{
return serialize([
$this->password,
$this->salt,
$this->usernameCanonical,
$this->username,
$this->expired,
$this->locked,
$this->credentialsExpired,
$this->enabled,
$this->id,
]);
}
/**
* Unserializes the user.
*
* @param string $serialized
*/
public function unserialize($serialized)
{
$data = unserialize($serialized);
// add a few extra elements in the array to ensure that we have enough keys when unserializing
// older data which does not include all properties.
$data = array_merge($data, array_fill(0, 2, null));
list(
$this->password,
$this->salt,
$this->usernameCanonical,
$this->username,
$this->expired,
$this->locked,
$this->credentialsExpired,
$this->enabled,
$this->id
) = $data;
}
/**
* Get achievedSkills.
*
@ -2538,31 +1848,25 @@ class User extends BaseUser implements ThemeUser //implements ParticipantInterfa
}
/**
* Get the list of HRM who have assigned this user.
* @param UserInterface $user
*
* @return array
* @return bool
*/
public function getHrm()
{
$em = \Database::getManager();
$qb = $em->createQueryBuilder();
$hrmList = $qb
->select('uru')
->from('ChamiloCoreBundle:UserRelUser', 'uru')
->innerJoin('ChamiloCoreBundle:AccessUrlRelUser', 'auru', Join::WITH, 'auru.userId = uru.friendUserId')
->where(
$qb->expr()->eq('auru.accessUrlId', api_get_current_access_url_id())
)
->andWhere(
$qb->expr()->eq('uru.userId', $this->id)
)
->andWhere(
$qb->expr()->eq('uru.relationType', USER_RELATION_TYPE_RRHH)
)
->getQuery()
->getResult();
return $hrmList;
public function isEqualTo(UserInterface $user)
{
if ($this->password !== $user->getPassword()) {
return false;
}
if ($this->salt !== $user->getSalt()) {
return false;
}
if ($this->username !== $user->getUsername()) {
return false;
}
return true;
}
}

@ -3592,18 +3592,18 @@ less-loader@~2.2.3:
dependencies:
loader-utils "^0.2.5"
less@^2.7.2:
version "2.7.3"
resolved "https://registry.yarnpkg.com/less/-/less-2.7.3.tgz#cc1260f51c900a9ec0d91fb6998139e02507b63b"
less@^3.0.2:
version "3.0.4"
resolved "https://registry.yarnpkg.com/less/-/less-3.0.4.tgz#d27dcedbac96031c9e7b76f1da1e4b7d83760814"
optionalDependencies:
errno "^0.1.1"
graceful-fs "^4.1.2"
image-size "~0.5.0"
mime "^1.2.11"
mime "^1.4.1"
mkdirp "^0.5.0"
promise "^7.1.1"
request "2.81.0"
source-map "^0.5.3"
request "^2.83.0"
source-map "~0.6.0"
load-json-file@^1.0.0:
version "1.1.0"
@ -3933,7 +3933,7 @@ mime@1.4.1:
version "1.4.1"
resolved "https://registry.yarnpkg.com/mime/-/mime-1.4.1.tgz#121f9ebc49e3766f311a76e1fa1c8003c4b03aa6"
mime@^1.2.11, mime@^1.5.0:
mime@^1.4.1, mime@^1.5.0:
version "1.6.0"
resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1"
@ -5171,7 +5171,7 @@ repeating@^2.0.0:
dependencies:
is-finite "^1.0.0"
request@2:
request@2, request@^2.83.0:
version "2.85.0"
resolved "https://registry.yarnpkg.com/request/-/request-2.85.0.tgz#5a03615a47c61420b3eb99b7dba204f83603e1fa"
dependencies:
@ -5686,7 +5686,7 @@ source-map@^0.5.3, source-map@^0.5.6, source-map@^0.5.7, source-map@~0.5.1:
version "0.5.7"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc"
source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.1:
source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.0, source-map@~0.6.1:
version "0.6.1"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"

Loading…
Cancel
Save