? 322764_openid_provider_path.patch
? openid-provider.diff
? openid_provider.module_0.patch
? openid_provider.pathauto.inc
Index: openid_provider.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/openid_provider/openid_provider.inc,v
retrieving revision 1.3.2.4
diff -u -r1.3.2.4 openid_provider.inc
--- openid_provider.inc	7 Mar 2009 17:17:51 -0000	1.3.2.4
+++ openid_provider.inc	7 Mar 2009 20:21:49 -0000
@@ -99,7 +99,7 @@
   }
   else {
     $identity = $request['openid.identity'];
-    if ($identity != url('user/'. $user->uid, array('absolute' => TRUE))) {
+    if ($identity != url('user/'. $user->uid .'/openidurl', array('absolute' => TRUE))) {
       $response = openid_provider_authentication_error($request['openid.mode']);
       openid_redirect($request['openid.return_to'], $response);
     }
Index: openid_provider.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/openid_provider/openid_provider.install,v
retrieving revision 1.2
diff -u -r1.2 openid_provider.install
--- openid_provider.install	1 Jun 2008 03:21:41 -0000	1.2
+++ openid_provider.install	7 Mar 2009 20:21:49 -0000
@@ -2,32 +2,6 @@
 // $Id: openid_provider.install,v 1.2 2008/06/01 03:21:41 walkah Exp $
 
 /**
- * Implementation of hook_requirements().
- */
-function openid_provider_requirements($phase) {
- $requirements = array();
-  // Ensure translations don't break at install time
-  $t = get_t();
-
-  if ($phase == 'runtime') {
-    if (user_access('access user profiles', drupal_anonymous_user())) {
-      $requirements['openid_provider'] = array(
-        'value' => $t('Enabled')
-      );
-    }
-    else {
-      $requirements['openid_provider'] = array(
-        'value' => $t('Disabled'),
-        'severity' => REQUIREMENT_ERROR,
-        'description' => $t('Openid Provider requires that anonymous users have <a href="@url">access user profile permission</a> to work properly.', array('@url' => url('admin/user/permissions/'. DRUPAL_ANONYMOUS_RID))),
-      );      
-    }
-    $requirements['openid_provider']['title'] = $t('Anon user profile access');
-  }
-  return $requirements;
-}
-
-/**
  * Implementation of hook_install().
  */
 function openid_provider_install() {
Index: openid_provider.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/openid_provider/openid_provider.module,v
retrieving revision 1.3.2.1
diff -u -r1.3.2.1 openid_provider.module
--- openid_provider.module	21 Feb 2009 03:39:29 -0000	1.3.2.1
+++ openid_provider.module	7 Mar 2009 20:21:49 -0000
@@ -49,6 +49,16 @@
     'file' => 'openid_provider.pages.inc'
   );
   
+  $items['user/%user/identity'] = array(
+    'title' => 'OpenID Page',
+    'page callback' => 'openid_provider_page',
+    'page arguments' => array(1),
+    'description' => 'Menu callback with full access so no forbiddens are given from server requests',
+    'access callback' => TRUE,
+    'type' => MENU_CALLBACK,
+    'file' => 'openid_provider.pages.inc'
+  );
+
   $items['user/%user/openid_sites'] = array(
     'title' => 'OpenID Sites',
     'page callback' => 'openid_provider_sites',
@@ -71,6 +81,7 @@
   // Not all OpenID clients may be smart enough to do XRDS.
   drupal_add_link(array('rel' => 'openid2.provider', 'href' => url('openid/provider', array('absolute' => TRUE))));
   drupal_add_link(array('rel' => 'openid.server', 'href' => url('openid/provider', array('absolute' => TRUE))));
+
 }
 
 function openid_provider_sites_access($account) {
@@ -86,11 +97,28 @@
   global $user;
   
   switch ($op) {
+    case 'insert':
+    case 'update':
+      _pathauto_include();
+      // Use the username to automatically create an alias
+      $pathauto_user = (object) array_merge((array) $account, $edit);
+      if ($account->name) {
+        $placeholders = pathauto_get_placeholders('user', $pathauto_user);
+        drupal_set_message('<pre>'. print_r($placeholders, true) .'</pre>');
+        $src = 'user/'. $account->uid .'/identity';
+        $alias = pathauto_create_alias('openid_provider', $op, $placeholders, $src, $account->uid);
+      }
+      break;
+    case 'delete':
+      // If the user is deleted, remove the path aliases
+      $account = (object) $account;
+      path_set_alias('user/'. $account->uid .'/identity');
+      break;
     case 'view':
       if ($user->uid == $account->uid) {
         $account->content['openid'] = array(
           '#title' => t('OpenID'),
-          '#value' => t('You may login to other OpenID enabled sites using %url', array('%url' => url('user/' . $account->uid, array('absolute' => TRUE)))),
+          '#value' => t('You may login to other OpenID enabled sites using %url', array('%url' => url('user/' . $account->uid . '/identity', array('absolute' => TRUE)))),
           '#class' => 'openid',
           '#weight' => 10
         );
@@ -131,7 +159,7 @@
     'URI' => array(url('openid/provider', array('absolute'=> TRUE))),
   );
   if ($account->uid) {
-    $data['LocalID'] = array(url('user/'. $account->uid, array('absolute' => TRUE)));
+    $data['LocalID'] = array(url('user/'. $account->uid . '/identity', array('absolute' => TRUE)));
   }
   
   $xrds['openid_provider'] = array(
@@ -225,3 +253,54 @@
   $response = openid_provider_cancel_authentication_response($form_state['openid.mode']);
   openid_redirect($return_to, $response);
 }
+
+/**
+ * Implementation of hook_pathauto() for OpenID Provider aliases.
+ */
+function openid_provider_pathauto($op) {
+  switch ($op) {
+    case 'settings':
+      $settings = array();
+      $settings['module'] = 'openid_provider';
+      $settings['token_type'] = 'user';
+      $settings['groupheader'] = t('OpenID Provider settings');
+      $settings['patterndescr'] = t('Pattern for OpenID provider identity paths');
+      $settings['patterndefault'] = t('users/[user-raw]/openid');
+      $patterns = token_get_list('user');
+      foreach ($patterns as $type => $pattern_set) {
+        if ($type != 'global') {
+          foreach ($pattern_set as $pattern => $description) {
+            $settings['placeholders']['['. $pattern .']'] = $description;
+          }
+        }
+      }
+
+      $settings['bulkname'] = t('Bulk generate aliases for identity paths that are not aliased');
+      $settings['bulkdescr'] = t('Generate aliases for all existing identity paths which do not already have aliases.');
+      return (object) $settings;
+    default:
+      break;
+  }
+}
+
+/**
+ * Bulk generate aliases for all Open ID identity paths without aliases.
+ */
+function openid_provider_pathauto_bulkupdate() {
+  $query = "SELECT uid, name, src, dst FROM {users} LEFT JOIN {url_alias} ON CONCAT('user/', CAST(uid AS CHAR) ,'/openid') = src WHERE uid > 0 AND src IS NULL";
+  $result = db_query_range($query, 0, variable_get('pathauto_max_bulk_update', 50));
+
+  $count = 0;
+  $placeholders = array();
+  while ($user = db_fetch_object($result)) {
+    $placeholders = pathauto_get_placeholders('user', $user);
+    $src = 'user/'. $user->uid .'/identity';
+    if ($alias = pathauto_create_alias('openid_provider', 'bulkupdate', $placeholders, $src, $user->uid)) {
+      $count++;
+    }
+  }
+
+  drupal_set_message(format_plural($count,
+    'Bulk generation of OpenID Provider paths completed, one alias generated.',
+    'Bulk generation of OpenID Provider paths completed, @count aliases generated.'));
+}
\ No newline at end of file
Index: openid_provider.pages.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/openid_provider/openid_provider.pages.inc,v
retrieving revision 1.1.2.2
diff -u -r1.1.2.2 openid_provider.pages.inc
--- openid_provider.pages.inc	7 Mar 2009 16:52:42 -0000	1.1.2.2
+++ openid_provider.pages.inc	7 Mar 2009 20:21:49 -0000
@@ -35,6 +35,14 @@
 }
 
 /**
+ * Callback page for OpenID Identifier. This page is primarily used for
+ * discovery when someone is logging in from a Relying Party.
+ */
+function openid_provider_page($account) {
+  return t('This is the OpenID page for %user.', array('%user' => $account->name));
+}
+
+/**
  * Menu callback to continue authentication process after user login. This
  * callback is encountered when a user tries to login to an RP but does not yet
  * have a valid local session
