Merge remote-tracking branch 'origin/develop'
This commit is contained in:
commit
3bf33aa682
4 changed files with 29 additions and 25 deletions
|
@ -288,7 +288,6 @@ class UsersController extends Controller
|
||||||
$user->password = bcrypt($request->input('password'));
|
$user->password = bcrypt($request->input('password'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Update the location of any assets checked out to this user
|
// Update the location of any assets checked out to this user
|
||||||
Asset::where('assigned_type', User::class)
|
Asset::where('assigned_type', User::class)
|
||||||
->where('assigned_to', $user->id)
|
->where('assigned_to', $user->id)
|
||||||
|
@ -296,7 +295,6 @@ class UsersController extends Controller
|
||||||
|
|
||||||
$permissions_array = $request->input('permission');
|
$permissions_array = $request->input('permission');
|
||||||
|
|
||||||
|
|
||||||
// Strip out the superuser permission if the user isn't a superadmin
|
// Strip out the superuser permission if the user isn't a superadmin
|
||||||
if (! auth()->user()->isSuperUser()) {
|
if (! auth()->user()->isSuperUser()) {
|
||||||
unset($permissions_array['superuser']);
|
unset($permissions_array['superuser']);
|
||||||
|
|
|
@ -31,6 +31,7 @@ use Illuminate\Support\Facades\Mail;
|
||||||
use Illuminate\Support\Facades\Notification;
|
use Illuminate\Support\Facades\Notification;
|
||||||
use Exception;
|
use Exception;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
use Osama\LaravelTeamsNotification\TeamsNotification;
|
use Osama\LaravelTeamsNotification\TeamsNotification;
|
||||||
|
|
||||||
class CheckoutableListener
|
class CheckoutableListener
|
||||||
|
@ -94,7 +95,7 @@ class CheckoutableListener
|
||||||
// Send Webhook notification
|
// Send Webhook notification
|
||||||
try{
|
try{
|
||||||
if ($this->shouldSendWebhookNotification()) {
|
if ($this->shouldSendWebhookNotification()) {
|
||||||
if (Setting::getSettings()->webhook_selected === 'microsoft') {
|
if ($this->newMicrosoftTeamsWebhookEnabled()) {
|
||||||
$message = $this->getCheckoutNotification($event)->toMicrosoftTeams();
|
$message = $this->getCheckoutNotification($event)->toMicrosoftTeams();
|
||||||
$notification = new TeamsNotification(Setting::getSettings()->webhook_endpoint);
|
$notification = new TeamsNotification(Setting::getSettings()->webhook_endpoint);
|
||||||
$notification->success()->sendMessage($message[0], $message[1]); // Send the message to Microsoft Teams
|
$notification->success()->sendMessage($message[0], $message[1]); // Send the message to Microsoft Teams
|
||||||
|
@ -176,7 +177,7 @@ class CheckoutableListener
|
||||||
// Send Webhook notification
|
// Send Webhook notification
|
||||||
try {
|
try {
|
||||||
if ($this->shouldSendWebhookNotification()) {
|
if ($this->shouldSendWebhookNotification()) {
|
||||||
if (Setting::getSettings()->webhook_selected === 'microsoft') {
|
if ($this->newMicrosoftTeamsWebhookEnabled()) {
|
||||||
$message = $this->getCheckinNotification($event)->toMicrosoftTeams();
|
$message = $this->getCheckinNotification($event)->toMicrosoftTeams();
|
||||||
$notification = new TeamsNotification(Setting::getSettings()->webhook_endpoint);
|
$notification = new TeamsNotification(Setting::getSettings()->webhook_endpoint);
|
||||||
$notification->success()->sendMessage($message[0], $message[1]); // Send the message to Microsoft Teams
|
$notification->success()->sendMessage($message[0], $message[1]); // Send the message to Microsoft Teams
|
||||||
|
@ -345,4 +346,9 @@ class CheckoutableListener
|
||||||
}
|
}
|
||||||
return (method_exists($event->checkoutable, 'checkin_email') && $event->checkoutable->checkin_email());
|
return (method_exists($event->checkoutable, 'checkin_email') && $event->checkoutable->checkin_email());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function newMicrosoftTeamsWebhookEnabled(): bool
|
||||||
|
{
|
||||||
|
return Setting::getSettings()->webhook_selected === 'microsoft' && Str::contains(Setting::getSettings()->webhook_endpoint, 'workflows');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,10 +114,9 @@ class SlackSettingsForm extends Component
|
||||||
$this->webhook_channel = '#NA';
|
$this->webhook_channel = '#NA';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public function updatedwebhookEndpoint() {
|
|
||||||
$this->teams_webhook_deprecated = !Str::contains($this->webhook_endpoint, 'workflows');
|
public function updatedwebhookEndpoint()
|
||||||
}
|
{
|
||||||
public function updatedwebhookEndpoint() {
|
|
||||||
$this->teams_webhook_deprecated = !Str::contains($this->webhook_endpoint, 'workflows');
|
$this->teams_webhook_deprecated = !Str::contains($this->webhook_endpoint, 'workflows');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -111,7 +111,8 @@ class CheckoutAssetNotification extends Notification
|
||||||
->content($note);
|
->content($note);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
public function toMicrosoftTeams() : array
|
|
||||||
|
public function toMicrosoftTeams()
|
||||||
{
|
{
|
||||||
$target = $this->target;
|
$target = $this->target;
|
||||||
$admin = $this->admin;
|
$admin = $this->admin;
|
||||||
|
|
Loading…
Add table
Reference in a new issue