diff --git a/Common/src/Common/Rbac/User.php b/Common/src/Common/Rbac/User.php index f7dcb7df7..44a1f25d5 100644 --- a/Common/src/Common/Rbac/User.php +++ b/Common/src/Common/Rbac/User.php @@ -208,4 +208,9 @@ public function hasRole($role): bool { return in_array($role, $this->getRoles(), true); } + + public function hasAgreedTerms(): bool + { + return $this->userData['termsAgreed']; + } } diff --git a/test/Common/src/Common/Rbac/UserTest.php b/test/Common/src/Common/Rbac/UserTest.php index 847170c0f..036d68953 100644 --- a/test/Common/src/Common/Rbac/UserTest.php +++ b/test/Common/src/Common/Rbac/UserTest.php @@ -1,5 +1,7 @@ assertEquals($roles, $this->sut->getRoles()); $this->assertFalse($this->sut->hasRole(RefData::ROLE_INTERNAL_ADMIN)); } + + public function testHasAgreedTermsTrue(): void + { + $userData = ['termsAgreed' => true]; + $this->sut->setUserData($userData); + $this->assertTrue($this->sut->hasAgreedTerms()); + } + + public function testHasAgreedTermsFalse(): void + { + $userData = ['termsAgreed' => false]; + $this->sut->setUserData($userData); + $this->assertFalse($this->sut->hasAgreedTerms()); + } }