Skip to content
This repository has been archived by the owner on Jul 12, 2022. It is now read-only.

Commit

Permalink
Merge pull request #70 from herpaderpaldent/development
Browse files Browse the repository at this point in the history
Version 1.6.5 - Notification granularity

This update takes advantage on the most recent seat-notification update (>1.1.0). Notifications may now be selected individually:
* SeatGroup Sync Event: Dispatched whenever a user group is attached or detached from a role
* SeATGroup Error Event: Dispatched whenever an error happens and laravel log should be investigated
* Missing Refresh Token Event: Dispatched every time SeAT Group finds a refresh token to be missing. Please note you can stop SeAT to notify you about a certain user that might have left your corporation or sold his character by deactivating the user (link is provided inside the notification to do so).

Furthermore:
* Fixed smaller typos
* Assure `eveseat/web ~3.0.14` is present
* Changed licence to MIT
  • Loading branch information
herpaderpaldent authored Feb 5, 2019
2 parents 1ef37a2 + 22f2027 commit 8c16a1b
Show file tree
Hide file tree
Showing 33 changed files with 1,098 additions and 250 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# Version 1.6.5
This update takes advantage on the most recent seat-notification update (>1.1.0). Notifications may now be selected individually:
* SeatGroup Sync Event: Dispatched whenever a user group is attached or detached from a role
* SeATGroup Error Event: Dispatched whenever an error happens and laravel log should be investigated
* Missing Refresh Token Event: Dispatched every time SeAT Group finds a refresh token to be missing. Please note you can stop SeAT to notify you about a certain user that might have left your corporation or sold his character by deactivating the user (link is provided inside the notification to do so).

Furthermore:
* Fixed smaller typos
* Assure `eveseat/web ~3.0.14` is present
* Changed licence to MIT

# Version 1.6.4
* Include new seat plugin service pattern.
* Use proper form-id to subscribe to notifications
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"name": "herpaderpaldent/seat-groups",
"description": "A module for SeAT that adds the ability of using goups to assign roles to user that are in a group",
"description": "A module for SeAT that adds the ability of using groups to assign roles to user that are in a group",
"type": "seat-plugin",
"require": {
"php": ">=7.1",
"laravel/framework": "5.5.*",
"eveseat/web": ">=3.0.10"
"eveseat/web": "~3.0.14"
},
"require-dev": {
"orchestra/testbench": "3.5.*",
"orchestra/database" : "~3.5",
"phpunit/phpunit": "~6.0"
},
"license": "GPL-2.0-only",
"license": "MIT",
"authors": [
{
"name": "Felix Huber",
Expand Down
116 changes: 116 additions & 0 deletions src/Http/Controllers/Notifications/MissingRefreshTokenController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
<?php
/**
* MIT License.
*
* Copyright (c) 2019. Felix Huber
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

namespace Herpaderpaldent\Seat\SeatGroups\Http\Controllers\Notifications;

use Herpaderpaldent\Seat\SeatNotifications\Http\Controllers\BaseNotificationController;

class MissingRefreshTokenController extends BaseNotificationController
{
public function getNotification() : string
{
return 'seatgroups::notification.missing_refreshtoken.notification';
}

public function getPrivateView() : string
{
return 'seatgroups::notification.missing_refreshtoken.private';
}

public function getChannelView() : string
{

return 'seatgroups::notification.missing_refreshtoken.channel';
}

public function subscribeDm($via)
{
$channel_id = $this->getPrivateChannel($via);

if(is_null($channel_id))
return redirect()->back()->with('error', 'Something went wrong, please assure you have setup your personal delivery channel correctly.');

if($this->subscribeToChannel($channel_id, $via, 'missing_refreshtoken'))
return redirect()->back()->with('success', 'You are going to be notified about missing refresh_tokens every time SeAT Group Sync runs.');

return redirect()->back()->with('error', 'Something went wrong, please assure you have setup your personal delivery channel correctly.');
}

public function unsubscribeDm($via)
{
$channel_id = $this->getPrivateChannel($via);

if(is_null($channel_id))
return redirect()->back()->with('error', 'Something went wrong, please assure you have setup your personal delivery channel correctly.');

if($this->unsubscribeFromChannel($channel_id, 'missing_refreshtoken'))
return redirect()->back()->with('success', 'You are no longer going to be notified about missing_refreshtoken events.');

return redirect()->back()->with('error', 'Something went wrong, please assure you have setup your personal delivery channel correctly.');
}

public function subscribeChannel()
{

$via = (string) request('via');
$channel_id = (string) request('channel_id');

if(is_null($channel_id) || is_null($channel_id))
return abort(500);

if($this->subscribeToChannel($channel_id, $via, 'missing_refreshtoken', true))
return redirect()->back()->with('success', 'This channel is going to be notified about missing refresh_tokens every time SeAT Group Sync runs.');

return abort(500);
}

public function unsubscribeChannel($channel)
{
$channel_id = $this->getChannelChannelId($channel, 'missing_refreshtoken');

if(is_null($channel_id))
return abort(500);

if($this->unsubscribeFromChannel($channel_id, 'missing_refreshtoken'))
return redirect()->back()->with('success', 'Channel will no longer receive missing_refreshtoken notifications.');

return abort(500);
}

public function isSubscribed($view, $channel)
{
return $this->getSubscribtionStatus($channel, $view, 'missing_refreshtoken');
}

public function isDisabledButton($view, $channel) : bool
{
return $this->isDisabled($channel, $view, 'seatgroups.create');
}

public function isAvailable() : bool
{
return $this->hasPermission('seatgroups.create');
}
}
116 changes: 116 additions & 0 deletions src/Http/Controllers/Notifications/SeatGroupErrorController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
<?php
/**
* MIT License.
*
* Copyright (c) 2019. Felix Huber
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

namespace Herpaderpaldent\Seat\SeatGroups\Http\Controllers\Notifications;

use Herpaderpaldent\Seat\SeatNotifications\Http\Controllers\BaseNotificationController;

class SeatGroupErrorController extends BaseNotificationController
{
public function getNotification() : string
{
return 'seatgroups::notification.seatgroup_error.notification';
}

public function getPrivateView() : string
{
return 'seatgroups::notification.seatgroup_error.private';
}

public function getChannelView() : string
{

return 'seatgroups::notification.seatgroup_error.channel';
}

public function subscribeDm($via)
{
$channel_id = $this->getPrivateChannel($via);

if(is_null($channel_id))
return redirect()->back()->with('error', 'Something went wrong, please assure you have setup your personal delivery channel correctly.');

if($this->subscribeToChannel($channel_id, $via, 'seatgroup_error'))
return redirect()->back()->with('success', 'You are going to be notified about sync error events from SeAT Groups.');

return redirect()->back()->with('error', 'Something went wrong, please assure you have setup your personal delivery channel correctly.');
}

public function unsubscribeDm($via)
{
$channel_id = $this->getPrivateChannel($via);

if(is_null($channel_id))
return redirect()->back()->with('error', 'Something went wrong, please assure you have setup your personal delivery channel correctly.');

if($this->unsubscribeFromChannel($channel_id, 'seatgroup_error'))
return redirect()->back()->with('success', 'You are no longer going to be notified about seatgroup_error events.');

return redirect()->back()->with('error', 'Something went wrong, please assure you have setup your personal delivery channel correctly.');
}

public function subscribeChannel()
{

$via = (string) request('via');
$channel_id = (string) request('channel_id');

if(is_null($channel_id) || is_null($channel_id))
return abort(500);

if($this->subscribeToChannel($channel_id, $via, 'seatgroup_error', true))
return redirect()->back()->with('success', 'Channel will receive seatgroup_error notifications from now on.');

return abort(500);
}

public function unsubscribeChannel($channel)
{
$channel_id = $this->getChannelChannelId($channel, 'seatgroup_error');

if(is_null($channel_id))
return abort(500);

if($this->unsubscribeFromChannel($channel_id, 'seatgroup_error'))
return redirect()->back()->with('success', 'Channel will no longer receive seatgroup_error notifications.');

return abort(500);
}

public function isSubscribed($view, $channel)
{
return $this->getSubscribtionStatus($channel, $view, 'seatgroup_error');
}

public function isDisabledButton($view, $channel) : bool
{
return $this->isDisabled($channel, $view, 'seatgroups.create');
}

public function isAvailable() : bool
{
return $this->hasPermission('seatgroups.create');
}
}
93 changes: 93 additions & 0 deletions src/Http/Controllers/Notifications/SeatGroupSyncController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<?php

namespace Herpaderpaldent\Seat\SeatGroups\Http\Controllers\Notifications;

use Herpaderpaldent\Seat\SeatNotifications\Http\Controllers\BaseNotificationController;

class SeatGroupSyncController extends BaseNotificationController
{
public function getNotification() : string
{
return 'seatgroups::notification.seatgroup_sync.notification';
}

public function getPrivateView() : string
{
return 'seatgroups::notification.seatgroup_sync.private';
}

public function getChannelView() : string
{

return 'seatgroups::notification.seatgroup_sync.channel';
}

public function subscribeDm($via)
{
$channel_id = $this->getPrivateChannel($via);

if(is_null($channel_id))
return redirect()->back()->with('error', 'Something went wrong, please assure you have setup your personal delivery channel correctly.');

if($this->subscribeToChannel($channel_id, $via, 'seatgroup_sync'))
return redirect()->back()->with('success', 'You are going to be notified about sync events from SeAT Groups.');

return redirect()->back()->with('error', 'Something went wrong, please assure you have setup your personal delivery channel correctly.');
}

public function unsubscribeDm($via)
{
$channel_id = $this->getPrivateChannel($via);

if(is_null($channel_id))
return redirect()->back()->with('error', 'Something went wrong, please assure you have setup your personal delivery channel correctly.');

if($this->unsubscribeFromChannel($channel_id, 'seatgroup_sync'))
return redirect()->back()->with('success', 'You are no longer going to be notified about deleted seatgroup_sync events.');

return redirect()->back()->with('error', 'Something went wrong, please assure you have setup your personal delivery channel correctly.');
}

public function subscribeChannel()
{

$via = (string) request('via');
$channel_id = (string) request('channel_id');

if(is_null($channel_id) || is_null($channel_id))
return abort(500);

if($this->subscribeToChannel($channel_id, $via, 'seatgroup_sync', true))
return redirect()->back()->with('success', 'Channel will receive seatgroup_sync notifications from now on.');

return abort(500);
}

public function unsubscribeChannel($channel)
{
$channel_id = $this->getChannelChannelId($channel, 'seatgroup_sync');

if(is_null($channel_id))
return abort(500);

if($this->unsubscribeFromChannel($channel_id, 'seatgroup_sync'))
return redirect()->back()->with('success', 'Channel will no longer receive seatgroup_sync notifications.');

return abort(500);
}

public function isSubscribed($view, $channel)
{
return $this->getSubscribtionStatus($channel, $view, 'seatgroup_sync');
}

public function isDisabledButton($view, $channel) : bool
{
return $this->isDisabled($channel, $view, 'seatgroups.create');
}

public function isAvailable() : bool
{
return $this->hasPermission('seatgroups.create');
}
}
Loading

0 comments on commit 8c16a1b

Please sign in to comment.