public function setGroupPath($groupPath, $update = false)
 {
     if ($update && isset($this->groupPath) && $this->groupPath != $groupPath) {
         $children = $this->getChildrenPointer();
         if (is_array($children)) {
             foreach ($children as $userId) {
                 // UPDATE USER GROUP AND ROLES
                 $u = ConfService::getConfStorageImpl()->createUserObject($userId);
                 $u->setGroupPath($groupPath);
                 $r = $u->getRoles();
                 // REMOVE OLD GROUP ROLES
                 foreach (array_keys($r) as $role) {
                     if (strpos($role, "AJXP_GRP_/") === 0) {
                         $u->removeRole($role);
                     }
                 }
                 $u->recomputeMergedRole();
                 $u->save("superuser");
             }
         }
     }
     parent::setGroupPath($groupPath);
     $groups = AJXP_Utils::loadSerialFile(AJXP_VarsFilter::filter($this->storage->getOption("USERS_DIRPATH")) . "/groups.ser");
     $groups[$this->getId()] = $groupPath;
     AJXP_Utils::saveSerialFile(AJXP_VarsFilter::filter($this->storage->getOption("USERS_DIRPATH")) . "/groups.ser", $groups);
 }
 public function setGroupPath($groupPath, $update = false)
 {
     if ($update && isset($this->groupPath) && $groupPath != $this->groupPath) {
         // Update Shared Users groups as well
         $res = dibi::query("SELECT [u.login] FROM [ajxp_users] AS u, [ajxp_user_rights] AS p WHERE [u.login] = [p.login] AND [p.repo_uuid] = %s AND [p.rights] = %s AND [u.groupPath] != %s ", "ajxp.parent_user", $this->getId(), $groupPath);
         foreach ($res as $row) {
             $userId = $row->login;
             // UPDATE USER GROUP AND ROLES
             $u = ConfService::getConfStorageImpl()->createUserObject($userId);
             $u->setGroupPath($groupPath);
             $r = $u->getRoles();
             // REMOVE OLD GROUP ROLES
             foreach (array_keys($r) as $role) {
                 if (strpos($role, "AJXP_GRP_/") === 0) {
                     $u->removeRole($role);
                 }
             }
             $u->recomputeMergedRole();
             $u->save("superuser");
         }
     }
     parent::setGroupPath($groupPath);
     dibi::query('UPDATE [ajxp_users] SET ', array('groupPath' => $groupPath), 'WHERE [login] = %s', $this->getId());
     $this->log('UPDATE GROUP: [Login]: ' . $this->getId() . ' [Group]:' . $groupPath);
 }