mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-14 04:20:49 +08:00
improve announce update torrent visible
This commit is contained in:
@@ -4,6 +4,7 @@ namespace App\Console\Commands;
|
||||
|
||||
use App\Events\TorrentUpdated;
|
||||
use App\Http\Resources\TagResource;
|
||||
use App\Models\Ability;
|
||||
use App\Models\Attendance;
|
||||
use App\Models\Exam;
|
||||
use App\Models\ExamProgress;
|
||||
@@ -11,6 +12,7 @@ use App\Models\ExamUser;
|
||||
use App\Models\HitAndRun;
|
||||
use App\Models\Medal;
|
||||
use App\Models\Peer;
|
||||
use App\Models\Role;
|
||||
use App\Models\SearchBox;
|
||||
use App\Models\Snatch;
|
||||
use App\Models\Tag;
|
||||
@@ -44,6 +46,7 @@ use NexusPlugin\PostLike\PostLikeRepository;
|
||||
use NexusPlugin\StickyPromotion\Models\StickyPromotion;
|
||||
use NexusPlugin\StickyPromotion\Models\StickyPromotionParticipator;
|
||||
use Rhilip\Bencode\Bencode;
|
||||
use Silber\Bouncer\Bouncer;
|
||||
|
||||
class Test extends Command
|
||||
{
|
||||
@@ -78,8 +81,7 @@ class Test extends Command
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$r = NexusDB::cache_get('ssbb');
|
||||
dd($r);
|
||||
Ability::initDefaults();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ class TorrentResource extends Resource
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
$showApproval = Setting::get('torrent.approval_status_none_visible') == 'no';
|
||||
$showApproval = Setting::get('torrent.approval_status_none_visible') == 'no' || Setting::get('torrent.approval_status_icon_enabled') == 'yes';
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('id')->sortable(),
|
||||
|
||||
@@ -55,7 +55,7 @@ class UserResource extends Resource
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('id')->sortable(),
|
||||
Tables\Columns\TextColumn::make('id')->sortable()->searchable(),
|
||||
Tables\Columns\TextColumn::make('username')->searchable()->label(__("label.user.username")),
|
||||
Tables\Columns\TextColumn::make('email')->searchable()->label(__("label.email")),
|
||||
Tables\Columns\TextColumn::make('class')->label('Class')
|
||||
|
||||
@@ -17,11 +17,10 @@ use Laravel\Sanctum\HasApiTokens;
|
||||
use Nexus\Database\NexusDB;
|
||||
use Filament\Models\Contracts\FilamentUser;
|
||||
use Filament\Models\Contracts\HasName;
|
||||
use Spatie\Permission\Traits\HasRoles;
|
||||
|
||||
class User extends Authenticatable implements FilamentUser, HasName
|
||||
{
|
||||
use HasFactory, Notifiable, HasApiTokens, HasRoles;
|
||||
use HasFactory, Notifiable, HasApiTokens;
|
||||
|
||||
public $timestamps = false;
|
||||
|
||||
@@ -91,6 +90,7 @@ class User extends Authenticatable implements FilamentUser, HasName
|
||||
'invites' => '邀请',
|
||||
];
|
||||
|
||||
|
||||
public function getClassTextAttribute(): string
|
||||
{
|
||||
if (!isset(self::$classes[$this->class]['text'])) {
|
||||
|
||||
@@ -94,7 +94,7 @@ class TorrentPolicy extends BasePolicy
|
||||
|
||||
private function can(User $user)
|
||||
{
|
||||
if ($user->class >= User::CLASS_SYSOP) {
|
||||
if ($user->class >= User::CLASS_ADMINISTRATOR) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -19,7 +19,7 @@ class TorrentStatePolicy extends BasePolicy
|
||||
*/
|
||||
public function viewAny(User $user)
|
||||
{
|
||||
//
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -31,7 +31,7 @@ class TorrentStatePolicy extends BasePolicy
|
||||
*/
|
||||
public function view(User $user, TorrentState $torrentState)
|
||||
{
|
||||
//
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -42,7 +42,7 @@ class TorrentStatePolicy extends BasePolicy
|
||||
*/
|
||||
public function create(User $user)
|
||||
{
|
||||
//
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -54,7 +54,7 @@ class TorrentStatePolicy extends BasePolicy
|
||||
*/
|
||||
public function update(User $user, TorrentState $torrentState)
|
||||
{
|
||||
//
|
||||
return $this->can($user);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -66,7 +66,7 @@ class TorrentStatePolicy extends BasePolicy
|
||||
*/
|
||||
public function delete(User $user, TorrentState $torrentState)
|
||||
{
|
||||
//
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -78,7 +78,7 @@ class TorrentStatePolicy extends BasePolicy
|
||||
*/
|
||||
public function restore(User $user, TorrentState $torrentState)
|
||||
{
|
||||
//
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -92,4 +92,12 @@ class TorrentStatePolicy extends BasePolicy
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
private function can(User $user)
|
||||
{
|
||||
if ($user->class >= User::CLASS_ADMINISTRATOR) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ class UserPolicy extends BasePolicy
|
||||
|
||||
private function can(User $user)
|
||||
{
|
||||
if ($user->class >= User::CLASS_SYSOP) {
|
||||
if ($user->class >= User::CLASS_ADMINISTRATOR) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -4,6 +4,8 @@ namespace App\Providers;
|
||||
|
||||
use App\Auth\NexusWebGuard;
|
||||
use App\Auth\NexusWebUserProvider;
|
||||
use App\Models\Permission;
|
||||
use App\Models\Role;
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -36,8 +38,12 @@ class AuthServiceProvider extends ServiceProvider
|
||||
|
||||
Auth::extend('nexus-web', function ($app, $name, array $config) {
|
||||
// 返回 Illuminate\Contracts\Auth\Guard 的实例 ...
|
||||
return new NexusWebGuard($app->make('request'), new NexusWebUserProvider());
|
||||
return new NexusWebGuard($app['request'], new NexusWebUserProvider());
|
||||
});
|
||||
|
||||
// Bouncer::useAbilityModel(Permission::class);
|
||||
// Bouncer::useRoleModel(Role::class);
|
||||
// Bouncer::useUserModel(User::class);
|
||||
}
|
||||
|
||||
private function getUserByCookie($cookie)
|
||||
|
||||
Reference in New Issue
Block a user