Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ https://github.com/aiiddqd/casetracker

![collage](docs/files/collage.jpg)

![collage](docs/files/collage.jpg)

# Core Concepts
- inspired by GitHub Issues Tracker, Notion Tables, Jira and FreeScout
- Use Adaptive Case Managment as key ideas
Expand Down
3 changes: 3 additions & 0 deletions code/app/AppPanelProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ public function panel(Panel $panel): Panel
Widgets\AccountWidget::class,
Widgets\FilamentInfoWidget::class,
])
->plugins([
\BezhanSalleh\FilamentShield\FilamentShieldPlugin::make()
])
->middleware([
EncryptCookies::class,
AddQueuedCookiesToResponse::class,
Expand Down
4 changes: 3 additions & 1 deletion code/app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@
use Illuminate\Notifications\Notifiable;
use Laravel\Sanctum\HasApiTokens;
use Filament\Models\Contracts\FilamentUser;
use Filament\Panel;
use Spatie\Permission\Traits\HasRoles;



class User extends Authenticatable
{
use HasApiTokens, HasFactory, Notifiable;
use HasRoles;

/**
* The attributes that are mass assignable.
Expand Down
108 changes: 108 additions & 0 deletions code/app/Policies/GroupPolicy.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
<?php

namespace App\Policies;

use App\Models\User;
use App\Models\Group;
use Illuminate\Auth\Access\HandlesAuthorization;

class GroupPolicy
{
use HandlesAuthorization;

/**
* Determine whether the user can view any models.
*/
public function viewAny(User $user): bool
{
return $user->can('view_any_group');
}

/**
* Determine whether the user can view the model.
*/
public function view(User $user, Group $group): bool
{
return $user->can('view_group');
}

/**
* Determine whether the user can create models.
*/
public function create(User $user): bool
{
return $user->can('create_group');
}

/**
* Determine whether the user can update the model.
*/
public function update(User $user, Group $group): bool
{
return $user->can('update_group');
}

/**
* Determine whether the user can delete the model.
*/
public function delete(User $user, Group $group): bool
{
return $user->can('delete_group');
}

/**
* Determine whether the user can bulk delete.
*/
public function deleteAny(User $user): bool
{
return $user->can('delete_any_group');
}

/**
* Determine whether the user can permanently delete.
*/
public function forceDelete(User $user, Group $group): bool
{
return $user->can('force_delete_group');
}

/**
* Determine whether the user can permanently bulk delete.
*/
public function forceDeleteAny(User $user): bool
{
return $user->can('force_delete_any_group');
}

/**
* Determine whether the user can restore.
*/
public function restore(User $user, Group $group): bool
{
return $user->can('restore_group');
}

/**
* Determine whether the user can bulk restore.
*/
public function restoreAny(User $user): bool
{
return $user->can('restore_any_group');
}

/**
* Determine whether the user can replicate.
*/
public function replicate(User $user, Group $group): bool
{
return $user->can('replicate_group');
}

/**
* Determine whether the user can reorder.
*/
public function reorder(User $user): bool
{
return $user->can('reorder_group');
}
}
108 changes: 108 additions & 0 deletions code/app/Policies/IssuePolicy.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
<?php

namespace App\Policies;

use App\Models\User;
use App\Models\Issue;
use Illuminate\Auth\Access\HandlesAuthorization;

class IssuePolicy
{
use HandlesAuthorization;

/**
* Determine whether the user can view any models.
*/
public function viewAny(User $user): bool
{
return $user->can('view_any_issue');
}

/**
* Determine whether the user can view the model.
*/
public function view(User $user, Issue $issue): bool
{
return $user->can('view_issue');
}

/**
* Determine whether the user can create models.
*/
public function create(User $user): bool
{
return $user->can('create_issue');
}

/**
* Determine whether the user can update the model.
*/
public function update(User $user, Issue $issue): bool
{
return $user->can('update_issue');
}

/**
* Determine whether the user can delete the model.
*/
public function delete(User $user, Issue $issue): bool
{
return $user->can('delete_issue');
}

/**
* Determine whether the user can bulk delete.
*/
public function deleteAny(User $user): bool
{
return $user->can('delete_any_issue');
}

/**
* Determine whether the user can permanently delete.
*/
public function forceDelete(User $user, Issue $issue): bool
{
return $user->can('force_delete_issue');
}

/**
* Determine whether the user can permanently bulk delete.
*/
public function forceDeleteAny(User $user): bool
{
return $user->can('force_delete_any_issue');
}

/**
* Determine whether the user can restore.
*/
public function restore(User $user, Issue $issue): bool
{
return $user->can('restore_issue');
}

/**
* Determine whether the user can bulk restore.
*/
public function restoreAny(User $user): bool
{
return $user->can('restore_any_issue');
}

/**
* Determine whether the user can replicate.
*/
public function replicate(User $user, Issue $issue): bool
{
return $user->can('replicate_issue');
}

/**
* Determine whether the user can reorder.
*/
public function reorder(User $user): bool
{
return $user->can('reorder_issue');
}
}
108 changes: 108 additions & 0 deletions code/app/Policies/RolePolicy.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
<?php

namespace App\Policies;

use App\Models\User;
use Spatie\Permission\Models\Role;
use Illuminate\Auth\Access\HandlesAuthorization;

class RolePolicy
{
use HandlesAuthorization;

/**
* Determine whether the user can view any models.
*/
public function viewAny(User $user): bool
{
return $user->can('view_any_role');
}

/**
* Determine whether the user can view the model.
*/
public function view(User $user, Role $role): bool
{
return $user->can('view_role');
}

/**
* Determine whether the user can create models.
*/
public function create(User $user): bool
{
return $user->can('create_role');
}

/**
* Determine whether the user can update the model.
*/
public function update(User $user, Role $role): bool
{
return $user->can('update_role');
}

/**
* Determine whether the user can delete the model.
*/
public function delete(User $user, Role $role): bool
{
return $user->can('delete_role');
}

/**
* Determine whether the user can bulk delete.
*/
public function deleteAny(User $user): bool
{
return $user->can('delete_any_role');
}

/**
* Determine whether the user can permanently delete.
*/
public function forceDelete(User $user, Role $role): bool
{
return $user->can('{{ ForceDelete }}');
}

/**
* Determine whether the user can permanently bulk delete.
*/
public function forceDeleteAny(User $user): bool
{
return $user->can('{{ ForceDeleteAny }}');
}

/**
* Determine whether the user can restore.
*/
public function restore(User $user, Role $role): bool
{
return $user->can('{{ Restore }}');
}

/**
* Determine whether the user can bulk restore.
*/
public function restoreAny(User $user): bool
{
return $user->can('{{ RestoreAny }}');
}

/**
* Determine whether the user can replicate.
*/
public function replicate(User $user, Role $role): bool
{
return $user->can('{{ Replicate }}');
}

/**
* Determine whether the user can reorder.
*/
public function reorder(User $user): bool
{
return $user->can('{{ Reorder }}');
}
}
2 changes: 1 addition & 1 deletion code/app/Resources/GroupResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class GroupResource extends Resource
protected static ?string $model = Group::class;
protected static ?array $types = ['project', 'process', 'misc'];

protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
protected static ?string $navigationIcon = 'heroicon-o-rectangle-group';

protected static ?int $navigationSort = 10;

Expand Down
3 changes: 1 addition & 2 deletions code/app/Resources/IssueResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ public static function form(Form $form) : Form
->columnSpan('full')
->maxLength(255),
Forms\Components\MarkdownEditor::make('description')
->columnSpan('full')
->required(),
->columnSpan('full'),
Forms\Components\Select::make('group_id')
->relationship('group', 'name')

Expand Down
3 changes: 2 additions & 1 deletion code/composer.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
"name": "case-tracker/core",
"version": "0.1.0-alfa2405-1",
"version": "0.1.240525",
"type": "project",
"description": "The skeleton application for the Laravel framework.",
"keywords": ["laravel", "framework"],
"license": "MIT",
"require": {
"php": "^8.1",
"bezhansalleh/filament-shield": "^3.2",
"filament/filament": "^3.2",
"guzzlehttp/guzzle": "^7.2",
"laravel/framework": "^10.10",
Expand Down
Loading