Merge branch 'master' of github.com:chamilo/chamilo-lms

pull/5271/head
Yannick Warnier 2 years ago
commit 9d4fabbed5
  1. 3
      public/main/admin/user_list.php
  2. 7
      public/main/inc/lib/api.lib.php
  3. 2
      public/main/install/install.lib.php
  4. 8
      src/CoreBundle/Entity/User.php
  5. 8
      src/CoreBundle/Repository/Node/UserRepository.php

@ -2,6 +2,7 @@
/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Entity\User;
use ChamiloSession as Session;
use Chamilo\CoreBundle\Component\Utils\StateIcon;
@ -388,7 +389,7 @@ function prepare_user_sql_query(bool $getCount, bool $showDeletedUsers = false):
} else {
$sql .= !str_contains($sql, 'WHERE') ? ' WHERE u.active <> '.USER_SOFT_DELETED : ' AND u.active <> '.USER_SOFT_DELETED;
}
$sql .= ' AND u.status <> '.ROLE_FALLBACK;
$sql .= ' AND u.status <> '.User::ROLE_FALLBACK;
return $sql;
}

@ -52,13 +52,6 @@ define('ANONYMOUS', 6);
/** global status of a user: low security, necessary for inserting data from
* the teacher through HTMLPurifier */
define('COURSEMANAGERLOWSECURITY', 10);
/**
* Global status for the fallback user.
* This special status is used for a system user that acts as a placeholder
* or fallback for content ownership when regular users are deleted.
* This ensures data integrity and prevents orphaned content within the system.
*/
define('ROLE_FALLBACK', 99);
// Soft user status
define('PLATFORM_ADMIN', 11);
define('SESSION_COURSE_COACH', 12);

@ -1539,7 +1539,7 @@ function finishInstallationWithContainer(
->setUsername('fallback_user')
->setEmail('fallback@example.com')
->setPlainPassword($passForm)
->setStatus(ROLE_FALLBACK)
->setStatus(User::ROLE_FALLBACK)
->setLastname('Fallback')
->setFirstname('User')
->setCreatorId(1)

@ -86,7 +86,15 @@ class User implements UserInterface, EquatableInterface, ResourceInterface, Reso
public const USERNAME_MAX_LENGTH = 100;
public const ROLE_DEFAULT = 'ROLE_USER';
public const ANONYMOUS = 6;
/**
* Global status for the fallback user.
* This special status is used for a system user that acts as a placeholder
* or fallback for content ownership when regular users are deleted.
* This ensures data integrity and prevents orphaned content within the system.
*/
public const ROLE_FALLBACK = 99;
/*public const COURSE_MANAGER = 1;
public const TEACHER = 1;
public const SESSION_ADMIN = 3;

@ -318,13 +318,7 @@ class UserRepository extends ResourceRepository implements PasswordUpgraderInter
public function getFallbackUser(): ?User
{
$fallbackUser = $this->findOneBy(['status' => User::ROLE_FALLBACK], ['id' => 'ASC']);
if (!$fallbackUser) {
throw new Exception('User not found.');
}
return $fallbackUser;
return $this->findOneBy(['status' => User::ROLE_FALLBACK], ['id' => 'ASC']);
}
public function addUserToResourceNode(int $userId, int $creatorId): ResourceNode

Loading…
Cancel
Save