Users can delete entries from their openid whitelid
authorAymeric Augustin <aymeric.augustin@m4x.org>
Sun, 9 Nov 2008 13:53:23 +0000 (14:53 +0100)
committerAymeric Augustin <aymeric.augustin@m4x.org>
Sun, 9 Nov 2008 13:53:23 +0000 (14:53 +0100)
core
modules/openid.php
upgrade/0.9.18/04_openid.sql

diff --git a/core b/core
index 8b6e9f4..7b64cc7 160000 (submodule)
--- a/core
+++ b/core
@@ -1 +1 @@
-Subproject commit 8b6e9f4e18cb8fbce6bb44f88474493476daf87e
+Subproject commit 7b64cc7438eba834c765eef056628e2f1e6ea823
index 08eeb86..d3a4589 100644 (file)
@@ -63,6 +63,7 @@ class OpenidModule extends PLModule
         return array(
             'openid'            => $this->make_hook('openid', AUTH_PUBLIC),
             'openid/trust'      => $this->make_hook('trust', AUTH_COOKIE),
+            'openid/trusted'    => $this->make_hook('trusted', AUTH_MDP),
             'openid/idp_xrds'   => $this->make_hook('idp_xrds', AUTH_PUBLIC),
             'openid/user_xrds'  => $this->make_hook('user_xrds', AUTH_PUBLIC),
             'openid/melix'      => $this->make_hook('melix', AUTH_PUBLIC),
@@ -193,6 +194,20 @@ class OpenidModule extends PLModule
         $this->render_openid_response($webresponse);
     }
 
+    function handler_trusted(&$page, $action = 'list', $id = null)
+    {
+        $this->load('openid.inc.php');
+        $page->setTitle('Sites tiers de confiance');
+        $page->assign('title', 'Mes sites tiers de confiance pour OpenId');
+        $table_editor = new PLTableEditor('openid/trusted', 'openid_trusted', 'id');
+        $table_editor->set_where_clause('user_id = ' . XDB::escape(S::user()->id()));
+        // Display only URLs
+        $table_editor->vars['user_id']['display'] = false;
+        $table_editor->describe('url', 'site tiers', true);
+        $page->assign('deleteonly', true);
+        $table_editor->apply($page, $action, $id);
+    }
+
     function handler_idp_xrds(&$page)
     {
         $this->load('openid.inc.php');
index f82c8c3..28f5923 100644 (file)
@@ -1,9 +1,10 @@
 # Creates a new table to store websites trusted by each user
 CREATE TABLE IF NOT EXISTS `openid_trusted` (
+  id       INTEGER UNSIGNED NOT NULL auto_increment,
   # user_id == NULL means a globally trusted website
   user_id  INTEGER,
   url      VARCHAR(256) NOT NULL,
-  INDEX user_id_index(user_id),
+  PRIMARY KEY id_pk(id),
   UNIQUE INDEX user_id_url_index(user_id, url)
 ) CHARSET=utf8;