File tree Expand file tree Collapse file tree 2 files changed +46
-1
lines changed
spec/EcPhp/EuLoginBundle/Security/Core/User Expand file tree Collapse file tree 2 files changed +46
-1
lines changed Original file line number Diff line number Diff line change 99
1010class EuLoginUserSpec extends ObjectBehavior
1111{
12+ public function it_can_get_groups_when_no_groups_are_available ()
13+ {
14+ $ data = [
15+ 'user ' => 'user ' ,
16+ 'departmentNumber ' => 'departmentNumber ' ,
17+ 'email ' => 'email ' ,
18+ 'employeeNumber ' => 'employeeNumber ' ,
19+ 'employeeType ' => 'employeeType ' ,
20+ 'firstName ' => 'firstName ' ,
21+ 'lastName ' => 'lastName ' ,
22+ 'domain ' => 'domain ' ,
23+ 'domainUsername ' => 'domainUsername ' ,
24+ 'telephoneNumber ' => 'telephoneNumber ' ,
25+ 'locale ' => 'locale ' ,
26+ 'assuranceLevel ' => 'assuranceLevel ' ,
27+ 'uid ' => 'uid ' ,
28+ 'orgId ' => 'orgId ' ,
29+ 'teleworkingPriority ' => 'teleworkingPriority ' ,
30+ 'strengths ' => [
31+ 'bar ' ,
32+ ],
33+ 'authenticationFactors ' => [
34+ 'foobar ' ,
35+ ],
36+ 'loginDate ' => 'loginDate ' ,
37+ 'sso ' => 'sso ' ,
38+ 'ticketType ' => 'ticketType ' ,
39+ 'proxyGrantingProtocol ' => 'proxyGrantingProtocol ' ,
40+ 'proxyGrantingTicket ' => 'proxyGrantingTicket ' ,
41+ 'proxies ' => [
42+ 'proxy1 ' ,
43+ ],
44+ ];
45+
46+ $ this
47+ ->beConstructedWith ($ data );
48+
49+ $ this
50+ ->getGroups ()
51+ ->shouldReturn ([]);
52+ }
53+
1254 public function it_can_get_specific_attribute ()
1355 {
1456 $ this
Original file line number Diff line number Diff line change 66
77use EcPhp \CasBundle \Security \Core \User \CasUser ;
88
9+ use function array_key_exists ;
10+ use function is_array ;
11+
912/**
1013 * Class EuLoginUser.
1114 */
@@ -194,7 +197,7 @@ public function getRoles()
194197 $ default = ['ROLE_CAS_AUTHENTICATED ' ];
195198
196199 if ([] !== $ roles = $ this ->getGroups ()) {
197- if (isset ($ roles ['group ' ])) {
200+ if (true === array_key_exists ( ' group ' , $ roles ) && true === is_array ($ roles ['group ' ])) {
198201 return array_merge ($ roles ['group ' ], $ default );
199202 }
200203 }
You can’t perform that action at this time.
0 commit comments