diff --git a/assets/vue/store/securityStore.js b/assets/vue/store/securityStore.js index cc03441eb8..18530326ab 100644 --- a/assets/vue/store/securityStore.js +++ b/assets/vue/store/securityStore.js @@ -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"))) diff --git a/config/packages/security.yaml b/config/packages/security.yaml index fece317940..4adfcabd9d 100644 --- a/config/packages/security.yaml +++ b/config/packages/security.yaml @@ -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] diff --git a/public/main/inc/lib/TicketManager.php b/public/main/inc/lib/TicketManager.php index 31693e683a..16a8dc0efe 100644 --- a/public/main/inc/lib/TicketManager.php +++ b/public/main/inc/lib/TicketManager.php @@ -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 ]; diff --git a/public/main/inc/lib/api.lib.php b/public/main/inc/lib/api.lib.php index 8f6d6578ce..a763ef8a97 100644 --- a/public/main/inc/lib/api.lib.php +++ b/public/main/inc/lib/api.lib.php @@ -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'); } /** diff --git a/public/main/template/default/gradebook/custom_certificate.html.twig b/public/main/template/default/gradebook/custom_certificate.html.twig index 32c4ca7d67..321265fb89 100644 --- a/public/main/template/default/gradebook/custom_certificate.html.twig +++ b/public/main/template/default/gradebook/custom_certificate.html.twig @@ -80,7 +80,7 @@ {% endif %}

- Berlin/Paris, {{ 'The'|trans }} + {{ 'The'|trans }} {{ certificate_generated_date_no_time }}
{{ 'The platform team'|trans|raw }} @@ -104,7 +104,7 @@ - {{ 'Chamilo LMS' }} + {{ 'Chamilo LMS'|trans|raw }} diff --git a/src/CoreBundle/DataFixtures/PermissionFixtures.php b/src/CoreBundle/DataFixtures/PermissionFixtures.php index 7f60c373a3..87aa3c6684 100644 --- a/src/CoreBundle/DataFixtures/PermissionFixtures.php +++ b/src/CoreBundle/DataFixtures/PermissionFixtures.php @@ -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', diff --git a/src/CoreBundle/Entity/User.php b/src/CoreBundle/Entity/User.php index 1e699b5930..35d5064f85 100644 --- a/src/CoreBundle/Entity/User.php +++ b/src/CoreBundle/Entity/User.php @@ -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 diff --git a/src/CoreBundle/Migrations/Schema/V200/Version20230215072918.php b/src/CoreBundle/Migrations/Schema/V200/Version20230215072918.php index cb4ce8ce53..204e7e780c 100644 --- a/src/CoreBundle/Migrations/Schema/V200/Version20230215072918.php +++ b/src/CoreBundle/Migrations/Schema/V200/Version20230215072918.php @@ -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(); } } } diff --git a/src/CoreBundle/Migrations/Schema/V200/Version20240713125400.php b/src/CoreBundle/Migrations/Schema/V200/Version20240713125400.php new file mode 100644 index 0000000000..11533daa04 --- /dev/null +++ b/src/CoreBundle/Migrations/Schema/V200/Version20240713125400.php @@ -0,0 +1,66 @@ +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']] + ); + } + } + } +} diff --git a/src/CoreBundle/Repository/GroupRepository.php b/src/CoreBundle/Repository/GroupRepository.php index 0012b7a0d1..aed34a2763 100644 --- a/src/CoreBundle/Repository/GroupRepository.php +++ b/src/CoreBundle/Repository/GroupRepository.php @@ -66,7 +66,7 @@ class GroupRepository extends ServiceEntityRepository [ 'code' => 'RRHH', 'title' => 'Human resources manager', - 'roles' => ['ROLE_RRHH'], + 'roles' => ['ROLE_HR'], ], [ 'code' => 'SESSION_MANAGER', diff --git a/src/CoreBundle/Repository/SessionRepository.php b/src/CoreBundle/Repository/SessionRepository.php index 3be808cb0f..4b99057cff 100644 --- a/src/CoreBundle/Repository/SessionRepository.php +++ b/src/CoreBundle/Repository/SessionRepository.php @@ -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); } diff --git a/src/CoreBundle/ServiceHelper/TicketProjectHelper.php b/src/CoreBundle/ServiceHelper/TicketProjectHelper.php index 98e46b844e..83e7ec083f 100644 --- a/src/CoreBundle/ServiceHelper/TicketProjectHelper.php +++ b/src/CoreBundle/ServiceHelper/TicketProjectHelper.php @@ -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 ]; diff --git a/src/CoreBundle/State/CategorizedExerciseResultStateProvider.php b/src/CoreBundle/State/CategorizedExerciseResultStateProvider.php index 659c5bb345..d3e1c75357 100644 --- a/src/CoreBundle/State/CategorizedExerciseResultStateProvider.php +++ b/src/CoreBundle/State/CategorizedExerciseResultStateProvider.php @@ -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); diff --git a/src/LtiBundle/Controller/CourseController.php b/src/LtiBundle/Controller/CourseController.php index e2ed25aca0..f165cba7fd 100644 --- a/src/LtiBundle/Controller/CourseController.php +++ b/src/LtiBundle/Controller/CourseController.php @@ -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)) { diff --git a/src/LtiBundle/Util/Utils.php b/src/LtiBundle/Util/Utils.php index 155216f8cb..da9adcd7ea 100644 --- a/src/LtiBundle/Util/Utils.php +++ b/src/LtiBundle/Util/Utils.php @@ -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'; } diff --git a/tests/CoreBundle/Repository/Node/UserRepositoryTest.php b/tests/CoreBundle/Repository/Node/UserRepositoryTest.php index 13ede1792e..bcc26ec6df 100644 --- a/tests/CoreBundle/Repository/Node/UserRepositoryTest.php +++ b/tests/CoreBundle/Repository/Node/UserRepositoryTest.php @@ -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)); diff --git a/tests/CoreBundle/Repository/SessionRepositoryTest.php b/tests/CoreBundle/Repository/SessionRepositoryTest.php index f99b91c226..2600275b8e 100644 --- a/tests/CoreBundle/Repository/SessionRepositoryTest.php +++ b/tests/CoreBundle/Repository/SessionRepositoryTest.php @@ -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. diff --git a/translations/messages.de.po b/translations/messages.de.po index dac2f0991c..2c03c8e6fe 100644 --- a/translations/messages.de.po +++ b/translations/messages.de.po @@ -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" diff --git a/translations/messages.en.po b/translations/messages.en.po index efe751f43e..e150df8c7d 100644 --- a/translations/messages.en.po +++ b/translations/messages.en.po @@ -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" diff --git a/translations/messages.es.po b/translations/messages.es.po index aeb8a8b5b6..b1d3870cca 100644 --- a/translations/messages.es.po +++ b/translations/messages.es.po @@ -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" diff --git a/translations/messages.fr.po b/translations/messages.fr.po index f517a4ad6c..4f094d1c5d 100644 --- a/translations/messages.fr.po +++ b/translations/messages.fr.po @@ -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" diff --git a/translations/messages.pot b/translations/messages.pot index a635a8e3dd..af160fe315 100644 --- a/translations/messages.pot +++ b/translations/messages.pot @@ -27516,6 +27516,9 @@ msgstr "" msgid "Certificate Footer" msgstr "" +msgid "Chamilo LMS" +msgstr "" + msgid "Select date .." msgstr ""