Merge remote-tracking branch 'origin/master'

pull/5665/head
Angel Fernando Quiroz Campos 1 year ago
commit 965d5ca729
No known key found for this signature in database
GPG Key ID: B284841AE3E562CD
  1. 2
      assets/vue/store/securityStore.js
  2. 2
      config/packages/security.yaml
  3. 2
      public/main/inc/lib/TicketManager.php
  4. 4
      public/main/inc/lib/api.lib.php
  5. 4
      public/main/template/default/gradebook/custom_certificate.html.twig
  6. 2
      src/CoreBundle/DataFixtures/PermissionFixtures.php
  7. 4
      src/CoreBundle/Entity/User.php
  8. 30
      src/CoreBundle/Migrations/Schema/V200/Version20230215072918.php
  9. 66
      src/CoreBundle/Migrations/Schema/V200/Version20240713125400.php
  10. 2
      src/CoreBundle/Repository/GroupRepository.php
  11. 2
      src/CoreBundle/Repository/SessionRepository.php
  12. 2
      src/CoreBundle/ServiceHelper/TicketProjectHelper.php
  13. 2
      src/CoreBundle/State/CategorizedExerciseResultStateProvider.php
  14. 2
      src/LtiBundle/Controller/CourseController.php
  15. 2
      src/LtiBundle/Util/Utils.php
  16. 4
      tests/CoreBundle/Repository/Node/UserRepositoryTest.php
  17. 2
      tests/CoreBundle/Repository/SessionRepositoryTest.php
  18. 3
      translations/messages.de.po
  19. 3
      translations/messages.en.po
  20. 3
      translations/messages.es.po
  21. 3
      translations/messages.fr.po
  22. 3
      translations/messages.pot

@ -20,7 +20,7 @@ export const useSecurityStore = defineStore("security", () => {
const isStudentBoss = computed(() => hasRole.value("ROLE_STUDENT_BOSS"))
const isHRM = computed(() => hasRole.value("ROLE_RRHH"))
const isHRM = computed(() => hasRole.value("ROLE_HR"))
const isTeacher = computed(() => (isAdmin.value ? true : hasRole.value("ROLE_TEACHER")))

@ -45,7 +45,7 @@ security:
ROLE_SUPER_ADMIN: [ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH] # Admin that can log in as another user.
ROLE_GLOBAL_ADMIN: [ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH] # The user that installed the platform.
ROLE_TEACHER: [ROLE_STUDENT]
ROLE_RRHH: [ROLE_TEACHER, ROLE_ALLOWED_TO_SWITCH]
ROLE_HR: [ROLE_TEACHER, ROLE_ALLOWED_TO_SWITCH]
ROLE_QUESTION_MANAGER: [ROLE_STUDENT]
ROLE_SESSION_MANAGER: [ROLE_STUDENT, ROLE_ALLOWED_TO_SWITCH]
ROLE_STUDENT_BOSS: [ROLE_STUDENT]

@ -2468,7 +2468,7 @@ class TicketManager
$roleMap = [
1 => 'ROLE_TEACHER',
17 => 'ROLE_STUDENT_BOSS',
4 => 'ROLE_RRHH',
4 => 'ROLE_HR',
3 => 'ROLE_SESSION_MANAGER',
// ... other mappings can be added as needed
];

@ -2886,7 +2886,7 @@ function api_is_platform_admin($allowSessionAdmins = false, $allowDrh = false)
return true;
}
if ($allowDrh && $currentUser->hasRole('ROLE_RRHH')) {
if ($allowDrh && $currentUser->hasRole('ROLE_HR')) {
return true;
}
@ -3155,7 +3155,7 @@ function api_is_session_admin(?User $user = null)
*/
function api_is_drh()
{
return api_user_has_role('ROLE_RRHH');
return api_user_has_role('ROLE_HR');
}
/**

@ -80,7 +80,7 @@
{% endif %}
<br />
<p style="color:#40ad49; font-size: 16px;">
Berlin/Paris, {{ 'The'|trans }}
{{ 'The'|trans }}
<span style="font-weight: bold; color: #672290;">{{ certificate_generated_date_no_time }}</span>
<br />
{{ 'The platform team'|trans|raw }}
@ -104,7 +104,7 @@
</td>
<td bgcolor="#92c647" width=500 height=91
style="border-collapse: collapse; padding: 0; font-family:CourierSans-Light; line-height: 18px; color:#FFF;">
{{ 'Chamilo LMS' }}
{{ 'Chamilo LMS'|trans|raw }}
</td>
<td bgcolor="#92c647" width="245" height="91"
style="border-collapse: collapse; padding: 0;">

@ -158,7 +158,7 @@ class PermissionFixtures extends Fixture implements FixtureGroupInterface
'ROLE_ADMIN' => 'ADM',
'ROLE_SUPER_ADMIN' => 'SUA',
'ROLE_GLOBAL_ADMIN' => 'GLO',
'ROLE_RRHH' => 'HRM',
'ROLE_HR' => 'HRM',
'ROLE_QUESTION_MANAGER' => 'QBM',
'ROLE_SESSION_MANAGER' => 'SSM',
'ROLE_STUDENT_BOSS' => 'STB',

@ -1743,7 +1743,7 @@ class User implements UserInterface, EquatableInterface, ResourceInterface, Reso
return match ($status) {
COURSEMANAGER => 'ROLE_TEACHER',
STUDENT => 'ROLE_STUDENT',
DRH => 'ROLE_RRHH',
DRH => 'ROLE_HR',
SESSIONADMIN => 'ROLE_SESSION_MANAGER',
STUDENT_BOSS => 'ROLE_STUDENT_BOSS',
INVITEE => 'ROLE_INVITEE',
@ -1949,7 +1949,7 @@ class User implements UserInterface, EquatableInterface, ResourceInterface, Reso
public function isHRM(): bool
{
return $this->hasRole('ROLE_RRHH');
return $this->hasRole('ROLE_HR');
}
public function getStatus(): int

@ -50,21 +50,23 @@ final class Version20230215072918 extends AbstractMigrationChamilo
if (!empty($items)) {
foreach ($items as $item) {
$sessionId = $item['session_id'] ?? 0;
$userId = $item['to_user_id'] ?? 0;
$session = $sessionRepo->find($sessionId);
$user = $userRepo->find($userId);
$item = new CLpRelUser();
$item
->setUser($user)
->setCourse($course)
->setLp($lp)
;
if (!empty($session)) {
$item->setSession($session);
if (!($item['to_user_id'] === NULL || $item['to_user_id'] === 0)) {
$sessionId = $item['session_id'] ?? 0;
$userId = $item['to_user_id'] ?? 0;
$session = $sessionRepo->find($sessionId);
$user = $userRepo->find($userId);
$item = new CLpRelUser();
$item
->setUser($user)
->setCourse($course)
->setLp($lp)
;
if (!empty($session)) {
$item->setSession($session);
}
$this->entityManager->persist($item);
$this->entityManager->flush();
}
$this->entityManager->persist($item);
$this->entityManager->flush();
}
}
}

@ -0,0 +1,66 @@
<?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;
final class Version20240713125400 extends AbstractMigrationChamilo
{
public function getDescription(): string
{
return 'Replace ROLE_RRHH with ROLE_HR in user.roles';
}
public function up(Schema $schema): void
{
$conn = $this->connection;
$users = $conn->fetchAllAssociative("SELECT id, roles FROM user WHERE roles LIKE '%ROLE_RRHH%'");
foreach ($users as $user) {
$roles = unserialize($user['roles']);
if ($roles !== false) {
$updatedRoles = array_map(function ($role) {
return $role === 'ROLE_RRHH' ? 'ROLE_HR' : $role;
}, $roles);
$newRolesSerialized = serialize($updatedRoles);
$conn->executeUpdate(
'UPDATE user SET roles = ? WHERE id = ?',
[$newRolesSerialized, $user['id']]
);
}
}
}
public function down(Schema $schema): void
{
$conn = $this->connection;
$users = $conn->fetchAllAssociative("SELECT id, roles FROM user WHERE roles LIKE '%ROLE_HR%'");
foreach ($users as $user) {
$roles = unserialize($user['roles']);
if ($roles !== false) {
$updatedRoles = array_map(function ($role) {
return $role === 'ROLE_HR' ? 'ROLE_RRHH' : $role;
}, $roles);
$newRolesSerialized = serialize($updatedRoles);
$conn->executeUpdate(
'UPDATE user SET roles = ? WHERE id = ?',
[$newRolesSerialized, $user['id']]
);
}
}
}
}

@ -66,7 +66,7 @@ class GroupRepository extends ServiceEntityRepository
[
'code' => 'RRHH',
'title' => 'Human resources manager',
'roles' => ['ROLE_RRHH'],
'roles' => ['ROLE_HR'],
],
[
'code' => 'SESSION_MANAGER',

@ -221,7 +221,7 @@ class SessionRepository extends ServiceEntityRepository
switch ($relationType) {
case Session::DRH:
if ($user->hasRole('ROLE_RRHH')) {
if ($user->hasRole('ROLE_HR')) {
$session->addUserInSession(Session::DRH, $user);
}

@ -51,7 +51,7 @@ class TicketProjectHelper
$roleMap = [
1 => 'ROLE_TEACHER',
17 => 'ROLE_STUDENT_BOSS',
4 => 'ROLE_RRHH',
4 => 'ROLE_HR',
3 => 'ROLE_SESSION_MANAGER',
// ... other mappings can be added as needed
];

@ -436,7 +436,7 @@ class CategorizedExerciseResultStateProvider implements ProviderInterface
private function isAllowedToSeeResults(): bool
{
$isStudentBoss = $this->security->isGranted('ROLE_STUDENT_BOSS');
$isHRM = $this->security->isGranted('ROLE_RRHH');
$isHRM = $this->security->isGranted('ROLE_HR');
$isSessionAdmin = $this->security->isGranted('ROLE_SESSION_MANAGER');
$isCourseTutor = $this->security->isGranted('ROLE_CURRENT_COURSE_SESSION_TEACHER');
$isAllowedToEdit = api_is_allowed_to_edit(null, true);

@ -211,7 +211,7 @@ class CourseController extends ToolBaseController
$params['lis_person_contact_email_primary'] = $user->getEmail();
}
if ($user->hasRole('ROLE_RRHH')) {
if ($user->hasRole('ROLE_HR')) {
$scopeMentor = $ltiUtil->generateRoleScopeMentor($user);
if (!empty($scopeMentor)) {

@ -56,7 +56,7 @@ class Utils
*/
public static function generateUserRoles(User $user)
{
if ($user->hasRole('ROLE_RRHH')) {
if ($user->hasRole('ROLE_HR')) {
return 'urn:lti:role:ims/lis/Mentor';
}

@ -101,7 +101,7 @@ class UserRepositoryTest extends AbstractApiTest
$student = $this->createUser('student');
$drh = $this->createUser('drh');
$drh->setRoles(['ROLE_RRHH']);
$drh->setRoles(['ROLE_HR']);
$userRepo->update($drh);
$student->addUserRelUser($drh, UserRelUser::USER_RELATION_TYPE_RRHH);
@ -126,7 +126,7 @@ class UserRepositoryTest extends AbstractApiTest
$this->assertSame('ROLE_TEACHER', User::getRoleFromStatus(1));
$this->assertSame('ROLE_STUDENT', User::getRoleFromStatus(5));
$this->assertSame('ROLE_RRHH', User::getRoleFromStatus(4));
$this->assertSame('ROLE_HR', User::getRoleFromStatus(4));
$this->assertSame('ROLE_SESSION_MANAGER', User::getRoleFromStatus(3));
$this->assertSame('ROLE_STUDENT_BOSS', User::getRoleFromStatus(17));
$this->assertSame('ROLE_INVITEE', User::getRoleFromStatus(20));

@ -275,7 +275,7 @@ class SessionRepositoryTest extends AbstractApiTest
$student = $this->createUser('student');
$sessionAdmin = $this->createUser('session_admin');
$generalCoach = $this->createUser('general_coach');
$drh = $this->createUser('drh', '', '', 'ROLE_RRHH');
$drh = $this->createUser('drh', '', '', 'ROLE_HR');
$courseCoach = $this->createUser('course_coach', '', '', 'ROLE_TEACHER');
// Add session admin + add course to session.

@ -50,6 +50,9 @@ msgstr "Badge erstellen"
msgid "Badges"
msgstr "Badges"
msgid "Chamilo LMS"
msgstr "Chamilo LMS"
msgid "Students who acquired skill %s"
msgstr "Studierende die Fähigkeiten erworben haben %s"

@ -27523,6 +27523,9 @@ msgstr "Obtained the following skills"
msgid "Certificate Footer"
msgstr ""
msgid "Chamilo LMS"
msgstr "Chamilo LMS"
msgid "The attempted oral questions are %s"
msgstr "The attempted oral questions are %s"

@ -50,6 +50,9 @@ msgstr "Crear insignia"
msgid "Badges"
msgstr "Insignias"
msgid "Chamilo LMS"
msgstr "Chamilo LMS"
msgid "Students who acquired skill %s"
msgstr "Estudiantes que adquirieron la competencia %s"

@ -29217,6 +29217,9 @@ msgstr "a obtenu les compétences suivantes "
msgid "Certificate Footer"
msgstr ""
msgid "Chamilo LMS"
msgstr "Chamilo LMS"
msgid "No course session for this user"
msgstr "Pas de cours de session pour cet utilisateur"

@ -27516,6 +27516,9 @@ msgstr ""
msgid "Certificate Footer"
msgstr ""
msgid "Chamilo LMS"
msgstr ""
msgid "Select date .."
msgstr ""

Loading…
Cancel
Save