Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
snipe committed Nov 13, 2024
2 parents 9eed6cd + c012bf0 commit e38c213
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
3 changes: 3 additions & 0 deletions app/Console/Commands/LdapSync.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace App\Console\Commands;

use App\Models\Asset;
use App\Models\Department;
use App\Models\Group;
use Illuminate\Console\Command;
Expand Down Expand Up @@ -418,6 +419,8 @@ public function handle()
if ($item['createorupdate'] === 'created' && $ldap_default_group) {
$user->groups()->attach($ldap_default_group);
}
//updates assets location based on user's location
Asset::where('assigned_to', '=', $user->id)->update(['location_id' => $user->location_id]);

} else {
foreach ($user->getErrors()->getMessages() as $key => $err) {
Expand Down
10 changes: 8 additions & 2 deletions app/Listeners/CheckoutableListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,14 @@ public function onCheckedIn($event)
// Send Webhook notification
try {
if ($this->shouldSendWebhookNotification()) {
Notification::route(Setting::getSettings()->webhook_selected, Setting::getSettings()->webhook_endpoint)
->notify($this->getCheckinNotification($event));
if (Setting::getSettings()->webhook_selected === 'microsoft') {
$message = $this->getCheckinNotification($event)->toMicrosoftTeams();
$notification = new TeamsNotification(Setting::getSettings()->webhook_endpoint);
$notification->success()->sendMessage($message[0], $message[1]); // Send the message to Microsoft Teams
} else {
Notification::route(Setting::getSettings()->webhook_selected, Setting::getSettings()->webhook_endpoint)
->notify($this->getCheckinNotification($event));
}
}
} catch (ClientException $e) {
Log::warning("Exception caught during checkin notification: " . $e->getMessage());
Expand Down
4 changes: 4 additions & 0 deletions app/Livewire/SlackSettingsForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ public function updatedWebhookSelected() {
if($this->webhook_selected == 'microsoft' || $this->webhook_selected == 'google'){
$this->webhook_channel = '#NA';
}

}
public function updatedwebhookEndpoint() {
$this->teams_webhook_deprecated = !Str::contains($this->webhook_endpoint, 'workflows');
}

private function isButtonDisabled() {
Expand Down

0 comments on commit e38c213

Please sign in to comment.