From c13689813e71413f3c98664568c47c167c00580a Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Tue, 10 May 2011 15:23:58 +0200 Subject: prepare user interface to register and delete client certificates on the profile page --- src/SemanticScuttle/Service/User/SslClientCert.php | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'src/SemanticScuttle/Service/User') diff --git a/src/SemanticScuttle/Service/User/SslClientCert.php b/src/SemanticScuttle/Service/User/SslClientCert.php index 3c69788..b6545df 100644 --- a/src/SemanticScuttle/Service/User/SslClientCert.php +++ b/src/SemanticScuttle/Service/User/SslClientCert.php @@ -208,5 +208,43 @@ class SemanticScuttle_Service_User_SslClientCert extends SemanticScuttle_DbServi $this->db->sql_freeresult($dbresult); return $certs; } + + + + /** + * Deletes a SSL client certificate. + * No security checks are made here. + * + * @param mixed $cert Certificate object or certificate database id. + * Objects are of type + * SemanticScuttle_Model_User_SslClientCert + * + * @return boolean True if all went well, false if it could not be deleted + */ + public function delete($cert) + { + if ($cert instanceof SemanticScuttle_Model_User_SslClientCert) { + $id = (int)$cert->id; + } else { + $id = (int)$cert; + } + + if ($id === 0) { + return false; + } + + $query = 'DELETE FROM ' . $this->getTableName() + .' WHERE uId = ' . $id; + + if (!($dbresult = $this->db->sql_query($query))) { + message_die( + GENERAL_ERROR, 'Could not delete user certificate', + '', __LINE__, __FILE__, $query, $this->db + ); + return false; + } + + return true; + } } ?> \ No newline at end of file -- cgit v1.2.3-54-g00ecf