Index: openid_ax.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/openid_ax/openid_ax.module,v
retrieving revision 1.8
diff -u -p -r1.8 openid_ax.module
--- openid_ax.module	10 Aug 2008 18:33:57 -0000	1.8
+++ openid_ax.module	10 Oct 2008 13:04:11 -0000
@@ -33,35 +33,40 @@ function openid_ax_menu() {
   $items['user/%user/persona'] = array(
     'title' => 'OpenID AX Personas',
     'page callback' => 'openid_ax_persona',
-    'access callback' => TRUE,
+    'access callback' => 'openid_ax_access_check',
+    'access arguments' => array(1),
     'type' => MENU_LOCAL_TASK,
     'file' => 'openid_ax.pages.inc'
     );
   $items['user/%user/persona/create'] = array(
     'title' => 'Create OpenID AX Personas',
     'page callback' => 'openid_ax_create_persona',
-    'access callback' => TRUE,
+    'access callback' => 'openid_ax_user_check',
+    'access arguments' => array(1),
     'type' => MENU_LOCAL_TASK,
     'file' => 'openid_ax.pages.inc'
     );
   $items['user/%user/persona/manage'] = array(
     'title' => 'Manage OpenID AX Personas',
     'page callback' => 'openid_ax_manage_personas',
-    'access callback' => TRUE,
+    'access callback' => 'openid_ax_user_check',
+    'access arguments' => array(1),
     'type' => MENU_LOCAL_TASK,
     'file' => 'openid_ax.pages.inc'
     );
   $items['user/%user/persona/rename'] = array(
     'title' => 'Rename OpenID AX Personas',
     'page callback' => 'openid_ax_rename_personas',
-    'access callback' => TRUE,
+    'access callback' => 'openid_ax_user_check',
+    'access arguments' => array(1),
     'type' => MENU_CALLBACK,
     'file' => 'openid_ax.pages.inc'
     );
   $items['user/%user/persona/delete'] = array(
     'title' => 'Delete OpenID AX Personas',
     'page callback' => 'openid_ax_persona_delete',
-    'access callback' => TRUE,
+    'access callback' => 'openid_ax_user_check',
+    'access arguments' => array(1),
     'type' => MENU_CALLBACK,
     'file' => 'openid_ax.pages.inc'
     );
@@ -69,6 +74,30 @@ function openid_ax_menu() {
 }
 
 /**
+ * Access check function to make sure only the user or site administrators can view the pages
+ */
+function openid_ax_access_check($account) {
+  global $user;
+
+  if (($user->uid && $user->uid == $account->uid) || user_access('administer site configuration')) {
+    return TRUE;
+  }
+  return FALSE;
+}
+
+/**
+ * User check only allow access to these if it is the user
+ */
+function openid_ax_user_check($account) {
+  global $user;
+
+  if ($user->uid && $user->uid == $account->uid) {
+    return TRUE;
+  }
+  return FALSE;
+}
+
+/**
  * Implementation of hook_openid()
  */
 function openid_ax_openid() {
