Skip to content
This repository was archived by the owner on Jul 6, 2021. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions inc/profile.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ function createAccess($ID) {
$this->add(['profiles_id' => $ID]);
}

/**
*
* @param integer $ID Id of the profile to update
*/
static function createFirstAccess($ID) {
$profileRight = new ProfileRight();

Expand All @@ -60,6 +64,17 @@ static function createFirstAccess($ID) {

//Add right to the current session
$_SESSION['glpiactiveprofile'][self::RIGHT_SIMCARD_SIMCARD] = $firstAccessRights[self::RIGHT_SIMCARD_SIMCARD];

// add plugin's itemtype in helpdesk itemtypes for the current profile
$profile = new Profile();
$profile->getFromDB($ID);
$helpdeskItemtypes = json_decode($profile->fields['helpdesk_item_type'], true);
$helpdeskItemtypes[] = 'PluginSimcardSimcard';
$profile->update(array(
'id' => $profile->getID(),
'helpdesk_item_type' => json_encode($helpdeskItemtypes),
));
// Immediately apply the new helpdesk itemtype to the current profile
$_SESSION['glpiactiveprofile']['helpdesk_item_type'][] = 'PluginSimcardSimcard';
}

Expand Down