A free open source IT asset/license management system
more sharing framewor. tests outlines
akemidx60f5affe434e
diff --git a/app/Models/ReportTemplate.php b/app/Models/ReportTemplate.phpindex a0612fa157..1d73ce1684 100644--- a/app/Models/ReportTemplate.php+++ b/app/Models/ReportTemplate.php@@ -40,13 +40,13 @@ class ReportTemplate extends Modelprotected static function booted(){// Scope to current user- static::addGlobalScope(- 'current_user', function (Builder $builder) {- if (auth()->check()) {- $builder->where('created_by', auth()->id());- }- }- );+// static::addGlobalScope(+// 'current_user', function (Builder $builder) {+// if (auth()->check()) {+// $builder->where('created_by', auth()->id());+// }+// }+// );}/**diff --git a/resources/views/reports/custom.blade.php b/resources/views/reports/custom.blade.phpindex 5379c9e473..d30fcbcc58 100644--- a/resources/views/reports/custom.blade.php+++ b/resources/views/reports/custom.blade.php@@ -80,7 +80,7 @@</div></div>- @if($template->created_by == User::class('users.id'))+ @if($template->created_by)<div class="col-md-7 col-md-offset-7"><label class="form-control"><input type="checkbox" name="shared_report_template" value="1" @checked($template->checkmarkValue('shared_report_template')) />diff --git a/tests/Unit/Models/ReportTemplates/ReportTemplateParsingValuesTest.php b/tests/Unit/Models/ReportTemplates/ReportTemplateParsingValuesTest.phpindex 91bd8979d0..77696468aa 100644--- a/tests/Unit/Models/ReportTemplates/ReportTemplateParsingValuesTest.php+++ b/tests/Unit/Models/ReportTemplates/ReportTemplateParsingValuesTest.php@@ -4,6 +4,7 @@ namespace Tests\Unit\Models\ReportTemplates;use App\Models\Department;use App\Models\Location;+use App\Models\User;use App\Models\ReportTemplate;use PHPUnit\Framework\Attributes\Group;use Tests\TestCase;@@ -206,4 +207,27 @@ class ReportTemplateParsingValuesTest extends TestCase$templateWithModelIdsInArray->selectValue('array_of_model_ids', Department::class));}++ public function testSharingTemplateIsSeenByOnlyCorrectGroup()+ {+ $sharedUser = User::factory()->create();++ $sharedTemplate = ReportTemplate::factory()->create([++ ]);++ //$this->assertEquals(1, $sharedTemplate->group_id);+ }++ public function testSharedTemplateCanOnlyBeEditedByCreator()+ {+ $sharedUser = User::factory()->create();++ $sharedTemplate = ReportTemplate::factory()->create([++ ]);++ //$this->assertEquals($sharedUser->id, $sharedTemplate->creator->id);+ }+}