Rene-AJM-Veerman commented on issue #5749:
URL: https://github.com/apache/couchdb/issues/5749#issuecomment-3573906362

   Ok many thanks already..
   
   I was just following the release schedule for couchdb; so yeah, 3.5.0 before 
this.
   And it all started failing after the upgrade, for sure.
   
   auth params i got very simple under chttpd_auth (to use the _users db), not 
under the default couch_httpd_auth because /opt/couchdb/etc/couchdb.ini lists 
that as the better spot for it.
   but I still can't log in.
   not even when I create new regular user in _users database, not even in 
Fauxton! :(
   
   it was for a regular user.
   I do use underscores in the username.
   
   And the logs do not show any errors; they just show my 'Guest' account 
working just fine.
   This is also the biggest mystery of 'm all here; why does the Guest account 
even work?
   PHP to generate it reads :
   ````
   
       public function createGuestUser() {
           $userName = 'Guest';
           $roles = [ 'Guests' ];
           $uid = 
'org.couchdb.user:'.$this->translate_plainUserName_to_couchdbUserName($userName);
           global $naWebOS;
           $dn = $this->dataSetName_domainName($naWebOS->domainFolder);
   
           $this->cdb->setDatabase('_users',true);
           try {
               $rec = array (
                   '_id' => $uid,
                   'name' => 
$this->translate_plainUserName_to_couchdbUserName($userName),
                   'password' => 'Guest',
                   'realname' => 'Random Guest',
                   'email' => '-noValidEmailSetInDatabase-',
                   'roles' => $roles, // a CouchDB 'role' is a SQL 'group'.
                   'type' => "user"
               );
               $got = true;
               try { $call = $this->cdb->get($uid); } catch (Exception $e) { 
$got = false; }
               if ($got) $rec['_rev'] = $call->body->_rev;
               $call = $this->cdb->post ($rec);
               if ($call->body->ok) echo (!$got?'Created ':'Updated 
').$this->translate_plainUserName_to_couchdbUserName($userName).' user document 
in database _users.<br/>'; else echo '<span style="color:red">Could not 
'.(!$got?'create ':'update 
').$this->translate_plainUserName_to_couchdbUserName($userName).' user document 
in database _users.</span><br/>';
           } catch (Exception $e) {
               echo '<h1 style="color:red">Could not create record for user 
"Guest" in "_users" couchdb database :-(</h1>'.PHP_EOL;
               echo '<pre style="color:red;font-weight:bold">'; var_dump ($e); 
echo '</pre>';
           }
   
           $dataSetName = $this->dataSetName('groups');
           try { $this->cdb->deleteDatabase ($dataSetName); } catch (Exception 
$e) { };
           $this->cdb->setDatabase($dataSetName, true);
           foreach ($roles as $idx => $gn) {
               $gn1 = $this->translate_plainGroupName_to_couchdbGroupName($gn);
               $got = true;
               try { $call = $this->cdb->get($gn); } catch (Exception $e) { 
$got = false; }
               $groupRec = ['_id' => $idx.'___'.$gn, 'name' => $gn ];
               if ($got) $groupRec['_rev'] = $call->body->_rev;
   
               $call = $this->cdb->post ($groupRec);
               //echo '<pre 
style="background:purple;color:white;border-radius:10px;">'; var_dump ($call); 
echo '</pre>';
               if ($call->body->ok) echo (!$got?'Created ':'Updated 
').'\''.$gn.'\' group document in database '.$dataSetName.'.<br/>'; else echo 
'<span style="color:red">Could not '.(!$got?'create ':'update ').'\''.$gn.'\' 
group document in database '.$dataSetName.'.</span><br/>';
   
           }
   
           return true;
   
       }
   
   ````


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to