Skip to content

Commit 1ec0854

Browse files
authored
Merge pull request #60 from silinternational/develop
Fix isEnrolled2Sv and isEnforced2Sv values
2 parents 3f837bf + fdfbf00 commit 1ec0854

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

SilMock/Google/Service/Directory/UsersResource.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,8 @@ public function insert($postBody)
165165
'lastLoginTime' => $currentDateTime->format('c'),
166166
'creationTime' => $currentDateTime->format('c'),
167167
'agreedToTerms' => false,
168+
'isEnforcedIn2Sv' => 'false',
169+
'isEnrolledIn2Sv' => 'false',
168170
);
169171

170172
// array_merge will not work, since $postBody is an object which only
@@ -202,7 +204,7 @@ public function insert($postBody)
202204
$newAlias->kind = "personal";
203205
$newAlias->primaryEmail = $postBody->primaryEmail;
204206

205-
$insertedAlias = $usersAliases->insertAssumingUserExists($newAlias);
207+
$usersAliases->insertAssumingUserExists($newAlias);
206208
}
207209
}
208210

@@ -240,6 +242,12 @@ public function update($userKey, $postBody)
240242
$dbUserProps[$key] = $value;
241243
}
242244
}
245+
if (!isset($dbUserProps['isEnforcedIn2Sv'])) {
246+
$dbUserProps['isEnforcedIn2Sv'] = 'false';
247+
}
248+
if (!isset($dbUserProps['isEnrolledIn2Sv'])) {
249+
$dbUserProps['isEnrolledIn2Sv'] = 'false';
250+
}
243251

244252
// Delete the user's old aliases before adding the new ones
245253
$usersAliases = new UsersAliasesResource($this->dbFile);
@@ -402,10 +410,11 @@ private function doesUserMatch($entry, $query = '')
402410
}
403411
if (! is_string($checkValue)) {
404412
throw new \Exception(sprintf(
405-
"Expecting a string.\nGot Entry: %s\nGot Field: %s\nGot VALUE: %s",
413+
"Expecting a string.\nGot Entry: %s\nGot Field: %s\nGot VALUE: %s (%s)",
406414
var_export($entry, true),
407415
var_export($field, true),
408-
var_export($checkValue, true)
416+
var_export($checkValue, true),
417+
gettype($checkValue)
409418
));
410419
}
411420
if (mb_strpos($checkValue, $value) === 0) {

0 commit comments

Comments
 (0)