User: Remove deprecated user.enabled field - refs #5212

pull/5216/head
christianbeeznst 2 years ago
parent b01b4531e1
commit 4d89a9ea85
  1. 6
      assets/css/app.scss
  2. 4
      assets/css/scss/atoms/_buttons.scss
  3. 2
      public/main/admin/course_list.php
  4. 2
      public/main/inc/lib/usermanager.lib.php
  5. 3
      public/main/inc/lib/webservices/Rest.php
  6. 13
      src/CoreBundle/Entity/User.php
  7. 34
      src/CoreBundle/Migrations/Schema/V200/Version20240306133140.php

@ -153,7 +153,11 @@
@apply font-extrabold text-transparent bg-clip-text bg-gradient-to-br from-primary to-primary-gradient;
}
.ch-tool-icon-button {
@apply font-extrabold bg-clip-text text-gray-90;
@apply font-extrabold bg-clip-text;
}
#course-search-keyword {
@apply w-auto;
}
// Forms

@ -40,11 +40,11 @@
}
&--plain {
@apply bg-gray-30 text-white mr-1.5;
@apply bg-gray-90 text-white mr-1.5;
&:hover,
&:focus {
@apply bg-gray-90;
@apply bg-black;
}
}

@ -509,7 +509,7 @@ if (isset($_GET['search']) && 'advanced' === $_GET['search']) {
);
$form->addButtonSearch(get_lang('Search courses'));
$advanced = '<a class="btn btn--plain" href="'.api_get_path(WEB_CODE_PATH).'admin/course_list.php?search=advanced">
<em class="fa fa-search"></em> '.
<em class="pi pi-search"></em> '.
get_lang('Advanced search').'</a>';
// Create a filter by session

@ -283,7 +283,6 @@ class UserManager
->setRegistrationDate($now)
->setHrDeptId($hrDeptId)
->setActive($active)
->setEnabled($active)
->setTimezone(api_get_timezone())
;
@ -1084,7 +1083,6 @@ class UserManager
->setAddress($address)
->setExpirationDate($expiration_date)
->setActive((bool) $active)
->setEnabled((bool) $active)
->setHrDeptId((int) $hr_dept_id)
;

@ -1830,9 +1830,6 @@ class Rest extends WebService
case 'email':
$user->setEmail($value);
break;
case 'enabled':
$user->setEnabled($value);
break;
case 'lastname':
$user->setLastname($value);
break;

@ -199,11 +199,6 @@ class User implements UserInterface, EquatableInterface, ResourceInterface, Reso
#[ORM\Column(name: 'locked', type: 'boolean')]
protected bool $locked;
#[Groups(['user:read', 'user:write'])]
#[Assert\NotNull]
#[ORM\Column(name: 'enabled', type: 'boolean')]
protected bool $enabled;
#[Groups(['user:read', 'user:write'])]
#[ORM\Column(name: 'expired', type: 'boolean')]
protected bool $expired;
@ -734,7 +729,6 @@ class User implements UserInterface, EquatableInterface, ResourceInterface, Reso
$this->status = CourseRelUser::STUDENT;
$this->salt = sha1(uniqid('', true));
$this->active = true;
$this->enabled = true;
$this->locked = false;
$this->expired = false;
$this->courses = new ArrayCollection();
@ -954,13 +948,6 @@ class User implements UserInterface, EquatableInterface, ResourceInterface, Reso
return $this->isActive();
}
public function setEnabled(bool $boolean): self
{
$this->enabled = $boolean;
return $this;
}
/**
* Returns the list of classes for the user.
*/

@ -0,0 +1,34 @@
<?php
declare(strict_types=1);
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Migrations\Schema\V200;
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
class Version20240306133140 extends AbstractMigrationChamilo
{
public function getDescription(): string
{
return 'Remove deprecated and confusing user.enabled field';
}
public function up(Schema $schema): void
{
$table = $schema->getTable('user');
if ($table->hasColumn('enabled')) {
$this->addSql('ALTER TABLE user DROP enabled');
}
}
public function down(Schema $schema): void
{
$table = $schema->getTable('user');
if (!$table->hasColumn('enabled')) {
$this->addSql('ALTER TABLE user ADD enabled TINYINT(1) NOT NULL');
}
}
}
Loading…
Cancel
Save