Changeset 190db9f
- Timestamp:
- 11/01/21 11:18:15 (3 years ago)
- Branches:
- master
- Children:
- d95fdd2
- Parents:
- 1451c6f
- Files:
-
- 3 deleted
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
app/Http/Controllers/Dashboard/DepartmentsController.php
r1451c6f r190db9f 11 11 use App\Models\User; 12 12 use App\Notifications\NewDepartmentCreated; 13 use App\Notifications\NewFolderCreated; 13 14 use Carbon\Carbon; 14 15 use App\Http\Controllers\Controller; -
app/Http/Controllers/Dashboard/FoldersController.php
r1451c6f r190db9f 151 151 152 152 $users = User::all(); 153 Notification::send($users, new NewFolderCreated("New folder created"));154 153 155 154 $folder->location = $location; … … 246 245 } 247 246 248 if (auth()->user()->hasPermission("delete_ all_folders")) {247 if (auth()->user()->hasPermission("delete_data")) { 249 248 250 249 foreach ($files as $file) { -
app/Http/Requests/Dashboard/FolderRequest.php
r1451c6f r190db9f 19 19 if ($this->isMethod("patch")) { 20 20 $folder = Folder::find($this->route("id")); 21 return auth()->user()->hasPermission(" edit_all_folders") || ($folder->user->id == auth()->user()->id);21 return auth()->user()->hasPermission("manage_all_folders") || ($folder->user->id == auth()->user()->id); 22 22 } 23 23 -
database/seeders/PermissionsTableSeeder.php
r1451c6f r190db9f 23 23 ["id" => "5", "name" => "view_all_departments"], // Access all departments to view 24 24 ["id" => "6", "name" => "view_all_folders"], // Access all folders to view 25 ["id" => "7", "name" => "edit_all_folders"], // Edit all folders 26 ["id" => "8", "name" => "edit_folder"], // Edit your folder/s 27 ["id" => "9", "name" => "delete_all_folders"], // Delete all folder/s 28 ["id" => "10", "name" => "delete_folder"], // Delete your folder/s 29 ["id" => "11", "name" => "view_all_files"], // View all files 30 ["id" => "12", "name" => "manage_all_files"], // Manage all files 31 ["id" => "13", "name" => "manage_file_types"], // Access file types 32 ["id" => "14", "name" => "edit_user_data"], // Access file types 33 ["id" => "15", "name" => "export_data"], // Export data 34 ["id" => "16", "name" => "download_data"], // Download data 25 ["id" => "7", "name" => "view_all_files"], // View all files 26 ["id" => "8", "name" => "manage_all_files"], // Manage all files 27 ["id" => "9", "name" => "manage_file_types"], // Access file types 28 ["id" => "10", "name" => "export_data"], // Export data 29 ["id" => "11", "name" => "download_data"], // Download data 30 ["id" => "12", "name" => "delete_data"], // Delete data 35 31 ]); 36 32 } -
database/seeders/RolesPermissionsTableSeeder.php
r1451c6f r190db9f 28 28 ["role_id" => 1, "permission_id" => 11], 29 29 ["role_id" => 1, "permission_id" => 12], 30 ["role_id" => 1, "permission_id" => 13],31 ["role_id" => 1, "permission_id" => 14],32 ["role_id" => 1, "permission_id" => 15],33 ["role_id" => 1, "permission_id" => 16],34 30 35 31 // Referent 36 32 ["role_id" => 2, "permission_id" => 1], 33 ["role_id" => 2, "permission_id" => 3], 37 34 ["role_id" => 2, "permission_id" => 4], 38 35 ["role_id" => 2, "permission_id" => 5], … … 40 37 ["role_id" => 2, "permission_id" => 7], 41 38 ["role_id" => 2, "permission_id" => 8], 42 ["role_id" => 2, "permission_id" => 9],43 ["role_id" => 2, "permission_id" => 10],44 39 ["role_id" => 2, "permission_id" => 11], 45 ["role_id" => 2, "permission_id" => 12],46 ["role_id" => 2, "permission_id" => 14],47 ["role_id" => 2, "permission_id" => 15],48 ["role_id" => 2, "permission_id" => 16],49 40 50 41 // Viewer 51 42 ["role_id" => 3, "permission_id" => 5], 52 43 ["role_id" => 3, "permission_id" => 6], 53 ["role_id" => 3, "permission_id" => 11] 44 ["role_id" => 3, "permission_id" => 7], 45 ["role_id" => 3, "permission_id" => 11], 54 46 ]); 55 47 } -
resources/views/dashboard/departments/index.blade.php
r1451c6f r190db9f 89 89 </a> 90 90 @endif 91 @if(auth()->user()->hasPermission('delete_data')) 91 92 <a href="javascript:void(0)" class="text-danger ml-2" data-toggle="modal" data-target="#deleteModal_{{$department->id}}" title="Delete"> 92 93 <i class="ti-trash"></i> 93 94 </a> 95 @endif 94 96 </td> 95 97 @else -
resources/views/dashboard/files/index.blade.php
r1451c6f r190db9f 109 109 <i class="ti-download"></i> 110 110 </a> 111 @if(auth()->user()->hasPermission('delete_data')) 111 112 <a href="javascript:void(0)" class="text-danger ml-2" data-toggle="modal" data-target="#deleteModal_{{$file->id}}" title="Delete"> 112 113 <i class="ti-trash"></i> 113 114 </a> 115 @endif 114 116 </td> 115 117 @else -
resources/views/dashboard/folders/files.blade.php
r1451c6f r190db9f 107 107 </a> 108 108 @endif 109 @if(auth()->user()->hasPermission(' manage_all_files'))109 @if(auth()->user()->hasPermission('delete_data')) 110 110 <a href="javascript:void(0)" class="dropdown-item" data-toggle="modal" data-target="#deleteModal_{{$file->id}}"> 111 111 Delete -
resources/views/dashboard/folders/index.blade.php
r1451c6f r190db9f 152 152 <a href="{{ route("dashboard.folders.downloadFolder", ['id' => $folder->id]) }}" class="dropdown-item">Download</a> 153 153 @endif 154 @if(auth()->user()->hasPermission(' manage_all_folders'))154 @if(auth()->user()->hasPermission('delete_data')) 155 155 <a href="javascript:void(0)" class="dropdown-item" data-toggle="modal" data-target="#deleteModal_{{$folder->id}}">Delete</a> 156 156 @endif -
routes/web.php
r1451c6f r190db9f 88 88 Route::get("/departments/{id}/edit", "Dashboard\DepartmentsController@editShow")->name("dashboard.departments.editShow"); 89 89 Route::patch("/departments/{id}/edit", "Dashboard\DepartmentsController@edit")->name("dashboard.departments.edit"); 90 Route::delete("/departments/{id}/destroy", "Dashboard\DepartmentsController@destroy")->name("dashboard.departments.destroy");91 90 }); 92 91 … … 102 101 Route::post("/folders/store", "Dashboard\FoldersController@store")->name("dashboard.folders.store"); 103 102 Route::get("/folders/{id}/edit", "Dashboard\FoldersController@editShow")->name("dashboard.folders.editShow"); 104 Route::delete("/folders/{id}/destroy", "Dashboard\FoldersController@destroy")->name("dashboard.folders.destroy");105 103 Route::post("/folders/{id}/upload", "Dashboard\FoldersController@uploadFiles")->name("dashboard.folders.uploadFiles"); 106 107 104 }); 108 105 … … 114 111 //Files manage 115 112 Route::group(['middleware' => 'permission:manage_all_files'], function () { 116 Route::patch("files/{id}/rename-file", "Dashboard\FilesController@renameFile")->name("dashboard.files.renameFile");117 113 Route::post("/files/store", "Dashboard\FilesController@store")->name("dashboard.files.store"); 118 Route::delete("files/{id}/delete-file", "Dashboard\FilesController@deleteFile")->name("dashboard.files.deleteFile");119 114 }); 120 115 … … 134 129 Route::get('/departments/{id}/download-department', 'Dashboard\DepartmentsController@downloadDepartment')->name('dashboard.departments.downloadDepartment'); 135 130 }); 131 132 //Delete data 133 Route::group(['middleware' => 'permission:delete_data'], function() { 134 Route::delete("files/{id}/delete-file", "Dashboard\FilesController@deleteFile")->name("dashboard.files.deleteFile"); 135 Route::delete("/folders/{id}/destroy", "Dashboard\FoldersController@destroy")->name("dashboard.folders.destroy"); 136 Route::delete("/departments/{id}/destroy", "Dashboard\DepartmentsController@destroy")->name("dashboard.departments.destroy"); 137 }); 136 138 });
Note:
See TracChangeset
for help on using the changeset viewer.