aboutsummaryrefslogtreecommitdiff
path: root/src/SemanticScuttle/Service/User/SslClientCert.php
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2011-05-10 15:23:58 +0200
committerChristian Weiske <cweiske@cweiske.de>2011-05-10 15:23:58 +0200
commitc13689813e71413f3c98664568c47c167c00580a (patch)
tree1dc202379157c1c5926d251b13a148238db249fc /src/SemanticScuttle/Service/User/SslClientCert.php
parent967ba79ece58dd0164accbf46078964c58fec230 (diff)
downloadsemanticscuttle-c13689813e71413f3c98664568c47c167c00580a.tar.gz
semanticscuttle-c13689813e71413f3c98664568c47c167c00580a.tar.bz2
prepare user interface to register and delete client certificates on the profile page
Diffstat (limited to 'src/SemanticScuttle/Service/User/SslClientCert.php')
-rw-r--r--src/SemanticScuttle/Service/User/SslClientCert.php38
1 files changed, 38 insertions, 0 deletions
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