fix - profile in install

This commit is contained in:
mariano
2026-05-27 12:25:40 +02:00
parent 41a8f8dbb4
commit 0bdd5476cb
7 changed files with 56 additions and 9 deletions
+16 -1
View File
@@ -74,6 +74,21 @@ class Profile extends \Profile
if ($profiles_id > 0) {
self::setProfileRights($profiles_id, READ | UPDATE | CREATE | DELETE);
} else {
// CLI installation: no session available.
// Assign full rights to the Super-Admin profile.
global $DB;
$sa_iterator = $DB->request([
'FROM' => 'glpi_profiles',
'WHERE' => [
'name' => 'Super-Admin',
],
'LIMIT' => 1,
]);
foreach ($sa_iterator as $sa_profile) {
$profiles_id = (int) $sa_profile['id'];
self::setProfileRights($profiles_id, READ | UPDATE | CREATE | DELETE);
}
}
global $DB;
@@ -83,7 +98,7 @@ class Profile extends \Profile
]);
foreach ($all_profiles as $profile) {
if ($profile['id'] !== $profiles_id) {
if ((int) $profile['id'] !== $profiles_id) {
$existing = $DB->request([
'FROM' => 'glpi_profilerights',
'WHERE' => [