Users should automatically have access to their own channel
This commit is contained in:
parent
b97913a24e
commit
66ed47b35b
@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
class ModeratorAction extends Model
|
class ModeratorAction extends Model
|
||||||
{
|
{
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
@ -43,7 +42,7 @@ public function formatted() : string
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Timeout/untimeout
|
* Timeouts
|
||||||
*/
|
*/
|
||||||
if ($cmd === 'timeout') {
|
if ($cmd === 'timeout') {
|
||||||
$duration = $this->timeout_duration;
|
$duration = $this->timeout_duration;
|
||||||
|
@ -43,7 +43,9 @@ class User extends Authenticatable
|
|||||||
*
|
*
|
||||||
* @var array<string, string>
|
* @var array<string, string>
|
||||||
*/
|
*/
|
||||||
protected $casts = [];
|
protected $casts = [
|
||||||
|
'is_admin' => 'boolean',
|
||||||
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the channel permissions for the user.
|
* Get the channel permissions for the user.
|
||||||
@ -86,6 +88,8 @@ public function getTraceChannels() : Collection
|
|||||||
|
|
||||||
if (! $this->isAdmin()) {
|
if (! $this->isAdmin()) {
|
||||||
$permissionChannelIds = $this->channelPermissions()->pluck('channel_provider_id')->toArray();
|
$permissionChannelIds = $this->channelPermissions()->pluck('channel_provider_id')->toArray();
|
||||||
|
$permissionChannelIds[] = $this->provider_id;
|
||||||
|
|
||||||
$channels = $channels->whereIn('channel_id', $permissionChannelIds);
|
$channels = $channels->whereIn('channel_id', $permissionChannelIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,6 +103,6 @@ public function getTraceChannels() : Collection
|
|||||||
*/
|
*/
|
||||||
public function isAdmin() : bool
|
public function isAdmin() : bool
|
||||||
{
|
{
|
||||||
return $this->is_admin === 1;
|
return $this->is_admin;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user