From edcb21487dfec8104478d38656ffd8c3f1be8f57 Mon Sep 17 00:00:00 2001 From: Denis40-prog Date: Sat, 16 Aug 2025 16:47:14 +0200 Subject: [PATCH 1/2] =?UTF-8?q?[ADD]=20suppression=20sur=20les=20diff?= =?UTF-8?q?=C3=A9rens=20objets?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PERMISSIONS_SUPPRESSION.md | 96 +++++++ app/Livewire/CommentComponent.php | 32 +++ app/Livewire/Dashboard.php | 20 +- app/Livewire/ProjectComponent.php | 18 ++ app/Livewire/TaskComponent.php | 36 ++- app/Livewire/TeamComponent.php | 18 ++ app/Providers/AuthServiceProvider.php | 24 ++ app/Traits/HasTeamPermissions.php | 66 +++++ ...mail', '!=', 'root@teamtask.com')->first() | 12 + ...eleteTeam($team) ? 'OUI' : 'NON') . \"n\"" | 258 ++++++++++++++++++ resources/views/livewire/dashboard.blade.php | 58 ++-- .../livewire/project-component.blade.php | 92 ++++--- .../views/livewire/task-component.blade.php | 22 +- .../views/livewire/team-component.blade.php | 10 +- test_permissions.php | 83 ++++++ ...eleteTeam($team) ? 'OUI' : 'NON') . \"n\"" | 258 ++++++++++++++++++ 16 files changed, 1044 insertions(+), 59 deletions(-) create mode 100644 PERMISSIONS_SUPPRESSION.md create mode 100644 er = AppModelsUser::where('email', '!=', 'root@teamtask.com')->first() create mode 100644 "er peut supprimer \303\251quipe: \" . ($user->canDeleteTeam($team) ? 'OUI' : 'NON') . \"n\"" create mode 100644 test_permissions.php create mode 100644 "upprimer \303\251quipe: \" . ($admin->canDeleteTeam($team) ? 'OUI' : 'NON') . \"n\"" diff --git a/PERMISSIONS_SUPPRESSION.md b/PERMISSIONS_SUPPRESSION.md new file mode 100644 index 0000000..4929d51 --- /dev/null +++ b/PERMISSIONS_SUPPRESSION.md @@ -0,0 +1,96 @@ +# 🗑️ Système de Permissions de Suppression + +## ✅ Fonctionnalités Implémentées + +### 🏢 **Équipes** +- **Admin du Site** : Peut supprimer n'importe quelle équipe +- **Admin d'Équipe** : Peut supprimer uniquement son équipe +- **Utilisateur Normal** : Ne peut pas supprimer d'équipes + +**Localisation des boutons :** +- Dashboard : Icône poubelle sur chaque carte d'équipe +- Page équipes dédiée : Bouton "Supprimer" dans la liste + +### 📂 **Projets** +- **Admin du Site** : Peut supprimer n'importe quel projet +- **Admin d'Équipe** : Peut supprimer les projets de son équipe +- **Utilisateur Normal** : Ne peut pas supprimer de projets + +**Localisation des boutons :** +- Page projets : Icône poubelle à côté du titre du projet + +### 📝 **Tâches** +- **Admin du Site** : Peut supprimer n'importe quelle tâche +- **Admin d'Équipe** : Peut supprimer les tâches de son équipe +- **Utilisateur Normal** : Ne peut pas supprimer de tâches + +**Localisation des boutons :** +- Page tâches : Bouton "Supprimer" à côté du bouton "Modifier" + +### 💬 **Commentaires** +- **Admin du Site** : Peut supprimer n'importe quel commentaire +- **Admin d'Équipe** : Peut supprimer les commentaires dans son équipe +- **Utilisateur Normal** : Peut supprimer UNIQUEMENT ses propres commentaires + +**Localisation des boutons :** +- Page tâches : Icône 🗑️ à côté de la date du commentaire + +## 🔧 Architecture Technique + +### Permissions (Trait HasTeamPermissions) +```php +- canDeleteTeam(Team $team) // Admin site OU Admin équipe +- canDeleteProject(Project $project) // Admin site OU Admin équipe du projet +- canDeleteTask(Task $task) // Admin site OU Admin équipe du projet de la tâche +- canDeleteComment(Comment $comment) // Auteur OU Admin site OU Admin équipe +``` + +### Gates (AuthServiceProvider) +```php +- deleteTeam +- deleteProject +- deleteTask +- deleteComment +``` + +### Méthodes Livewire +```php +// Dashboard.php & TeamComponent.php +- deleteTeam(Team $team) + +// ProjectComponent.php +- deleteProject(Project $project) + +// TaskComponent.php +- deleteTask(Task $task) +- deleteComment(Comment $comment) +``` + +## 🛡️ Sécurité + +- ✅ Vérification des permissions via Gates +- ✅ Confirmations JavaScript avant suppression +- ✅ Messages d'erreur si permissions insuffisantes +- ✅ Suppression en cascade via migrations (CASCADE) +- ✅ Gestion des exceptions + +## 🎯 Tests Recommandés + +1. **Connectez-vous en tant qu'admin** (root@teamtask.com) + - Testez la suppression d'équipes, projets, tâches, commentaires + +2. **Créez un admin d'équipe** + - Testez qu'il peut supprimer dans son équipe seulement + +3. **Connectez-vous en utilisateur normal** + - Vérifiez qu'il ne peut supprimer que ses commentaires + +4. **Testez la suppression en cascade** + - Supprimez une équipe → tous ses projets/tâches/commentaires disparaissent + +## 🚨 Messages de Confirmation + +- **Équipe** : "Êtes-vous sûr de vouloir supprimer cette équipe ? Cette action est irréversible et supprimera tous les projets, tâches et commentaires associés." +- **Projet** : "Êtes-vous sûr de vouloir supprimer ce projet ? Cette action est irréversible." +- **Tâche** : "Êtes-vous sûr de vouloir supprimer cette tâche ? Cette action est irréversible." +- **Commentaire** : "Êtes-vous sûr de vouloir supprimer ce commentaire ?" diff --git a/app/Livewire/CommentComponent.php b/app/Livewire/CommentComponent.php index 185b4bf..f86dd4c 100644 --- a/app/Livewire/CommentComponent.php +++ b/app/Livewire/CommentComponent.php @@ -2,10 +2,42 @@ namespace App\Livewire; +use App\Models\Comment; use Livewire\Component; +use Illuminate\Support\Facades\Auth; +use Illuminate\Support\Facades\Gate; class CommentComponent extends Component { + public $comment; + + public function mount(Comment $comment) + { + $this->comment = $comment; + } + + public function deleteComment() + { + // Vérifier les permissions + if (!Gate::allows('deleteComment', $this->comment)) { + $this->dispatch('flash', type: 'error', text: 'Vous n\'avez pas les permissions pour supprimer ce commentaire.'); + return; + } + + try { + $this->comment->delete(); + $this->dispatch('flash', type: 'success', text: 'Le commentaire a été supprimé avec succès.'); + $this->dispatch('commentDeleted'); + } catch (\Exception $e) { + $this->dispatch('flash', type: 'error', text: 'Une erreur est survenue lors de la suppression du commentaire.'); + } + } + + public function canDelete() + { + return Gate::allows('deleteComment', $this->comment); + } + public function render() { return view('livewire.comment-component'); diff --git a/app/Livewire/Dashboard.php b/app/Livewire/Dashboard.php index 1bdbbd1..0392979 100644 --- a/app/Livewire/Dashboard.php +++ b/app/Livewire/Dashboard.php @@ -7,6 +7,7 @@ use App\Models\User; use Livewire\Component; use Illuminate\Support\Facades\Auth; +use Illuminate\Support\Facades\Gate; class Dashboard extends Component { @@ -45,6 +46,23 @@ public function createTeam() $this->dispatch('flash', type: 'success', text: 'Équipe créée avec succès !'); } + public function deleteTeam(Team $team) + { + // Vérifier les permissions + if (!Gate::allows('deleteTeam', $team)) { + $this->dispatch('flash', type: 'error', text: 'Vous n\'avez pas les permissions pour supprimer cette équipe.'); + return; + } + + try { + $teamName = $team->name; + $team->delete(); + $this->dispatch('flash', type: 'success', text: 'L\'équipe "' . $teamName . '" a été supprimée avec succès.'); + } catch (\Exception $e) { + $this->dispatch('flash', type: 'error', text: 'Une erreur est survenue lors de la suppression de l\'équipe.'); + } + } + public function render() { $user = Auth::user(); @@ -54,7 +72,7 @@ public function render() $teams = Team::all(); } else { // Sinon, seulement ses équipes - $teams = $user->teams()->get(); + $teams = $user->teams; } return view('livewire.dashboard', [ diff --git a/app/Livewire/ProjectComponent.php b/app/Livewire/ProjectComponent.php index 5a7fada..89598ff 100644 --- a/app/Livewire/ProjectComponent.php +++ b/app/Livewire/ProjectComponent.php @@ -7,6 +7,7 @@ use App\Models\User; use Livewire\Component; use Illuminate\Support\Facades\Auth; +use Illuminate\Support\Facades\Gate; class ProjectComponent extends Component { @@ -172,6 +173,23 @@ public function demoteFromAdmin($userId) $this->dispatch('flash', type: 'success', text: $user->name . ' n\'est plus administrateur de l\'équipe !'); } + public function deleteProject(Project $project) + { + // Vérifier les permissions + if (!Gate::allows('deleteProject', $project)) { + $this->dispatch('flash', type: 'error', text: 'Vous n\'avez pas les permissions pour supprimer ce projet.'); + return; + } + + try { + $projectName = $project->name; + $project->delete(); + $this->dispatch('flash', type: 'success', text: 'Le projet "' . $projectName . '" a été supprimé avec succès.'); + } catch (\Exception $e) { + $this->dispatch('flash', type: 'error', text: 'Une erreur est survenue lors de la suppression du projet.'); + } + } + public function render() { $projects = Project::where('team_id', $this->teamId)->get(); diff --git a/app/Livewire/TaskComponent.php b/app/Livewire/TaskComponent.php index f09bd4f..18909f4 100644 --- a/app/Livewire/TaskComponent.php +++ b/app/Livewire/TaskComponent.php @@ -7,6 +7,7 @@ use App\Models\Comment; use Livewire\Component; use Illuminate\Support\Facades\Auth; +use Illuminate\Support\Facades\Gate; class TaskComponent extends Component { @@ -146,7 +147,7 @@ public function setSort($field) $this->sortDir = $this->sortDir === 'asc' ? 'desc' : 'asc'; } else { $this->sortField = $field; - $this->sortDir = $field === 'priority' ? 'desc' : 'desc'; + $this->sortDir = 'desc'; } } @@ -160,6 +161,39 @@ public function resetFilters() $this->sortDir = 'desc'; } + public function deleteTask(Task $task) + { + // Vérifier les permissions + if (!Gate::allows('deleteTask', $task)) { + $this->dispatch('flash', type: 'error', text: 'Vous n\'avez pas les permissions pour supprimer cette tâche.'); + return; + } + + try { + $taskTitle = $task->title; + $task->delete(); + $this->dispatch('flash', type: 'success', text: 'La tâche "' . $taskTitle . '" a été supprimée avec succès.'); + } catch (\Exception $e) { + $this->dispatch('flash', type: 'error', text: 'Une erreur est survenue lors de la suppression de la tâche.'); + } + } + + public function deleteComment(Comment $comment) + { + // Vérifier les permissions + if (!Gate::allows('deleteComment', $comment)) { + $this->dispatch('flash', type: 'error', text: 'Vous n\'avez pas les permissions pour supprimer ce commentaire.'); + return; + } + + try { + $comment->delete(); + $this->dispatch('flash', type: 'success', text: 'Le commentaire a été supprimé avec succès.'); + } catch (\Exception $e) { + $this->dispatch('flash', type: 'error', text: 'Une erreur est survenue lors de la suppression du commentaire.'); + } + } + public function render() { $teamMembers = $this->project->team->users; diff --git a/app/Livewire/TeamComponent.php b/app/Livewire/TeamComponent.php index d3b1b59..a1d2744 100644 --- a/app/Livewire/TeamComponent.php +++ b/app/Livewire/TeamComponent.php @@ -6,6 +6,7 @@ use Livewire\Component; use Livewire\WithPagination; use Illuminate\Support\Facades\Auth; +use Illuminate\Support\Facades\Gate; class TeamComponent extends Component { @@ -43,6 +44,23 @@ public function sortBy($field) $this->resetPage(); } + public function deleteTeam(Team $team) + { + // Vérifier les permissions + if (!Gate::allows('deleteTeam', $team)) { + session()->flash('error', 'Vous n\'avez pas les permissions pour supprimer cette équipe.'); + return; + } + + try { + // Supprimer l'équipe et toutes ses relations + $team->delete(); + session()->flash('success', 'L\'équipe "' . $team->name . '" a été supprimée avec succès.'); + } catch (\Exception $e) { + session()->flash('error', 'Une erreur est survenue lors de la suppression de l\'équipe.'); + } + } + public function render() { $user = Auth::user(); diff --git a/app/Providers/AuthServiceProvider.php b/app/Providers/AuthServiceProvider.php index 4bb01cf..3bacbae 100644 --- a/app/Providers/AuthServiceProvider.php +++ b/app/Providers/AuthServiceProvider.php @@ -43,5 +43,29 @@ public function boot(): void Gate::define('manageUsers', function (User $user) { return $user->role === User::ROLE_ADMIN; }); + + // ===================================== + // PERMISSIONS DE SUPPRESSION + // ===================================== + + // Permission pour supprimer une équipe + Gate::define('deleteTeam', function (User $user, Team $team) { + return $user->canDeleteTeam($team); + }); + + // Permission pour supprimer un projet + Gate::define('deleteProject', function (User $user, $project) { + return $user->canDeleteProject($project); + }); + + // Permission pour supprimer une tâche + Gate::define('deleteTask', function (User $user, $task) { + return $user->canDeleteTask($task); + }); + + // Permission pour supprimer un commentaire + Gate::define('deleteComment', function (User $user, $comment) { + return $user->canDeleteComment($comment); + }); } } diff --git a/app/Traits/HasTeamPermissions.php b/app/Traits/HasTeamPermissions.php index b506bc2..5ed0674 100644 --- a/app/Traits/HasTeamPermissions.php +++ b/app/Traits/HasTeamPermissions.php @@ -101,4 +101,70 @@ public function getTeamsWithPermission(string $permission): \Illuminate\Database return $permissionMap[$permission] ?? collect(); } + + // ===================================== + // PERMISSIONS DE SUPPRESSION + // ===================================== + + /** + * Check if user can delete a team + */ + public function canDeleteTeam(Team $team): bool + { + if ($this->isAdmin()) { + return true; // Site admin can delete any team + } + + return $this->isTeamAdminFor($team); + } + + /** + * Check if user can delete a project + */ + public function canDeleteProject(\App\Models\Project $project): bool + { + if ($this->isAdmin()) { + return true; // Site admin can delete any project + } + + return $this->isTeamAdminFor($project->team); + } + + /** + * Check if user can delete a task + */ + public function canDeleteTask(\App\Models\Task $task): bool + { + if ($this->isAdmin()) { + return true; // Site admin can delete any task + } + + return $this->isTeamAdminFor($task->project->team); + } + + /** + * Check if user can delete a comment + */ + public function canDeleteComment(\App\Models\Comment $comment): bool + { + // Si l'utilisateur est l'auteur du commentaire, il peut le supprimer + if ($comment->user_id === $this->id) { + return true; + } + + // Site admin peut supprimer n'importe quel commentaire + if ($this->isAdmin()) { + return true; + } + + // Team admin peut supprimer les commentaires dans son équipe + $team = null; + if ($comment->isTaskComment()) { + $team = $comment->task->project->team; + } elseif ($comment->isProjectComment()) { + $team = $comment->project->team; + } + + return $team ? $this->isTeamAdminFor($team) : false; + } } diff --git a/er = AppModelsUser::where('email', '!=', 'root@teamtask.com')->first() b/er = AppModelsUser::where('email', '!=', 'root@teamtask.com')->first() new file mode 100644 index 0000000..fbd916d --- /dev/null +++ b/er = AppModelsUser::where('email', '!=', 'root@teamtask.com')->first() @@ -0,0 +1,12 @@ += App\Models\User {#6643 + id: 1, + name: "Administrateur Root", + email: "root@teamtask.com", + email_verified_at: "2025-08-16 13:05:14", + #password: "$2y$12$ikGoYBOQqG9sWccPTHT0G.wfdtzfgJxZedW3jmlvtnlLbIvBuu1ey", + role: "admin", + #remember_token: null, + created_at: "2025-08-16 13:05:14", + updated_at: "2025-08-16 13:05:14", + } + diff --git "a/er peut supprimer \303\251quipe: \" . ($user->canDeleteTeam($team) ? 'OUI' : 'NON') . \"n\"" "b/er peut supprimer \303\251quipe: \" . ($user->canDeleteTeam($team) ? 'OUI' : 'NON') . \"n\"" new file mode 100644 index 0000000..333a0b5 --- /dev/null +++ "b/er peut supprimer \303\251quipe: \" . ($user->canDeleteTeam($team) ? 'OUI' : 'NON') . \"n\"" @@ -0,0 +1,258 @@ + + SSUUMMMMAARRYY OOFF LLEESSSS CCOOMMMMAANNDDSS + + Commands marked with * may be preceded by a number, _N. + Notes in parentheses indicate the behavior if _N is given. + A key preceded by a caret indicates the Ctrl key; thus ^K is ctrl-K. + + h H Display this help. + q :q Q :Q ZZ Exit. + --------------------------------------------------------------------------- + + MMOOVVIINNGG + + e ^E j ^N CR * Forward one line (or _N lines). + y ^Y k ^K ^P * Backward one line (or _N lines). + f ^F ^V SPACE * Forward one window (or _N lines). + b ^B ESC-v * Backward one window (or _N lines). + z * Forward one window (and set window to _N). + w * Backward one window (and set window to _N). + ESC-SPACE * Forward one window, but don't stop at end-of-file. + d ^D * Forward one half-window (and set half-window to _N). + u ^U * Backward one half-window (and set half-window to _N). + ESC-) RightArrow * Right one half screen width (or _N positions). + ESC-( LeftArrow * Left one half screen width (or _N positions). + ESC-} ^RightArrow Right to last column displayed. + ESC-{ ^LeftArrow Left to first column. + F Forward forever; like "tail -f". + ESC-F Like F but stop when search pattern is found. + r ^R ^L Repaint screen. + R Repaint screen, discarding buffered input. + --------------------------------------------------- + Default "window" is the screen height. + Default "half-window" is half of the screen height. + --------------------------------------------------------------------------- + + SSEEAARRCCHHIINNGG + + /_p_a_t_t_e_r_n * Search forward for (_N-th) matching line. + ?_p_a_t_t_e_r_n * Search backward for (_N-th) matching line. + n * Repeat previous search (for _N-th occurrence). + N * Repeat previous search in reverse direction. + ESC-n * Repeat previous search, spanning files. + ESC-N * Repeat previous search, reverse dir. & spanning files. + ESC-u Undo (toggle) search highlighting. + ESC-U Clear search highlighting. + &_p_a_t_t_e_r_n * Display only matching lines. + --------------------------------------------------- + A search pattern may begin with one or more of: + ^N or ! Search for NON-matching lines. + ^E or * Search multiple files (pass thru END OF FILE). + ^F or @ Start search at FIRST file (for /) or last file (for ?). + ^K Highlight matches, but don't move (KEEP position). + ^R Don't use REGULAR EXPRESSIONS. + ^W WRAP search if no match found. + --------------------------------------------------------------------------- + + JJUUMMPPIINNGG + + g < ESC-< * Go to first line in file (or line _N). + G > ESC-> * Go to last line in file (or line _N). + p % * Go to beginning of file (or _N percent into file). + t * Go to the (_N-th) next tag. + T * Go to the (_N-th) previous tag. + { ( [ * Find close bracket } ) ]. + } ) ] * Find open bracket { ( [. + ESC-^F _<_c_1_> _<_c_2_> * Find close bracket _<_c_2_>. + ESC-^B _<_c_1_> _<_c_2_> * Find open bracket _<_c_1_>. + --------------------------------------------------- + Each "find close bracket" command goes forward to the close bracket + matching the (_N-th) open bracket in the top line. + Each "find open bracket" command goes backward to the open bracket + matching the (_N-th) close bracket in the bottom line. + + m_<_l_e_t_t_e_r_> Mark the current top line with . + M_<_l_e_t_t_e_r_> Mark the current bottom line with . + '_<_l_e_t_t_e_r_> Go to a previously marked position. + '' Go to the previous position. + ^X^X Same as '. + ESC-M_<_l_e_t_t_e_r_> Clear a mark. + --------------------------------------------------- + A mark is any upper-case or lower-case letter. + Certain marks are predefined: + ^ means beginning of the file + $ means end of the file + --------------------------------------------------------------------------- + + CCHHAANNGGIINNGG FFIILLEESS + + :e [_f_i_l_e] Examine a new file. + ^X^V Same as :e. + :n * Examine the (_N-th) next file from the command line. + :p * Examine the (_N-th) previous file from the command line. + :x * Examine the first (or _N-th) file from the command line. + :d Delete the current file from the command line list. + = ^G :f Print current file name. + --------------------------------------------------------------------------- + + MMIISSCCEELLLLAANNEEOOUUSS CCOOMMMMAANNDDSS + + -_<_f_l_a_g_> Toggle a command line option [see OPTIONS below]. + --_<_n_a_m_e_> Toggle a command line option, by name. + __<_f_l_a_g_> Display the setting of a command line option. + ___<_n_a_m_e_> Display the setting of an option, by name. + +_c_m_d Execute the less cmd each time a new file is examined. + + !_c_o_m_m_a_n_d Execute the shell command with $SHELL. + |XX_c_o_m_m_a_n_d Pipe file between current pos & mark XX to shell command. + s _f_i_l_e Save input to a file. + v Edit the current file with $VISUAL or $EDITOR. + V Print version number of "less". + --------------------------------------------------------------------------- + + OOPPTTIIOONNSS + + Most options may be changed either on the command line, + or from within less by using the - or -- command. + Options may be given in one of two forms: either a single + character preceded by a -, or a name preceded by --. + + -? ........ --help + Display help (from command line). + -a ........ --search-skip-screen + Search skips current screen. + -A ........ --SEARCH-SKIP-SCREEN + Search starts just after target line. + -b [_N] .... --buffers=[_N] + Number of buffers. + -B ........ --auto-buffers + Don't automatically allocate buffers for pipes. + -c ........ --clear-screen + Repaint by clearing rather than scrolling. + -d ........ --dumb + Dumb terminal. + -D xx_c_o_l_o_r . --color=xx_c_o_l_o_r + Set screen colors. + -e -E .... --quit-at-eof --QUIT-AT-EOF + Quit at end of file. + -f ........ --force + Force open non-regular files. + -F ........ --quit-if-one-screen + Quit if entire file fits on first screen. + -g ........ --hilite-search + Highlight only last match for searches. + -G ........ --HILITE-SEARCH + Don't highlight any matches for searches. + -h [_N] .... --max-back-scroll=[_N] + Backward scroll limit. + -i ........ --ignore-case + Ignore case in searches that do not contain uppercase. + -I ........ --IGNORE-CASE + Ignore case in all searches. + -j [_N] .... --jump-target=[_N] + Screen position of target lines. + -J ........ --status-column + Display a status column at left edge of screen. + -k [_f_i_l_e] . --lesskey-file=[_f_i_l_e] + Use a lesskey file. + -K ........ --quit-on-intr + Exit less in response to ctrl-C. + -L ........ --no-lessopen + Ignore the LESSOPEN environment variable. + -m -M .... --long-prompt --LONG-PROMPT + Set prompt style. + -n -N .... --line-numbers --LINE-NUMBERS + Don't use line numbers. + -o [_f_i_l_e] . --log-file=[_f_i_l_e] + Copy to log file (standard input only). + -O [_f_i_l_e] . --LOG-FILE=[_f_i_l_e] + Copy to log file (unconditionally overwrite). + -p [_p_a_t_t_e_r_n] --pattern=[_p_a_t_t_e_r_n] + Start at pattern (from command line). + -P [_p_r_o_m_p_t] --prompt=[_p_r_o_m_p_t] + Define new prompt. + -q -Q .... --quiet --QUIET --silent --SILENT + Quiet the terminal bell. + -r -R .... --raw-control-chars --RAW-CONTROL-CHARS + Output "raw" control characters. + -s ........ --squeeze-blank-lines + Squeeze multiple blank lines. + -S ........ --chop-long-lines + Chop (truncate) long lines rather than wrapping. + -t [_t_a_g] .. --tag=[_t_a_g] + Find a tag. + -T [_t_a_g_s_f_i_l_e] --tag-file=[_t_a_g_s_f_i_l_e] + Use an alternate tags file. + -u -U .... --underline-special --UNDERLINE-SPECIAL + Change handling of backspaces. + -V ........ --version + Display the version number of "less". + -w ........ --hilite-unread + Highlight first new line after forward-screen. + -W ........ --HILITE-UNREAD + Highlight first new line after any forward movement. + -x [_N[,...]] --tabs=[_N[,...]] + Set tab stops. + -X ........ --no-init + Don't use termcap init/deinit strings. + -y [_N] .... --max-forw-scroll=[_N] + Forward scroll limit. + -z [_N] .... --window=[_N] + Set size of window. + -" [_c[_c]] . --quotes=[_c[_c]] + Set shell quote characters. + -~ ........ --tilde + Don't display tildes after end of file. + -# [_N] .... --shift=[_N] + Set horizontal scroll amount (0 = one half screen width). + --file-size + Automatically determine the size of the input file. + --follow-name + The F command changes files if the input file is renamed. + --incsearch + Search file as each pattern character is typed in. + --line-num-width=N + Set the width of the -N line number field to N characters. + --mouse + Enable mouse input. + --no-keypad + Don't send termcap keypad init/deinit strings. + --no-histdups + Remove duplicates from command history. + --rscroll=C + Set the character used to mark truncated lines. + --save-marks + Retain marks across invocations of less. + --status-col-width=N + Set the width of the -J status column to N characters. + --use-backslash + Subsequent options use backslash as escape char. + --use-color + Enables colored text. + --wheel-lines=N + Each click of the mouse wheel moves N lines. + + + --------------------------------------------------------------------------- + + LLIINNEE EEDDIITTIINNGG + + These keys can be used to edit text being entered + on the "command line" at the bottom of the screen. + + RightArrow ..................... ESC-l ... Move cursor right one character. + LeftArrow ...................... ESC-h ... Move cursor left one character. + ctrl-RightArrow ESC-RightArrow ESC-w ... Move cursor right one word. + ctrl-LeftArrow ESC-LeftArrow ESC-b ... Move cursor left one word. + HOME ........................... ESC-0 ... Move cursor to start of line. + END ............................ ESC-$ ... Move cursor to end of line. + BACKSPACE ................................ Delete char to left of cursor. + DELETE ......................... ESC-x ... Delete char under cursor. + ctrl-BACKSPACE ESC-BACKSPACE ........... Delete word to left of cursor. + ctrl-DELETE .... ESC-DELETE .... ESC-X ... Delete word under cursor. + ctrl-U ......... ESC (MS-DOS only) ....... Delete entire line. + UpArrow ........................ ESC-k ... Retrieve previous command line. + DownArrow ...................... ESC-j ... Retrieve next command line. + TAB ...................................... Complete filename & cycle. + SHIFT-TAB ...................... ESC-TAB Complete filename & reverse cycle. + ctrl-L ................................... Complete filename, list all. diff --git a/resources/views/livewire/dashboard.blade.php b/resources/views/livewire/dashboard.blade.php index a39e6c2..8f04152 100644 --- a/resources/views/livewire/dashboard.blade.php +++ b/resources/views/livewire/dashboard.blade.php @@ -69,27 +69,47 @@ class="bg-slate-400 dark:bg-gray-600 hover:bg-slate-500 dark:hover:bg-gray-700 t
@forelse($teams as $team) -
+
-

{{ $team->name }}

- - - +

+ {{ $team->name }} +

+
+ @can('deleteTeam', $team) + + @endcan + + + +
- @if($team->description) -

{{ Str::limit($team->description, 100) }}

- @endif -
-

- Membres: {{ $team->users()->count() }} -

-

- Projets: {{ $team->projects()->count() }} -

-

- Créée le {{ $team->created_at->format('d/m/Y') }} -

+
+ @if($team->description) +

{{ Str::limit($team->description, 100) }}

+ @endif +
+

+ Membres: {{ $team->users()->count() }} +

+

+ Projets: {{ $team->projects()->count() }} +

+

+ Créée le {{ $team->created_at->format('d/m/Y') }} +

+
@empty diff --git a/resources/views/livewire/project-component.blade.php b/resources/views/livewire/project-component.blade.php index 09f00b4..5e3e8e2 100644 --- a/resources/views/livewire/project-component.blade.php +++ b/resources/views/livewire/project-component.blade.php @@ -211,46 +211,66 @@ class="bg-slate-400 dark:bg-gray-600 hover:bg-slate-500 dark:hover:bg-gray-700 t
@forelse($projects as $project) -
+
-

{{ $project->name }}

- - - +

+ {{ $project->name }} +

+
+ @can('deleteProject', $project) + + @endcan + + + +
- @if($project->description) -

{{ Str::limit($project->description, 100) }}

- @endif -
- @if($project->start_date || $project->end_date) +
+ @if($project->description) +

{{ Str::limit($project->description, 100) }}

+ @endif +
+ @if($project->start_date || $project->end_date) +

+ Période: + @if($project->start_date) + {{ $project->start_date->format('d/m/Y') }} + @else + Non définie + @endif + @if($project->end_date) + - {{ $project->end_date->format('d/m/Y') }} + @endif +

+ @endif

- Période: - @if($project->start_date) - {{ $project->start_date->format('d/m/Y') }} - @else - Non définie - @endif - @if($project->end_date) - - {{ $project->end_date->format('d/m/Y') }} - @endif + Statut: + + {{ $project->status === 'active' ? 'Actif' : 'Archivé' }} +

- @endif -

- Statut: - - {{ $project->status === 'active' ? 'Actif' : 'Archivé' }} - -

-

- Tâches: {{ $project->tasks()->count() }} -

-

- Propriétaire: {{ $project->owner->name }} -

-

- Créé le {{ $project->created_at->format('d/m/Y') }} -

+

+ Tâches: {{ $project->tasks()->count() }} +

+

+ Propriétaire: {{ $project->owner->name }} +

+

+ Créé le {{ $project->created_at->format('d/m/Y') }} +

+
@empty diff --git a/resources/views/livewire/task-component.blade.php b/resources/views/livewire/task-component.blade.php index 6df1bc4..7a774e4 100644 --- a/resources/views/livewire/task-component.blade.php +++ b/resources/views/livewire/task-component.blade.php @@ -301,6 +301,14 @@ class="bg-slate-400 hover:bg-slate-500 dark:bg-gray-600 dark:hover:bg-gray-700 t class="bg-emerald-600 hover:bg-emerald-700 dark:bg-blue-600 dark:hover:bg-blue-700 text-white px-2 py-1 rounded text-xs transition-colors cursor-pointer"> Modifier + @can('deleteTask', $task) + + @endcan
@if($task->description) @@ -390,7 +398,19 @@ class="bg-emerald-600 hover:bg-emerald-700 dark:bg-purple-600 dark:hover:bg-purp
{{ $comment->user->name }} - {{ $comment->created_at->format('d/m/Y H:i') }} +
+ {{ $comment->created_at->format('d/m/Y H:i') }} + @can('deleteComment', $comment) + + @endcan +

{{ $comment->content }}

diff --git a/resources/views/livewire/team-component.blade.php b/resources/views/livewire/team-component.blade.php index bcc8f18..96e14ac 100644 --- a/resources/views/livewire/team-component.blade.php +++ b/resources/views/livewire/team-component.blade.php @@ -42,7 +42,15 @@ class="w-full px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg f
- + @can('deleteTeam', $team) + + @endcan
diff --git a/test_permissions.php b/test_permissions.php new file mode 100644 index 0000000..bd50417 --- /dev/null +++ b/test_permissions.php @@ -0,0 +1,83 @@ +make(Illuminate\Contracts\Console\Kernel::class); +$kernel->bootstrap(); + +echo "=== TEST DES PERMISSIONS DE SUPPRESSION ===\n\n"; + +try { + $admin = \App\Models\User::where('email', 'root@teamtask.com')->first(); + $user = \App\Models\User::where('email', '!=', 'root@teamtask.com')->first(); + $team = \App\Models\Team::first(); + $project = \App\Models\Project::first(); + $task = \App\Models\Task::first(); + $comment = \App\Models\Comment::first(); + + if (!$admin) { + echo "❌ Admin non trouvé\n"; + exit(1); + } + + echo "👤 Admin: " . $admin->name . " (" . $admin->email . ")\n"; + echo "👤 User: " . ($user ? $user->name . " (" . $user->email . ")" : "Aucun autre utilisateur") . "\n\n"; + + echo "=== PERMISSIONS ADMIN DU SITE ===\n"; + if ($team) { + echo "🏢 Peut supprimer équipe: " . ($admin->canDeleteTeam($team) ? "✅ OUI" : "❌ NON") . "\n"; + } + if ($project) { + echo "📂 Peut supprimer projet: " . ($admin->canDeleteProject($project) ? "✅ OUI" : "❌ NON") . "\n"; + } + if ($task) { + echo "📝 Peut supprimer tâche: " . ($admin->canDeleteTask($task) ? "✅ OUI" : "❌ NON") . "\n"; + } + if ($comment) { + echo "💬 Peut supprimer commentaire: " . ($admin->canDeleteComment($comment) ? "✅ OUI" : "❌ NON") . "\n"; + } + + if ($user) { + echo "\n=== PERMISSIONS UTILISATEUR NORMAL ===\n"; + if ($team) { + echo "🏢 Peut supprimer équipe: " . ($user->canDeleteTeam($team) ? "✅ OUI" : "❌ NON") . "\n"; + } + if ($project) { + echo "📂 Peut supprimer projet: " . ($user->canDeleteProject($project) ? "✅ OUI" : "❌ NON") . "\n"; + } + if ($task) { + echo "📝 Peut supprimer tâche: " . ($user->canDeleteTask($task) ? "✅ OUI" : "❌ NON") . "\n"; + } + if ($comment) { + echo "💬 Peut supprimer commentaire: " . ($user->canDeleteComment($comment) ? "✅ OUI" : "❌ NON") . "\n"; + } + } + + echo "\n=== TEST TEAM ADMIN ===\n"; + // Créer un admin d'équipe pour les tests + $teamAdmin = \App\Models\User::where('email', '!=', 'root@teamtask.com')->skip(1)->first(); + if ($teamAdmin && $team) { + // S'assurer qu'il soit admin de l'équipe + $team->users()->syncWithoutDetaching([$teamAdmin->id => ['role' => 'admin']]); + $teamAdmin->refresh(); + + echo "👤 Team Admin: " . $teamAdmin->name . "\n"; + echo "🏢 Peut supprimer équipe: " . ($teamAdmin->canDeleteTeam($team) ? "✅ OUI" : "❌ NON") . "\n"; + if ($project) { + echo "📂 Peut supprimer projet: " . ($teamAdmin->canDeleteProject($project) ? "✅ OUI" : "❌ NON") . "\n"; + } + if ($task) { + echo "📝 Peut supprimer tâche: " . ($teamAdmin->canDeleteTask($task) ? "✅ OUI" : "❌ NON") . "\n"; + } + if ($comment) { + echo "💬 Peut supprimer commentaire: " . ($teamAdmin->canDeleteComment($comment) ? "✅ OUI" : "❌ NON") . "\n"; + } + } + + echo "\n✅ Tests terminés avec succès !\n"; + +} catch (Exception $e) { + echo "❌ Erreur: " . $e->getMessage() . "\n"; + echo "📍 Fichier: " . $e->getFile() . ":" . $e->getLine() . "\n"; +} diff --git "a/upprimer \303\251quipe: \" . ($admin->canDeleteTeam($team) ? 'OUI' : 'NON') . \"n\"" "b/upprimer \303\251quipe: \" . ($admin->canDeleteTeam($team) ? 'OUI' : 'NON') . \"n\"" new file mode 100644 index 0000000..333a0b5 --- /dev/null +++ "b/upprimer \303\251quipe: \" . ($admin->canDeleteTeam($team) ? 'OUI' : 'NON') . \"n\"" @@ -0,0 +1,258 @@ + + SSUUMMMMAARRYY OOFF LLEESSSS CCOOMMMMAANNDDSS + + Commands marked with * may be preceded by a number, _N. + Notes in parentheses indicate the behavior if _N is given. + A key preceded by a caret indicates the Ctrl key; thus ^K is ctrl-K. + + h H Display this help. + q :q Q :Q ZZ Exit. + --------------------------------------------------------------------------- + + MMOOVVIINNGG + + e ^E j ^N CR * Forward one line (or _N lines). + y ^Y k ^K ^P * Backward one line (or _N lines). + f ^F ^V SPACE * Forward one window (or _N lines). + b ^B ESC-v * Backward one window (or _N lines). + z * Forward one window (and set window to _N). + w * Backward one window (and set window to _N). + ESC-SPACE * Forward one window, but don't stop at end-of-file. + d ^D * Forward one half-window (and set half-window to _N). + u ^U * Backward one half-window (and set half-window to _N). + ESC-) RightArrow * Right one half screen width (or _N positions). + ESC-( LeftArrow * Left one half screen width (or _N positions). + ESC-} ^RightArrow Right to last column displayed. + ESC-{ ^LeftArrow Left to first column. + F Forward forever; like "tail -f". + ESC-F Like F but stop when search pattern is found. + r ^R ^L Repaint screen. + R Repaint screen, discarding buffered input. + --------------------------------------------------- + Default "window" is the screen height. + Default "half-window" is half of the screen height. + --------------------------------------------------------------------------- + + SSEEAARRCCHHIINNGG + + /_p_a_t_t_e_r_n * Search forward for (_N-th) matching line. + ?_p_a_t_t_e_r_n * Search backward for (_N-th) matching line. + n * Repeat previous search (for _N-th occurrence). + N * Repeat previous search in reverse direction. + ESC-n * Repeat previous search, spanning files. + ESC-N * Repeat previous search, reverse dir. & spanning files. + ESC-u Undo (toggle) search highlighting. + ESC-U Clear search highlighting. + &_p_a_t_t_e_r_n * Display only matching lines. + --------------------------------------------------- + A search pattern may begin with one or more of: + ^N or ! Search for NON-matching lines. + ^E or * Search multiple files (pass thru END OF FILE). + ^F or @ Start search at FIRST file (for /) or last file (for ?). + ^K Highlight matches, but don't move (KEEP position). + ^R Don't use REGULAR EXPRESSIONS. + ^W WRAP search if no match found. + --------------------------------------------------------------------------- + + JJUUMMPPIINNGG + + g < ESC-< * Go to first line in file (or line _N). + G > ESC-> * Go to last line in file (or line _N). + p % * Go to beginning of file (or _N percent into file). + t * Go to the (_N-th) next tag. + T * Go to the (_N-th) previous tag. + { ( [ * Find close bracket } ) ]. + } ) ] * Find open bracket { ( [. + ESC-^F _<_c_1_> _<_c_2_> * Find close bracket _<_c_2_>. + ESC-^B _<_c_1_> _<_c_2_> * Find open bracket _<_c_1_>. + --------------------------------------------------- + Each "find close bracket" command goes forward to the close bracket + matching the (_N-th) open bracket in the top line. + Each "find open bracket" command goes backward to the open bracket + matching the (_N-th) close bracket in the bottom line. + + m_<_l_e_t_t_e_r_> Mark the current top line with . + M_<_l_e_t_t_e_r_> Mark the current bottom line with . + '_<_l_e_t_t_e_r_> Go to a previously marked position. + '' Go to the previous position. + ^X^X Same as '. + ESC-M_<_l_e_t_t_e_r_> Clear a mark. + --------------------------------------------------- + A mark is any upper-case or lower-case letter. + Certain marks are predefined: + ^ means beginning of the file + $ means end of the file + --------------------------------------------------------------------------- + + CCHHAANNGGIINNGG FFIILLEESS + + :e [_f_i_l_e] Examine a new file. + ^X^V Same as :e. + :n * Examine the (_N-th) next file from the command line. + :p * Examine the (_N-th) previous file from the command line. + :x * Examine the first (or _N-th) file from the command line. + :d Delete the current file from the command line list. + = ^G :f Print current file name. + --------------------------------------------------------------------------- + + MMIISSCCEELLLLAANNEEOOUUSS CCOOMMMMAANNDDSS + + -_<_f_l_a_g_> Toggle a command line option [see OPTIONS below]. + --_<_n_a_m_e_> Toggle a command line option, by name. + __<_f_l_a_g_> Display the setting of a command line option. + ___<_n_a_m_e_> Display the setting of an option, by name. + +_c_m_d Execute the less cmd each time a new file is examined. + + !_c_o_m_m_a_n_d Execute the shell command with $SHELL. + |XX_c_o_m_m_a_n_d Pipe file between current pos & mark XX to shell command. + s _f_i_l_e Save input to a file. + v Edit the current file with $VISUAL or $EDITOR. + V Print version number of "less". + --------------------------------------------------------------------------- + + OOPPTTIIOONNSS + + Most options may be changed either on the command line, + or from within less by using the - or -- command. + Options may be given in one of two forms: either a single + character preceded by a -, or a name preceded by --. + + -? ........ --help + Display help (from command line). + -a ........ --search-skip-screen + Search skips current screen. + -A ........ --SEARCH-SKIP-SCREEN + Search starts just after target line. + -b [_N] .... --buffers=[_N] + Number of buffers. + -B ........ --auto-buffers + Don't automatically allocate buffers for pipes. + -c ........ --clear-screen + Repaint by clearing rather than scrolling. + -d ........ --dumb + Dumb terminal. + -D xx_c_o_l_o_r . --color=xx_c_o_l_o_r + Set screen colors. + -e -E .... --quit-at-eof --QUIT-AT-EOF + Quit at end of file. + -f ........ --force + Force open non-regular files. + -F ........ --quit-if-one-screen + Quit if entire file fits on first screen. + -g ........ --hilite-search + Highlight only last match for searches. + -G ........ --HILITE-SEARCH + Don't highlight any matches for searches. + -h [_N] .... --max-back-scroll=[_N] + Backward scroll limit. + -i ........ --ignore-case + Ignore case in searches that do not contain uppercase. + -I ........ --IGNORE-CASE + Ignore case in all searches. + -j [_N] .... --jump-target=[_N] + Screen position of target lines. + -J ........ --status-column + Display a status column at left edge of screen. + -k [_f_i_l_e] . --lesskey-file=[_f_i_l_e] + Use a lesskey file. + -K ........ --quit-on-intr + Exit less in response to ctrl-C. + -L ........ --no-lessopen + Ignore the LESSOPEN environment variable. + -m -M .... --long-prompt --LONG-PROMPT + Set prompt style. + -n -N .... --line-numbers --LINE-NUMBERS + Don't use line numbers. + -o [_f_i_l_e] . --log-file=[_f_i_l_e] + Copy to log file (standard input only). + -O [_f_i_l_e] . --LOG-FILE=[_f_i_l_e] + Copy to log file (unconditionally overwrite). + -p [_p_a_t_t_e_r_n] --pattern=[_p_a_t_t_e_r_n] + Start at pattern (from command line). + -P [_p_r_o_m_p_t] --prompt=[_p_r_o_m_p_t] + Define new prompt. + -q -Q .... --quiet --QUIET --silent --SILENT + Quiet the terminal bell. + -r -R .... --raw-control-chars --RAW-CONTROL-CHARS + Output "raw" control characters. + -s ........ --squeeze-blank-lines + Squeeze multiple blank lines. + -S ........ --chop-long-lines + Chop (truncate) long lines rather than wrapping. + -t [_t_a_g] .. --tag=[_t_a_g] + Find a tag. + -T [_t_a_g_s_f_i_l_e] --tag-file=[_t_a_g_s_f_i_l_e] + Use an alternate tags file. + -u -U .... --underline-special --UNDERLINE-SPECIAL + Change handling of backspaces. + -V ........ --version + Display the version number of "less". + -w ........ --hilite-unread + Highlight first new line after forward-screen. + -W ........ --HILITE-UNREAD + Highlight first new line after any forward movement. + -x [_N[,...]] --tabs=[_N[,...]] + Set tab stops. + -X ........ --no-init + Don't use termcap init/deinit strings. + -y [_N] .... --max-forw-scroll=[_N] + Forward scroll limit. + -z [_N] .... --window=[_N] + Set size of window. + -" [_c[_c]] . --quotes=[_c[_c]] + Set shell quote characters. + -~ ........ --tilde + Don't display tildes after end of file. + -# [_N] .... --shift=[_N] + Set horizontal scroll amount (0 = one half screen width). + --file-size + Automatically determine the size of the input file. + --follow-name + The F command changes files if the input file is renamed. + --incsearch + Search file as each pattern character is typed in. + --line-num-width=N + Set the width of the -N line number field to N characters. + --mouse + Enable mouse input. + --no-keypad + Don't send termcap keypad init/deinit strings. + --no-histdups + Remove duplicates from command history. + --rscroll=C + Set the character used to mark truncated lines. + --save-marks + Retain marks across invocations of less. + --status-col-width=N + Set the width of the -J status column to N characters. + --use-backslash + Subsequent options use backslash as escape char. + --use-color + Enables colored text. + --wheel-lines=N + Each click of the mouse wheel moves N lines. + + + --------------------------------------------------------------------------- + + LLIINNEE EEDDIITTIINNGG + + These keys can be used to edit text being entered + on the "command line" at the bottom of the screen. + + RightArrow ..................... ESC-l ... Move cursor right one character. + LeftArrow ...................... ESC-h ... Move cursor left one character. + ctrl-RightArrow ESC-RightArrow ESC-w ... Move cursor right one word. + ctrl-LeftArrow ESC-LeftArrow ESC-b ... Move cursor left one word. + HOME ........................... ESC-0 ... Move cursor to start of line. + END ............................ ESC-$ ... Move cursor to end of line. + BACKSPACE ................................ Delete char to left of cursor. + DELETE ......................... ESC-x ... Delete char under cursor. + ctrl-BACKSPACE ESC-BACKSPACE ........... Delete word to left of cursor. + ctrl-DELETE .... ESC-DELETE .... ESC-X ... Delete word under cursor. + ctrl-U ......... ESC (MS-DOS only) ....... Delete entire line. + UpArrow ........................ ESC-k ... Retrieve previous command line. + DownArrow ...................... ESC-j ... Retrieve next command line. + TAB ...................................... Complete filename & cycle. + SHIFT-TAB ...................... ESC-TAB Complete filename & reverse cycle. + ctrl-L ................................... Complete filename, list all. From 14ad575b2c7186491237ba9ca433e4b736f95ed1 Mon Sep 17 00:00:00 2001 From: Denis40-prog Date: Sat, 16 Aug 2025 17:28:16 +0200 Subject: [PATCH 2/2] [DEL] suppression de fichiers inutiles + [UPD] update readme --- PERMISSIONS_SUPPRESSION.md | 96 ------- README.md | 10 +- ...mail', '!=', 'root@teamtask.com')->first() | 12 - ...eleteTeam($team) ? 'OUI' : 'NON') . \"n\"" | 258 ------------------ .../views/components/hexagon-grid.blade.php | 50 ---- test_permissions.php | 83 ------ ...eleteTeam($team) ? 'OUI' : 'NON') . \"n\"" | 258 ------------------ 7 files changed, 6 insertions(+), 761 deletions(-) delete mode 100644 PERMISSIONS_SUPPRESSION.md delete mode 100644 er = AppModelsUser::where('email', '!=', 'root@teamtask.com')->first() delete mode 100644 "er peut supprimer \303\251quipe: \" . ($user->canDeleteTeam($team) ? 'OUI' : 'NON') . \"n\"" delete mode 100644 resources/views/components/hexagon-grid.blade.php delete mode 100644 test_permissions.php delete mode 100644 "upprimer \303\251quipe: \" . ($admin->canDeleteTeam($team) ? 'OUI' : 'NON') . \"n\"" diff --git a/PERMISSIONS_SUPPRESSION.md b/PERMISSIONS_SUPPRESSION.md deleted file mode 100644 index 4929d51..0000000 --- a/PERMISSIONS_SUPPRESSION.md +++ /dev/null @@ -1,96 +0,0 @@ -# 🗑️ Système de Permissions de Suppression - -## ✅ Fonctionnalités Implémentées - -### 🏢 **Équipes** -- **Admin du Site** : Peut supprimer n'importe quelle équipe -- **Admin d'Équipe** : Peut supprimer uniquement son équipe -- **Utilisateur Normal** : Ne peut pas supprimer d'équipes - -**Localisation des boutons :** -- Dashboard : Icône poubelle sur chaque carte d'équipe -- Page équipes dédiée : Bouton "Supprimer" dans la liste - -### 📂 **Projets** -- **Admin du Site** : Peut supprimer n'importe quel projet -- **Admin d'Équipe** : Peut supprimer les projets de son équipe -- **Utilisateur Normal** : Ne peut pas supprimer de projets - -**Localisation des boutons :** -- Page projets : Icône poubelle à côté du titre du projet - -### 📝 **Tâches** -- **Admin du Site** : Peut supprimer n'importe quelle tâche -- **Admin d'Équipe** : Peut supprimer les tâches de son équipe -- **Utilisateur Normal** : Ne peut pas supprimer de tâches - -**Localisation des boutons :** -- Page tâches : Bouton "Supprimer" à côté du bouton "Modifier" - -### 💬 **Commentaires** -- **Admin du Site** : Peut supprimer n'importe quel commentaire -- **Admin d'Équipe** : Peut supprimer les commentaires dans son équipe -- **Utilisateur Normal** : Peut supprimer UNIQUEMENT ses propres commentaires - -**Localisation des boutons :** -- Page tâches : Icône 🗑️ à côté de la date du commentaire - -## 🔧 Architecture Technique - -### Permissions (Trait HasTeamPermissions) -```php -- canDeleteTeam(Team $team) // Admin site OU Admin équipe -- canDeleteProject(Project $project) // Admin site OU Admin équipe du projet -- canDeleteTask(Task $task) // Admin site OU Admin équipe du projet de la tâche -- canDeleteComment(Comment $comment) // Auteur OU Admin site OU Admin équipe -``` - -### Gates (AuthServiceProvider) -```php -- deleteTeam -- deleteProject -- deleteTask -- deleteComment -``` - -### Méthodes Livewire -```php -// Dashboard.php & TeamComponent.php -- deleteTeam(Team $team) - -// ProjectComponent.php -- deleteProject(Project $project) - -// TaskComponent.php -- deleteTask(Task $task) -- deleteComment(Comment $comment) -``` - -## 🛡️ Sécurité - -- ✅ Vérification des permissions via Gates -- ✅ Confirmations JavaScript avant suppression -- ✅ Messages d'erreur si permissions insuffisantes -- ✅ Suppression en cascade via migrations (CASCADE) -- ✅ Gestion des exceptions - -## 🎯 Tests Recommandés - -1. **Connectez-vous en tant qu'admin** (root@teamtask.com) - - Testez la suppression d'équipes, projets, tâches, commentaires - -2. **Créez un admin d'équipe** - - Testez qu'il peut supprimer dans son équipe seulement - -3. **Connectez-vous en utilisateur normal** - - Vérifiez qu'il ne peut supprimer que ses commentaires - -4. **Testez la suppression en cascade** - - Supprimez une équipe → tous ses projets/tâches/commentaires disparaissent - -## 🚨 Messages de Confirmation - -- **Équipe** : "Êtes-vous sûr de vouloir supprimer cette équipe ? Cette action est irréversible et supprimera tous les projets, tâches et commentaires associés." -- **Projet** : "Êtes-vous sûr de vouloir supprimer ce projet ? Cette action est irréversible." -- **Tâche** : "Êtes-vous sûr de vouloir supprimer cette tâche ? Cette action est irréversible." -- **Commentaire** : "Êtes-vous sûr de vouloir supprimer ce commentaire ?" diff --git a/README.md b/README.md index 1dd4d0d..90b8ee0 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,12 @@ - Ajout de commentaires sur un projet (associés à une tâche système si nécessaire) - Affichage des commentaires récents avec auteur et date -### 🎨 Interface +### �️ Météo des émotions +- Suivi du bien-être de l'équipe via des questionnaires +- Visualisation de l'état émotionnel des membres +- Historique des réponses pour analyse des tendances + +### �🎨 Interface - UI responsive avec **Tailwind CSS** - Composants dynamiques Livewire pour une interaction fluide - Affichage clair des priorités et statuts par couleurs @@ -118,9 +123,6 @@ sail npm run dev - Documentation technique & utilisateur complète - Mise en production -## Suivi de la météo des émotions -- Questionnaire - ## Mise en concurrence hebdomadaire - Challenge sous forme de mission hebdomadaire diff --git a/er = AppModelsUser::where('email', '!=', 'root@teamtask.com')->first() b/er = AppModelsUser::where('email', '!=', 'root@teamtask.com')->first() deleted file mode 100644 index fbd916d..0000000 --- a/er = AppModelsUser::where('email', '!=', 'root@teamtask.com')->first() +++ /dev/null @@ -1,12 +0,0 @@ -= App\Models\User {#6643 - id: 1, - name: "Administrateur Root", - email: "root@teamtask.com", - email_verified_at: "2025-08-16 13:05:14", - #password: "$2y$12$ikGoYBOQqG9sWccPTHT0G.wfdtzfgJxZedW3jmlvtnlLbIvBuu1ey", - role: "admin", - #remember_token: null, - created_at: "2025-08-16 13:05:14", - updated_at: "2025-08-16 13:05:14", - } - diff --git "a/er peut supprimer \303\251quipe: \" . ($user->canDeleteTeam($team) ? 'OUI' : 'NON') . \"n\"" "b/er peut supprimer \303\251quipe: \" . ($user->canDeleteTeam($team) ? 'OUI' : 'NON') . \"n\"" deleted file mode 100644 index 333a0b5..0000000 --- "a/er peut supprimer \303\251quipe: \" . ($user->canDeleteTeam($team) ? 'OUI' : 'NON') . \"n\"" +++ /dev/null @@ -1,258 +0,0 @@ - - SSUUMMMMAARRYY OOFF LLEESSSS CCOOMMMMAANNDDSS - - Commands marked with * may be preceded by a number, _N. - Notes in parentheses indicate the behavior if _N is given. - A key preceded by a caret indicates the Ctrl key; thus ^K is ctrl-K. - - h H Display this help. - q :q Q :Q ZZ Exit. - --------------------------------------------------------------------------- - - MMOOVVIINNGG - - e ^E j ^N CR * Forward one line (or _N lines). - y ^Y k ^K ^P * Backward one line (or _N lines). - f ^F ^V SPACE * Forward one window (or _N lines). - b ^B ESC-v * Backward one window (or _N lines). - z * Forward one window (and set window to _N). - w * Backward one window (and set window to _N). - ESC-SPACE * Forward one window, but don't stop at end-of-file. - d ^D * Forward one half-window (and set half-window to _N). - u ^U * Backward one half-window (and set half-window to _N). - ESC-) RightArrow * Right one half screen width (or _N positions). - ESC-( LeftArrow * Left one half screen width (or _N positions). - ESC-} ^RightArrow Right to last column displayed. - ESC-{ ^LeftArrow Left to first column. - F Forward forever; like "tail -f". - ESC-F Like F but stop when search pattern is found. - r ^R ^L Repaint screen. - R Repaint screen, discarding buffered input. - --------------------------------------------------- - Default "window" is the screen height. - Default "half-window" is half of the screen height. - --------------------------------------------------------------------------- - - SSEEAARRCCHHIINNGG - - /_p_a_t_t_e_r_n * Search forward for (_N-th) matching line. - ?_p_a_t_t_e_r_n * Search backward for (_N-th) matching line. - n * Repeat previous search (for _N-th occurrence). - N * Repeat previous search in reverse direction. - ESC-n * Repeat previous search, spanning files. - ESC-N * Repeat previous search, reverse dir. & spanning files. - ESC-u Undo (toggle) search highlighting. - ESC-U Clear search highlighting. - &_p_a_t_t_e_r_n * Display only matching lines. - --------------------------------------------------- - A search pattern may begin with one or more of: - ^N or ! Search for NON-matching lines. - ^E or * Search multiple files (pass thru END OF FILE). - ^F or @ Start search at FIRST file (for /) or last file (for ?). - ^K Highlight matches, but don't move (KEEP position). - ^R Don't use REGULAR EXPRESSIONS. - ^W WRAP search if no match found. - --------------------------------------------------------------------------- - - JJUUMMPPIINNGG - - g < ESC-< * Go to first line in file (or line _N). - G > ESC-> * Go to last line in file (or line _N). - p % * Go to beginning of file (or _N percent into file). - t * Go to the (_N-th) next tag. - T * Go to the (_N-th) previous tag. - { ( [ * Find close bracket } ) ]. - } ) ] * Find open bracket { ( [. - ESC-^F _<_c_1_> _<_c_2_> * Find close bracket _<_c_2_>. - ESC-^B _<_c_1_> _<_c_2_> * Find open bracket _<_c_1_>. - --------------------------------------------------- - Each "find close bracket" command goes forward to the close bracket - matching the (_N-th) open bracket in the top line. - Each "find open bracket" command goes backward to the open bracket - matching the (_N-th) close bracket in the bottom line. - - m_<_l_e_t_t_e_r_> Mark the current top line with . - M_<_l_e_t_t_e_r_> Mark the current bottom line with . - '_<_l_e_t_t_e_r_> Go to a previously marked position. - '' Go to the previous position. - ^X^X Same as '. - ESC-M_<_l_e_t_t_e_r_> Clear a mark. - --------------------------------------------------- - A mark is any upper-case or lower-case letter. - Certain marks are predefined: - ^ means beginning of the file - $ means end of the file - --------------------------------------------------------------------------- - - CCHHAANNGGIINNGG FFIILLEESS - - :e [_f_i_l_e] Examine a new file. - ^X^V Same as :e. - :n * Examine the (_N-th) next file from the command line. - :p * Examine the (_N-th) previous file from the command line. - :x * Examine the first (or _N-th) file from the command line. - :d Delete the current file from the command line list. - = ^G :f Print current file name. - --------------------------------------------------------------------------- - - MMIISSCCEELLLLAANNEEOOUUSS CCOOMMMMAANNDDSS - - -_<_f_l_a_g_> Toggle a command line option [see OPTIONS below]. - --_<_n_a_m_e_> Toggle a command line option, by name. - __<_f_l_a_g_> Display the setting of a command line option. - ___<_n_a_m_e_> Display the setting of an option, by name. - +_c_m_d Execute the less cmd each time a new file is examined. - - !_c_o_m_m_a_n_d Execute the shell command with $SHELL. - |XX_c_o_m_m_a_n_d Pipe file between current pos & mark XX to shell command. - s _f_i_l_e Save input to a file. - v Edit the current file with $VISUAL or $EDITOR. - V Print version number of "less". - --------------------------------------------------------------------------- - - OOPPTTIIOONNSS - - Most options may be changed either on the command line, - or from within less by using the - or -- command. - Options may be given in one of two forms: either a single - character preceded by a -, or a name preceded by --. - - -? ........ --help - Display help (from command line). - -a ........ --search-skip-screen - Search skips current screen. - -A ........ --SEARCH-SKIP-SCREEN - Search starts just after target line. - -b [_N] .... --buffers=[_N] - Number of buffers. - -B ........ --auto-buffers - Don't automatically allocate buffers for pipes. - -c ........ --clear-screen - Repaint by clearing rather than scrolling. - -d ........ --dumb - Dumb terminal. - -D xx_c_o_l_o_r . --color=xx_c_o_l_o_r - Set screen colors. - -e -E .... --quit-at-eof --QUIT-AT-EOF - Quit at end of file. - -f ........ --force - Force open non-regular files. - -F ........ --quit-if-one-screen - Quit if entire file fits on first screen. - -g ........ --hilite-search - Highlight only last match for searches. - -G ........ --HILITE-SEARCH - Don't highlight any matches for searches. - -h [_N] .... --max-back-scroll=[_N] - Backward scroll limit. - -i ........ --ignore-case - Ignore case in searches that do not contain uppercase. - -I ........ --IGNORE-CASE - Ignore case in all searches. - -j [_N] .... --jump-target=[_N] - Screen position of target lines. - -J ........ --status-column - Display a status column at left edge of screen. - -k [_f_i_l_e] . --lesskey-file=[_f_i_l_e] - Use a lesskey file. - -K ........ --quit-on-intr - Exit less in response to ctrl-C. - -L ........ --no-lessopen - Ignore the LESSOPEN environment variable. - -m -M .... --long-prompt --LONG-PROMPT - Set prompt style. - -n -N .... --line-numbers --LINE-NUMBERS - Don't use line numbers. - -o [_f_i_l_e] . --log-file=[_f_i_l_e] - Copy to log file (standard input only). - -O [_f_i_l_e] . --LOG-FILE=[_f_i_l_e] - Copy to log file (unconditionally overwrite). - -p [_p_a_t_t_e_r_n] --pattern=[_p_a_t_t_e_r_n] - Start at pattern (from command line). - -P [_p_r_o_m_p_t] --prompt=[_p_r_o_m_p_t] - Define new prompt. - -q -Q .... --quiet --QUIET --silent --SILENT - Quiet the terminal bell. - -r -R .... --raw-control-chars --RAW-CONTROL-CHARS - Output "raw" control characters. - -s ........ --squeeze-blank-lines - Squeeze multiple blank lines. - -S ........ --chop-long-lines - Chop (truncate) long lines rather than wrapping. - -t [_t_a_g] .. --tag=[_t_a_g] - Find a tag. - -T [_t_a_g_s_f_i_l_e] --tag-file=[_t_a_g_s_f_i_l_e] - Use an alternate tags file. - -u -U .... --underline-special --UNDERLINE-SPECIAL - Change handling of backspaces. - -V ........ --version - Display the version number of "less". - -w ........ --hilite-unread - Highlight first new line after forward-screen. - -W ........ --HILITE-UNREAD - Highlight first new line after any forward movement. - -x [_N[,...]] --tabs=[_N[,...]] - Set tab stops. - -X ........ --no-init - Don't use termcap init/deinit strings. - -y [_N] .... --max-forw-scroll=[_N] - Forward scroll limit. - -z [_N] .... --window=[_N] - Set size of window. - -" [_c[_c]] . --quotes=[_c[_c]] - Set shell quote characters. - -~ ........ --tilde - Don't display tildes after end of file. - -# [_N] .... --shift=[_N] - Set horizontal scroll amount (0 = one half screen width). - --file-size - Automatically determine the size of the input file. - --follow-name - The F command changes files if the input file is renamed. - --incsearch - Search file as each pattern character is typed in. - --line-num-width=N - Set the width of the -N line number field to N characters. - --mouse - Enable mouse input. - --no-keypad - Don't send termcap keypad init/deinit strings. - --no-histdups - Remove duplicates from command history. - --rscroll=C - Set the character used to mark truncated lines. - --save-marks - Retain marks across invocations of less. - --status-col-width=N - Set the width of the -J status column to N characters. - --use-backslash - Subsequent options use backslash as escape char. - --use-color - Enables colored text. - --wheel-lines=N - Each click of the mouse wheel moves N lines. - - - --------------------------------------------------------------------------- - - LLIINNEE EEDDIITTIINNGG - - These keys can be used to edit text being entered - on the "command line" at the bottom of the screen. - - RightArrow ..................... ESC-l ... Move cursor right one character. - LeftArrow ...................... ESC-h ... Move cursor left one character. - ctrl-RightArrow ESC-RightArrow ESC-w ... Move cursor right one word. - ctrl-LeftArrow ESC-LeftArrow ESC-b ... Move cursor left one word. - HOME ........................... ESC-0 ... Move cursor to start of line. - END ............................ ESC-$ ... Move cursor to end of line. - BACKSPACE ................................ Delete char to left of cursor. - DELETE ......................... ESC-x ... Delete char under cursor. - ctrl-BACKSPACE ESC-BACKSPACE ........... Delete word to left of cursor. - ctrl-DELETE .... ESC-DELETE .... ESC-X ... Delete word under cursor. - ctrl-U ......... ESC (MS-DOS only) ....... Delete entire line. - UpArrow ........................ ESC-k ... Retrieve previous command line. - DownArrow ...................... ESC-j ... Retrieve next command line. - TAB ...................................... Complete filename & cycle. - SHIFT-TAB ...................... ESC-TAB Complete filename & reverse cycle. - ctrl-L ................................... Complete filename, list all. diff --git a/resources/views/components/hexagon-grid.blade.php b/resources/views/components/hexagon-grid.blade.php deleted file mode 100644 index 6ac88fd..0000000 --- a/resources/views/components/hexagon-grid.blade.php +++ /dev/null @@ -1,50 +0,0 @@ -@props(['teams']) - - - -
- @foreach ($teams->chunk(6) as $rowIndex => $chunk) -
- @foreach ($chunk as $team) - - {{ $team->name }} - - @endforeach -
- @endforeach -
diff --git a/test_permissions.php b/test_permissions.php deleted file mode 100644 index bd50417..0000000 --- a/test_permissions.php +++ /dev/null @@ -1,83 +0,0 @@ -make(Illuminate\Contracts\Console\Kernel::class); -$kernel->bootstrap(); - -echo "=== TEST DES PERMISSIONS DE SUPPRESSION ===\n\n"; - -try { - $admin = \App\Models\User::where('email', 'root@teamtask.com')->first(); - $user = \App\Models\User::where('email', '!=', 'root@teamtask.com')->first(); - $team = \App\Models\Team::first(); - $project = \App\Models\Project::first(); - $task = \App\Models\Task::first(); - $comment = \App\Models\Comment::first(); - - if (!$admin) { - echo "❌ Admin non trouvé\n"; - exit(1); - } - - echo "👤 Admin: " . $admin->name . " (" . $admin->email . ")\n"; - echo "👤 User: " . ($user ? $user->name . " (" . $user->email . ")" : "Aucun autre utilisateur") . "\n\n"; - - echo "=== PERMISSIONS ADMIN DU SITE ===\n"; - if ($team) { - echo "🏢 Peut supprimer équipe: " . ($admin->canDeleteTeam($team) ? "✅ OUI" : "❌ NON") . "\n"; - } - if ($project) { - echo "📂 Peut supprimer projet: " . ($admin->canDeleteProject($project) ? "✅ OUI" : "❌ NON") . "\n"; - } - if ($task) { - echo "📝 Peut supprimer tâche: " . ($admin->canDeleteTask($task) ? "✅ OUI" : "❌ NON") . "\n"; - } - if ($comment) { - echo "💬 Peut supprimer commentaire: " . ($admin->canDeleteComment($comment) ? "✅ OUI" : "❌ NON") . "\n"; - } - - if ($user) { - echo "\n=== PERMISSIONS UTILISATEUR NORMAL ===\n"; - if ($team) { - echo "🏢 Peut supprimer équipe: " . ($user->canDeleteTeam($team) ? "✅ OUI" : "❌ NON") . "\n"; - } - if ($project) { - echo "📂 Peut supprimer projet: " . ($user->canDeleteProject($project) ? "✅ OUI" : "❌ NON") . "\n"; - } - if ($task) { - echo "📝 Peut supprimer tâche: " . ($user->canDeleteTask($task) ? "✅ OUI" : "❌ NON") . "\n"; - } - if ($comment) { - echo "💬 Peut supprimer commentaire: " . ($user->canDeleteComment($comment) ? "✅ OUI" : "❌ NON") . "\n"; - } - } - - echo "\n=== TEST TEAM ADMIN ===\n"; - // Créer un admin d'équipe pour les tests - $teamAdmin = \App\Models\User::where('email', '!=', 'root@teamtask.com')->skip(1)->first(); - if ($teamAdmin && $team) { - // S'assurer qu'il soit admin de l'équipe - $team->users()->syncWithoutDetaching([$teamAdmin->id => ['role' => 'admin']]); - $teamAdmin->refresh(); - - echo "👤 Team Admin: " . $teamAdmin->name . "\n"; - echo "🏢 Peut supprimer équipe: " . ($teamAdmin->canDeleteTeam($team) ? "✅ OUI" : "❌ NON") . "\n"; - if ($project) { - echo "📂 Peut supprimer projet: " . ($teamAdmin->canDeleteProject($project) ? "✅ OUI" : "❌ NON") . "\n"; - } - if ($task) { - echo "📝 Peut supprimer tâche: " . ($teamAdmin->canDeleteTask($task) ? "✅ OUI" : "❌ NON") . "\n"; - } - if ($comment) { - echo "💬 Peut supprimer commentaire: " . ($teamAdmin->canDeleteComment($comment) ? "✅ OUI" : "❌ NON") . "\n"; - } - } - - echo "\n✅ Tests terminés avec succès !\n"; - -} catch (Exception $e) { - echo "❌ Erreur: " . $e->getMessage() . "\n"; - echo "📍 Fichier: " . $e->getFile() . ":" . $e->getLine() . "\n"; -} diff --git "a/upprimer \303\251quipe: \" . ($admin->canDeleteTeam($team) ? 'OUI' : 'NON') . \"n\"" "b/upprimer \303\251quipe: \" . ($admin->canDeleteTeam($team) ? 'OUI' : 'NON') . \"n\"" deleted file mode 100644 index 333a0b5..0000000 --- "a/upprimer \303\251quipe: \" . ($admin->canDeleteTeam($team) ? 'OUI' : 'NON') . \"n\"" +++ /dev/null @@ -1,258 +0,0 @@ - - SSUUMMMMAARRYY OOFF LLEESSSS CCOOMMMMAANNDDSS - - Commands marked with * may be preceded by a number, _N. - Notes in parentheses indicate the behavior if _N is given. - A key preceded by a caret indicates the Ctrl key; thus ^K is ctrl-K. - - h H Display this help. - q :q Q :Q ZZ Exit. - --------------------------------------------------------------------------- - - MMOOVVIINNGG - - e ^E j ^N CR * Forward one line (or _N lines). - y ^Y k ^K ^P * Backward one line (or _N lines). - f ^F ^V SPACE * Forward one window (or _N lines). - b ^B ESC-v * Backward one window (or _N lines). - z * Forward one window (and set window to _N). - w * Backward one window (and set window to _N). - ESC-SPACE * Forward one window, but don't stop at end-of-file. - d ^D * Forward one half-window (and set half-window to _N). - u ^U * Backward one half-window (and set half-window to _N). - ESC-) RightArrow * Right one half screen width (or _N positions). - ESC-( LeftArrow * Left one half screen width (or _N positions). - ESC-} ^RightArrow Right to last column displayed. - ESC-{ ^LeftArrow Left to first column. - F Forward forever; like "tail -f". - ESC-F Like F but stop when search pattern is found. - r ^R ^L Repaint screen. - R Repaint screen, discarding buffered input. - --------------------------------------------------- - Default "window" is the screen height. - Default "half-window" is half of the screen height. - --------------------------------------------------------------------------- - - SSEEAARRCCHHIINNGG - - /_p_a_t_t_e_r_n * Search forward for (_N-th) matching line. - ?_p_a_t_t_e_r_n * Search backward for (_N-th) matching line. - n * Repeat previous search (for _N-th occurrence). - N * Repeat previous search in reverse direction. - ESC-n * Repeat previous search, spanning files. - ESC-N * Repeat previous search, reverse dir. & spanning files. - ESC-u Undo (toggle) search highlighting. - ESC-U Clear search highlighting. - &_p_a_t_t_e_r_n * Display only matching lines. - --------------------------------------------------- - A search pattern may begin with one or more of: - ^N or ! Search for NON-matching lines. - ^E or * Search multiple files (pass thru END OF FILE). - ^F or @ Start search at FIRST file (for /) or last file (for ?). - ^K Highlight matches, but don't move (KEEP position). - ^R Don't use REGULAR EXPRESSIONS. - ^W WRAP search if no match found. - --------------------------------------------------------------------------- - - JJUUMMPPIINNGG - - g < ESC-< * Go to first line in file (or line _N). - G > ESC-> * Go to last line in file (or line _N). - p % * Go to beginning of file (or _N percent into file). - t * Go to the (_N-th) next tag. - T * Go to the (_N-th) previous tag. - { ( [ * Find close bracket } ) ]. - } ) ] * Find open bracket { ( [. - ESC-^F _<_c_1_> _<_c_2_> * Find close bracket _<_c_2_>. - ESC-^B _<_c_1_> _<_c_2_> * Find open bracket _<_c_1_>. - --------------------------------------------------- - Each "find close bracket" command goes forward to the close bracket - matching the (_N-th) open bracket in the top line. - Each "find open bracket" command goes backward to the open bracket - matching the (_N-th) close bracket in the bottom line. - - m_<_l_e_t_t_e_r_> Mark the current top line with . - M_<_l_e_t_t_e_r_> Mark the current bottom line with . - '_<_l_e_t_t_e_r_> Go to a previously marked position. - '' Go to the previous position. - ^X^X Same as '. - ESC-M_<_l_e_t_t_e_r_> Clear a mark. - --------------------------------------------------- - A mark is any upper-case or lower-case letter. - Certain marks are predefined: - ^ means beginning of the file - $ means end of the file - --------------------------------------------------------------------------- - - CCHHAANNGGIINNGG FFIILLEESS - - :e [_f_i_l_e] Examine a new file. - ^X^V Same as :e. - :n * Examine the (_N-th) next file from the command line. - :p * Examine the (_N-th) previous file from the command line. - :x * Examine the first (or _N-th) file from the command line. - :d Delete the current file from the command line list. - = ^G :f Print current file name. - --------------------------------------------------------------------------- - - MMIISSCCEELLLLAANNEEOOUUSS CCOOMMMMAANNDDSS - - -_<_f_l_a_g_> Toggle a command line option [see OPTIONS below]. - --_<_n_a_m_e_> Toggle a command line option, by name. - __<_f_l_a_g_> Display the setting of a command line option. - ___<_n_a_m_e_> Display the setting of an option, by name. - +_c_m_d Execute the less cmd each time a new file is examined. - - !_c_o_m_m_a_n_d Execute the shell command with $SHELL. - |XX_c_o_m_m_a_n_d Pipe file between current pos & mark XX to shell command. - s _f_i_l_e Save input to a file. - v Edit the current file with $VISUAL or $EDITOR. - V Print version number of "less". - --------------------------------------------------------------------------- - - OOPPTTIIOONNSS - - Most options may be changed either on the command line, - or from within less by using the - or -- command. - Options may be given in one of two forms: either a single - character preceded by a -, or a name preceded by --. - - -? ........ --help - Display help (from command line). - -a ........ --search-skip-screen - Search skips current screen. - -A ........ --SEARCH-SKIP-SCREEN - Search starts just after target line. - -b [_N] .... --buffers=[_N] - Number of buffers. - -B ........ --auto-buffers - Don't automatically allocate buffers for pipes. - -c ........ --clear-screen - Repaint by clearing rather than scrolling. - -d ........ --dumb - Dumb terminal. - -D xx_c_o_l_o_r . --color=xx_c_o_l_o_r - Set screen colors. - -e -E .... --quit-at-eof --QUIT-AT-EOF - Quit at end of file. - -f ........ --force - Force open non-regular files. - -F ........ --quit-if-one-screen - Quit if entire file fits on first screen. - -g ........ --hilite-search - Highlight only last match for searches. - -G ........ --HILITE-SEARCH - Don't highlight any matches for searches. - -h [_N] .... --max-back-scroll=[_N] - Backward scroll limit. - -i ........ --ignore-case - Ignore case in searches that do not contain uppercase. - -I ........ --IGNORE-CASE - Ignore case in all searches. - -j [_N] .... --jump-target=[_N] - Screen position of target lines. - -J ........ --status-column - Display a status column at left edge of screen. - -k [_f_i_l_e] . --lesskey-file=[_f_i_l_e] - Use a lesskey file. - -K ........ --quit-on-intr - Exit less in response to ctrl-C. - -L ........ --no-lessopen - Ignore the LESSOPEN environment variable. - -m -M .... --long-prompt --LONG-PROMPT - Set prompt style. - -n -N .... --line-numbers --LINE-NUMBERS - Don't use line numbers. - -o [_f_i_l_e] . --log-file=[_f_i_l_e] - Copy to log file (standard input only). - -O [_f_i_l_e] . --LOG-FILE=[_f_i_l_e] - Copy to log file (unconditionally overwrite). - -p [_p_a_t_t_e_r_n] --pattern=[_p_a_t_t_e_r_n] - Start at pattern (from command line). - -P [_p_r_o_m_p_t] --prompt=[_p_r_o_m_p_t] - Define new prompt. - -q -Q .... --quiet --QUIET --silent --SILENT - Quiet the terminal bell. - -r -R .... --raw-control-chars --RAW-CONTROL-CHARS - Output "raw" control characters. - -s ........ --squeeze-blank-lines - Squeeze multiple blank lines. - -S ........ --chop-long-lines - Chop (truncate) long lines rather than wrapping. - -t [_t_a_g] .. --tag=[_t_a_g] - Find a tag. - -T [_t_a_g_s_f_i_l_e] --tag-file=[_t_a_g_s_f_i_l_e] - Use an alternate tags file. - -u -U .... --underline-special --UNDERLINE-SPECIAL - Change handling of backspaces. - -V ........ --version - Display the version number of "less". - -w ........ --hilite-unread - Highlight first new line after forward-screen. - -W ........ --HILITE-UNREAD - Highlight first new line after any forward movement. - -x [_N[,...]] --tabs=[_N[,...]] - Set tab stops. - -X ........ --no-init - Don't use termcap init/deinit strings. - -y [_N] .... --max-forw-scroll=[_N] - Forward scroll limit. - -z [_N] .... --window=[_N] - Set size of window. - -" [_c[_c]] . --quotes=[_c[_c]] - Set shell quote characters. - -~ ........ --tilde - Don't display tildes after end of file. - -# [_N] .... --shift=[_N] - Set horizontal scroll amount (0 = one half screen width). - --file-size - Automatically determine the size of the input file. - --follow-name - The F command changes files if the input file is renamed. - --incsearch - Search file as each pattern character is typed in. - --line-num-width=N - Set the width of the -N line number field to N characters. - --mouse - Enable mouse input. - --no-keypad - Don't send termcap keypad init/deinit strings. - --no-histdups - Remove duplicates from command history. - --rscroll=C - Set the character used to mark truncated lines. - --save-marks - Retain marks across invocations of less. - --status-col-width=N - Set the width of the -J status column to N characters. - --use-backslash - Subsequent options use backslash as escape char. - --use-color - Enables colored text. - --wheel-lines=N - Each click of the mouse wheel moves N lines. - - - --------------------------------------------------------------------------- - - LLIINNEE EEDDIITTIINNGG - - These keys can be used to edit text being entered - on the "command line" at the bottom of the screen. - - RightArrow ..................... ESC-l ... Move cursor right one character. - LeftArrow ...................... ESC-h ... Move cursor left one character. - ctrl-RightArrow ESC-RightArrow ESC-w ... Move cursor right one word. - ctrl-LeftArrow ESC-LeftArrow ESC-b ... Move cursor left one word. - HOME ........................... ESC-0 ... Move cursor to start of line. - END ............................ ESC-$ ... Move cursor to end of line. - BACKSPACE ................................ Delete char to left of cursor. - DELETE ......................... ESC-x ... Delete char under cursor. - ctrl-BACKSPACE ESC-BACKSPACE ........... Delete word to left of cursor. - ctrl-DELETE .... ESC-DELETE .... ESC-X ... Delete word under cursor. - ctrl-U ......... ESC (MS-DOS only) ....... Delete entire line. - UpArrow ........................ ESC-k ... Retrieve previous command line. - DownArrow ...................... ESC-j ... Retrieve next command line. - TAB ...................................... Complete filename & cycle. - SHIFT-TAB ...................... ESC-TAB Complete filename & reverse cycle. - ctrl-L ................................... Complete filename, list all.