fix - profile in install
This commit is contained in:
+16
-1
@@ -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' => [
|
||||
|
||||
Reference in New Issue
Block a user