Skip to content

Commit 1db322f

Browse files
committed
update workflow checker to symfony 5
1 parent 7d2b782 commit 1db322f

File tree

2 files changed

+3
-28
lines changed

2 files changed

+3
-28
lines changed

src/PublishWorkflow/PublishWorkflowChecker.php

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -92,29 +92,12 @@ public function __construct(TokenStorageInterface $tokenStorage, AuthorizationCh
9292
$this->bypassingRole = $bypassingRole;
9393
}
9494

95-
/**
96-
* Checks if the access decision manager supports the given class.
97-
*
98-
* @param string $class A class name
99-
*
100-
* @return bool true if this decision manager can process the class
101-
*/
102-
public function supportsClass($class)
103-
{
104-
return $this->accessDecisionManager->supportsClass($class);
105-
}
106-
10795
/**
10896
* {@inheritdoc}
10997
*/
110-
public function isGranted($attributes, $object = null)
98+
public function isGranted($attribute, $object = null)
11199
{
112-
if (!\is_array($attributes)) {
113-
$attributes = [$attributes];
114-
}
115-
116-
if (1 === \count($attributes)
117-
&& self::VIEW_ATTRIBUTE === reset($attributes)
100+
if (self::VIEW_ATTRIBUTE === $attribute
118101
&& null !== $this->tokenStorage->getToken()
119102
&& $this->authorizationChecker->isGranted($this->bypassingRole)
120103
) {
@@ -128,6 +111,6 @@ public function isGranted($attributes, $object = null)
128111
$token = new AnonymousToken('', '');
129112
}
130113

131-
return $this->accessDecisionManager->decide($token, $attributes, $object);
114+
return $this->accessDecisionManager->decide($token, [$attribute], $object);
132115
}
133116
}

tests/Unit/PublishWorkflow/PublishWorkflowCheckerTest.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,4 @@ public function testNoFirewall()
109109

110110
$this->assertTrue($this->publishWorkflowChecker->isGranted(PublishWorkflowChecker::VIEW_ATTRIBUTE, $this->document));
111111
}
112-
113-
public function testSupportsClass()
114-
{
115-
$class = 'Test\Class';
116-
$this->accessDecisionManager->shouldReceive('supportsClass')->once()->with($class)->andReturn(true);
117-
118-
$this->assertTrue($this->publishWorkflowChecker->supportsClass($class));
119-
}
120112
}

0 commit comments

Comments
 (0)