Comments

tizzo’s picture

Assigned: Unassigned » tizzo

Working on this now.

tizzo’s picture

Assigned: tizzo » Unassigned
Status: Active » Needs review
StatusFileSize
new6.08 KB

Relatively straight forward port of openID to DB-TNG. There aren't any tests written for this module yet but I tested it manually with two of my openIDs and everything seems to work.

tizzo’s picture

Category: bug » task

Changing category to task. It was probably marked as a bug by mistake?

csevb10’s picture

StatusFileSize
new6.09 KB

Just looks like a missed comma after 'openid':

$query = db_insert('authmap')
      ->fields(array('uid', 'authname', 'module'))
      ->values(array(
        'uid' => $account->uid,
        'authname' => $identity,
        'module' => 'openid'
      ))
      ->execute();

and I'd suggest breaking this into multiple lines:

$authname = db_query('SELECT authname FROM {authmap} WHERE uid = :uid AND aid = :aid', array(':uid' => $account->uid, ':aid' => $aid))->fetchField();

Everything else looks good and passes tests, and the rest looks good to me. I re-rolled the patch with those mods. Only line I'm not sure about (and maybe you know) is this line:

$authname = db_query('SELECT authname FROM {authmap} WHERE uid = :uid AND aid = :aid', array(
    ':uid' => $account->uid, 
    ':aid' => $aid,
  ))
  ->fetchField();

I'm not sure if that's the completely correct formatting.

Crell’s picture

Status: Needs review » Needs work
-    db_query("INSERT INTO {authmap} (uid, authname, module) VALUES (%d, '%s','openid')", $account->uid, $identity);
+    $query = db_insert('authmap')
+      ->fields(array('uid', 'authname', 'module'))
+      ->values(array(
+        'uid' => $account->uid,
+        'authname' => $identity,
+        'module' => 'openid',
+      ))
+      ->execute();

No need to separate fields() and values() there. You can just use fields() with an associative array and it will figure it out. The separate calls are really only useful if you're doing a multi-insert statement.

Otherwise this looks good to me. Go team!

csevb10’s picture

StatusFileSize
new6.04 KB

Dangit. My fault. I should have caught that.

csevb10’s picture

Status: Needs work » Needs review

And updating status...

tizzo’s picture

Ah, that seems obvious now, thanks!

Status: Needs review » Needs work

The last submitted patch failed testing.

csevb10’s picture

Status: Needs work » Needs review
StatusFileSize
new6.03 KB

No code changes, just a new re-roll against HEAD since the files changed.

csevb10’s picture

StatusFileSize
new6.02 KB

Removed trailing whitespace after 1 statement.

c960657’s picture

FYI, there are automated tests for OpenID awaiting review in #251245: openid.module needs tests.

dries’s picture

Status: Needs review » Fixed

Looks good to me too. Committed to CVS HEAD. Thanks!

dave reid’s picture

Priority: Normal » Critical
Status: Fixed » Active
StatusFileSize
new955 bytes

We had a regression in http://cvs.drupal.org/viewvc.py/drupal/drupal/modules/openid/openid.page...

Went from:

  db_query("DELETE FROM {authmap} WHERE uid = %d AND aid = %d AND module = 'openid'", $form_state['#args'][0]->uid, $form_state['#args'][1]);
  if (db_affected_rows()) {
    drupal_set_message(t('OpenID deleted.'));
  }
  $form_state['#redirect'] = 'user/'. $form_state['#args'][0]->uid .'/openid';

To:

function openid_user_delete_form_submit(&$form_state, $form_values) {
  $query = db_delete('authmap')
    ->condition('uid', $form_state['#parameters'][2]->uid)
    ->condition('aid', $form_state['#parameters'][3])
    ->execute();
  if ($query) {
    drupal_set_message(t('OpenID deleted.'));
  }
  $form_state['#redirect'] = 'user/'. $form_state['#args'][0]->uid .'/openid';
}

Note that $form_state['#args'] regressed back to $form_state['#parameters']. Also, we lost the condition 'module' = 'openid'. New query does not respect that.

It would appear that we have also lost the 'Code needs Review' state on d.org. :)

csevb10’s picture

Good catch, and this definitely needs to be updated. In light of the missing needs review and reviewed states, how do we get this pushed?

dave reid’s picture

StatusFileSize
new1.4 KB

I'm also seeing that

function openid_user_delete_form($form_state, $account, $aid = 0) {
  $authname = db_query('SELECT authname FROM {authmap} WHERE uid = :uid AND aid = :aid', array(
    ':uid' => $account->uid,
    ':aid' => $aid,
  ))
  ->fetchField();
  return confirm_form(array(), t('Are you sure you want to delete the OpenID %authname for %user?', array('%authname' => $authname, '%user' => $account->name)), 'user/'. $account->uid .'/openid');
}

Should add a condition of 'module' = 'openid' as well. Since openid_user_delete_form_submit() uses the condition, and the condition is also used in openid_user_identities():

    $query = db_insert('authmap')
      ->fields(array(
        'uid' => $account->uid,
        'authname' => $identity,
        'module' => 'openid',
      ))
      ->execute();

Guess we'll have to wait until the issue statuses come back.

dave reid’s picture

Status: Active » Needs review

There we go.

csevb10’s picture

Status: Needs review » Reviewed & tested by the community

Everything looks good to me on the changes. I'll try and review the patch again to see if there were any other lingering issues like that.

dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD. Thanks!

Status: Fixed » Closed (fixed)
Issue tags: -DBTNG Conversion

Automatically closed -- issue fixed for 2 weeks with no activity.