This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Symbiote\AdvancedWorkflow\Tests; |
||
| 4 | |||
| 5 | use SilverStripe\Dev\SapphireTest; |
||
| 6 | use Symbiote\AdvancedWorkflow\DataObjects\WorkflowDefinition; |
||
| 7 | |||
| 8 | /** |
||
| 9 | * Tests for permissions on all Workflow Objects. |
||
| 10 | * These will obviousely need to be modified should additional workflow permissions come online. |
||
| 11 | * |
||
| 12 | * @author [email protected] |
||
| 13 | * @license BSD License (http://silverstripe.org/bsd-license/) |
||
| 14 | * @package advancedworkflow |
||
| 15 | * @subpackage tests |
||
| 16 | */ |
||
| 17 | class WorkflowPermissionsTest extends SapphireTest |
||
| 18 | { |
||
| 19 | /** |
||
| 20 | * @var string |
||
| 21 | */ |
||
| 22 | protected static $fixture_file = 'workflowpermissions.yml'; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * Tests whether members with differing permissions, should be able to create & edit WorkflowDefinitions |
||
| 26 | */ |
||
| 27 | public function testWorkflowDefinitionCanPerms() |
||
| 28 | { |
||
| 29 | // Very limited perms. No create. |
||
| 30 | $this->logInWithPermission('CMS_ACCESS_AdvancedWorkflowAdmin'); |
||
| 31 | $workflowdef = $this->objFromFixture(WorkflowDefinition::class, 'no-actions'); |
||
| 32 | $this->assertFalse($workflowdef->canCreate()); |
||
| 33 | |||
| 34 | // Limited perms. No create. |
||
| 35 | $this->logInWithPermission('VIEW_ACTIVE_WORKFLOWS'); |
||
| 36 | $workflowdef = $this->objFromFixture(WorkflowDefinition::class, 'no-actions'); |
||
| 37 | $this->assertFalse($workflowdef->canCreate()); |
||
| 38 | |||
| 39 | // Has perms. Can create. |
||
| 40 | $this->logInWithPermission('CREATE_WORKFLOW'); |
||
| 41 | $workflowdef = $this->objFromFixture(WorkflowDefinition::class, 'no-actions'); |
||
| 42 | $this->assertTrue($workflowdef->canCreate()); |
||
| 43 | |||
| 44 | // Limited perms. No delete |
||
| 45 | $this->logInWithPermission('CREATE_WORKFLOW'); |
||
| 46 | $workflowdef = $this->objFromFixture(WorkflowDefinition::class, 'no-actions'); |
||
| 47 | $this->assertFalse($workflowdef->canDelete()); |
||
| 48 | |||
| 49 | // Has perms. No delete |
||
| 50 | $this->logInWithPermission('DELETE_WORKFLOW'); |
||
| 51 | $workflowdef = $this->objFromFixture(WorkflowDefinition::class, 'no-actions'); |
||
| 52 | $this->assertTrue($workflowdef->canDelete()); |
||
| 53 | } |
||
| 54 | |||
| 55 | /** |
||
| 56 | * Tests whether members with differing permissions, should be able to create & edit WorkflowActions |
||
| 57 | */ |
||
| 58 | public function testWorkflowActionCanPerms() |
||
| 59 | { |
||
| 60 | // Very limited perms. No create. |
||
| 61 | $this->logInWithPermission('CMS_ACCESS_AdvancedWorkflowAdmin'); |
||
| 62 | $workflowdef = $this->objFromFixture(WorkflowDefinition::class, 'with-actions'); |
||
| 63 | $this->assertFalse($workflowdef->Actions()->first()->canCreate()); |
||
|
0 ignored issues
–
show
|
|||
| 64 | $this->assertFalse($workflowdef->Actions()->first()->canEdit()); |
||
|
0 ignored issues
–
show
The method
Actions() does not exist on SilverStripe\ORM\DataObject. Did you maybe mean getCMSActions()?
This check marks calls to methods that do not seem to exist on an object. This is most likely the result of a method being renamed without all references to it being renamed likewise. Loading history...
|
|||
| 65 | $this->assertFalse($workflowdef->Actions()->first()->canDelete()); |
||
|
0 ignored issues
–
show
The method
Actions() does not exist on SilverStripe\ORM\DataObject. Did you maybe mean getCMSActions()?
This check marks calls to methods that do not seem to exist on an object. This is most likely the result of a method being renamed without all references to it being renamed likewise. Loading history...
|
|||
| 66 | |||
| 67 | // Limited perms. No create or delete. |
||
| 68 | $this->logInWithPermission('VIEW_ACTIVE_WORKFLOWS'); |
||
| 69 | $workflowdef = $this->objFromFixture(WorkflowDefinition::class, 'with-actions'); |
||
| 70 | $this->assertFalse($workflowdef->Actions()->first()->canCreate()); |
||
|
0 ignored issues
–
show
The method
Actions() does not exist on SilverStripe\ORM\DataObject. Did you maybe mean getCMSActions()?
This check marks calls to methods that do not seem to exist on an object. This is most likely the result of a method being renamed without all references to it being renamed likewise. Loading history...
|
|||
| 71 | $this->assertFalse($workflowdef->Actions()->first()->canCreate()); |
||
|
0 ignored issues
–
show
The method
Actions() does not exist on SilverStripe\ORM\DataObject. Did you maybe mean getCMSActions()?
This check marks calls to methods that do not seem to exist on an object. This is most likely the result of a method being renamed without all references to it being renamed likewise. Loading history...
|
|||
| 72 | $this->assertFalse($workflowdef->Actions()->first()->canDelete()); |
||
|
0 ignored issues
–
show
The method
Actions() does not exist on SilverStripe\ORM\DataObject. Did you maybe mean getCMSActions()?
This check marks calls to methods that do not seem to exist on an object. This is most likely the result of a method being renamed without all references to it being renamed likewise. Loading history...
|
|||
| 73 | |||
| 74 | // Has perms. Can create. |
||
| 75 | $this->logInWithPermission('CREATE_WORKFLOW'); |
||
| 76 | $workflowdef = $this->objFromFixture(WorkflowDefinition::class, 'with-actions'); |
||
| 77 | $this->assertTrue($workflowdef->Actions()->first()->canCreate()); |
||
|
0 ignored issues
–
show
The method
Actions() does not exist on SilverStripe\ORM\DataObject. Did you maybe mean getCMSActions()?
This check marks calls to methods that do not seem to exist on an object. This is most likely the result of a method being renamed without all references to it being renamed likewise. Loading history...
|
|||
| 78 | $this->assertTrue($workflowdef->Actions()->first()->canEdit()); |
||
|
0 ignored issues
–
show
The method
Actions() does not exist on SilverStripe\ORM\DataObject. Did you maybe mean getCMSActions()?
This check marks calls to methods that do not seem to exist on an object. This is most likely the result of a method being renamed without all references to it being renamed likewise. Loading history...
|
|||
| 79 | |||
| 80 | // Limited perms. No Delete |
||
| 81 | $this->assertFalse($workflowdef->Actions()->first()->canDelete()); |
||
|
0 ignored issues
–
show
The method
Actions() does not exist on SilverStripe\ORM\DataObject. Did you maybe mean getCMSActions()?
This check marks calls to methods that do not seem to exist on an object. This is most likely the result of a method being renamed without all references to it being renamed likewise. Loading history...
|
|||
| 82 | } |
||
| 83 | |||
| 84 | /** |
||
| 85 | * Tests whether members with differing permissions, should be able to create & edit WorkflowActions |
||
| 86 | */ |
||
| 87 | public function testWorkflowTransitionPerms() |
||
| 88 | { |
||
| 89 | // Very limited perms. No create. |
||
| 90 | $this->logInWithPermission('CMS_ACCESS_AdvancedWorkflowAdmin'); |
||
| 91 | $workflowdef = $this->objFromFixture(WorkflowDefinition::class, 'with-actions-and-transitions'); |
||
| 92 | $this->assertFalse($workflowdef->Actions()->first()->Transitions()->first()->canCreate()); |
||
|
0 ignored issues
–
show
The method
Actions() does not exist on SilverStripe\ORM\DataObject. Did you maybe mean getCMSActions()?
This check marks calls to methods that do not seem to exist on an object. This is most likely the result of a method being renamed without all references to it being renamed likewise. Loading history...
|
|||
| 93 | $this->assertFalse($workflowdef->Actions()->first()->Transitions()->first()->canEdit()); |
||
|
0 ignored issues
–
show
The method
Actions() does not exist on SilverStripe\ORM\DataObject. Did you maybe mean getCMSActions()?
This check marks calls to methods that do not seem to exist on an object. This is most likely the result of a method being renamed without all references to it being renamed likewise. Loading history...
|
|||
| 94 | $this->assertFalse($workflowdef->Actions()->first()->Transitions()->first()->canDelete()); |
||
|
0 ignored issues
–
show
The method
Actions() does not exist on SilverStripe\ORM\DataObject. Did you maybe mean getCMSActions()?
This check marks calls to methods that do not seem to exist on an object. This is most likely the result of a method being renamed without all references to it being renamed likewise. Loading history...
|
|||
| 95 | |||
| 96 | // Limited perms. No create. |
||
| 97 | $this->logInWithPermission('VIEW_ACTIVE_WORKFLOWS'); |
||
| 98 | $workflowdef = $this->objFromFixture(WorkflowDefinition::class, 'with-actions-and-transitions'); |
||
| 99 | $this->assertFalse($workflowdef->Actions()->first()->Transitions()->first()->canCreate()); |
||
|
0 ignored issues
–
show
The method
Actions() does not exist on SilverStripe\ORM\DataObject. Did you maybe mean getCMSActions()?
This check marks calls to methods that do not seem to exist on an object. This is most likely the result of a method being renamed without all references to it being renamed likewise. Loading history...
|
|||
| 100 | $this->assertFalse($workflowdef->Actions()->first()->Transitions()->first()->canEdit()); |
||
|
0 ignored issues
–
show
The method
Actions() does not exist on SilverStripe\ORM\DataObject. Did you maybe mean getCMSActions()?
This check marks calls to methods that do not seem to exist on an object. This is most likely the result of a method being renamed without all references to it being renamed likewise. Loading history...
|
|||
| 101 | $this->assertFalse($workflowdef->Actions()->first()->Transitions()->first()->canDelete()); |
||
|
0 ignored issues
–
show
The method
Actions() does not exist on SilverStripe\ORM\DataObject. Did you maybe mean getCMSActions()?
This check marks calls to methods that do not seem to exist on an object. This is most likely the result of a method being renamed without all references to it being renamed likewise. Loading history...
|
|||
| 102 | |||
| 103 | // Has perms. Can create. |
||
| 104 | $this->logInWithPermission('CREATE_WORKFLOW'); |
||
| 105 | $workflowdef = $this->objFromFixture(WorkflowDefinition::class, 'with-actions-and-transitions'); |
||
| 106 | $this->assertTrue($workflowdef->Actions()->first()->Transitions()->first()->canCreate()); |
||
|
0 ignored issues
–
show
The method
Actions() does not exist on SilverStripe\ORM\DataObject. Did you maybe mean getCMSActions()?
This check marks calls to methods that do not seem to exist on an object. This is most likely the result of a method being renamed without all references to it being renamed likewise. Loading history...
|
|||
| 107 | $this->assertTrue($workflowdef->Actions()->first()->Transitions()->first()->canEdit()); |
||
|
0 ignored issues
–
show
The method
Actions() does not exist on SilverStripe\ORM\DataObject. Did you maybe mean getCMSActions()?
This check marks calls to methods that do not seem to exist on an object. This is most likely the result of a method being renamed without all references to it being renamed likewise. Loading history...
|
|||
| 108 | $this->assertTrue($workflowdef->Actions()->first()->Transitions()->first()->canDelete()); |
||
|
0 ignored issues
–
show
The method
Actions() does not exist on SilverStripe\ORM\DataObject. Did you maybe mean getCMSActions()?
This check marks calls to methods that do not seem to exist on an object. This is most likely the result of a method being renamed without all references to it being renamed likewise. Loading history...
|
|||
| 109 | } |
||
| 110 | } |
||
| 111 |
This check marks calls to methods that do not seem to exist on an object.
This is most likely the result of a method being renamed without all references to it being renamed likewise.