protected function checkUserInTest1(UserAccountModel $user)
 {
     $this->assertEquals("test", $user->getUsername());
     $this->assertEquals("*****@*****.**", $user->getEmail());
     $this->assertEquals(false, $user->checkPassword("1234"));
     $this->assertEquals(true, $user->checkPassword("password"));
     $this->assertEquals(false, $user->getIsEmailVerified());
     $this->assertEquals(false, $user->getIsSystemAdmin());
     $this->assertEquals(true, $user->getIsEditor());
 }
 function __construct(ExtensionManager $extensionManager, $permissions, \models\UserAccountModel $userAccountModel = null, $removeEditorPermissions = false, $includeChildrenPermissions = false)
 {
     if ($userAccountModel) {
         $this->has_user = true;
         $this->has_user_editor = $userAccountModel->getIsEditor();
         $this->has_user_verified = $userAccountModel->getIsEmailVerified();
         $this->has_user_system_administrator = $userAccountModel->getIsSystemAdmin();
     }
     $this->removeEditorPermissions = $removeEditorPermissions;
     $this->permissions = array();
     // Add direct permissions, checking user stats as we do so.
     foreach ($permissions as $permission) {
         $this->addPermission($permission);
     }
     // now add children
     if ($includeChildrenPermissions) {
         $loopCount = 0;
         do {
             $loopCount++;
             $addedAny = false;
             foreach ($extensionManager->getExtensionsIncludingCore() as $extension) {
                 foreach ($extension->getUserPermissions() as $possibleChildID) {
                     $possibleChildPermission = $extension->getUserPermission($possibleChildID);
                     if (!$this->hasPermission($extension->getId(), $possibleChildID)) {
                         $addThisOne = false;
                         foreach ($possibleChildPermission->getParentPermissionsIDs() as $parentData) {
                             if (!$addThisOne && $this->hasPermission($parentData[0], $parentData[1])) {
                                 $addThisOne = true;
                             }
                         }
                         if ($addThisOne) {
                             $this->addPermission($possibleChildPermission);
                             $addedAny = true;
                         }
                     }
                 }
             }
         } while ($addedAny && $loopCount < 100);
     }
 }
 public function edit(UserAccountModel $user)
 {
     global $DB;
     $stat = $DB->prepare("UPDATE user_account_information SET  is_editor=:is_editor, is_system_admin=:is_system_admin WHERE id =:id");
     $stat->execute(array('id' => $user->getId(), 'is_editor' => $user->getIsEditor() ? 1 : 0, 'is_system_admin' => $user->getIsSystemAdmin() ? 1 : 0));
 }