Internal: Remove global constant ROLE_FALLBACK in favor of User::ROLE_FALLBACK

pull/5271/head
Angel Fernando Quiroz Campos 2 years ago
parent 10a5f23ff4
commit 9cb43a7fe2
  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

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

@ -52,13 +52,6 @@ define('ANONYMOUS', 6);
/** global status of a user: low security, necessary for inserting data from /** global status of a user: low security, necessary for inserting data from
* the teacher through HTMLPurifier */ * the teacher through HTMLPurifier */
define('COURSEMANAGERLOWSECURITY', 10); 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 // Soft user status
define('PLATFORM_ADMIN', 11); define('PLATFORM_ADMIN', 11);
define('SESSION_COURSE_COACH', 12); define('SESSION_COURSE_COACH', 12);

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

@ -86,7 +86,15 @@ class User implements UserInterface, EquatableInterface, ResourceInterface, Reso
public const USERNAME_MAX_LENGTH = 100; public const USERNAME_MAX_LENGTH = 100;
public const ROLE_DEFAULT = 'ROLE_USER'; public const ROLE_DEFAULT = 'ROLE_USER';
public const ANONYMOUS = 6; 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 ROLE_FALLBACK = 99;
/*public const COURSE_MANAGER = 1; /*public const COURSE_MANAGER = 1;
public const TEACHER = 1; public const TEACHER = 1;
public const SESSION_ADMIN = 3; public const SESSION_ADMIN = 3;

Loading…
Cancel
Save