summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Burschka2012-11-03 01:42:25 +0100
committerChristoph Burschka2012-11-03 01:42:25 +0100
commit552d050eb74a6e3a1252b581b02d74fcddb331ad (patch)
treec96f7766cb3937faa492eab62a9cc52c17b194d3
parentSend server parameter in isuser command. (diff)
downloadejabberd-auth-php-552d050eb74a6e3a1252b581b02d74fcddb331ad.tar.gz
New Drupal 8 plugin.
-rw-r--r--plugins/drupal8/BridgeDrupal8.php23
-rw-r--r--plugins/drupal8/drupal8.module16
2 files changed, 39 insertions, 0 deletions
diff --git a/plugins/drupal8/BridgeDrupal8.php b/plugins/drupal8/BridgeDrupal8.php
new file mode 100644
index 0000000..0be6879
--- /dev/null
+++ b/plugins/drupal8/BridgeDrupal8.php
@@ -0,0 +1,23 @@
+<?php
+
+class BridgeDrupal8 extends EjabberdAuthBridge {
+ function isuser($username, $server) {
+ return user_load_by_name($username) !== FALSE;
+ }
+
+ function auth($username, $server, $password) {
+ return user_authenticate($username, $password) !== FALSE;
+ }
+
+ function setpass($username, $server, $password) {
+ return FALSE;
+ }
+
+ function tryregister($username, $server, $password) {
+ return FALSE;
+ }
+
+ function removeuser($username, $server) {
+ return FALSE;
+ }
+}
diff --git a/plugins/drupal8/drupal8.module b/plugins/drupal8/drupal8.module
new file mode 100644
index 0000000..390b678
--- /dev/null
+++ b/plugins/drupal8/drupal8.module
@@ -0,0 +1,16 @@
+<?php
+
+use Drupal\Core\DrupalKernel;
+
+function drupal8_init($config) {
+ define('DRUPAL_ROOT', $config['root_path']);
+ $_SERVER['REMOTE_ADDR'] = '127.0.0.1';
+ require_once DRUPAL_ROOT . '/core/includes/bootstrap.inc';
+ require_once DRUPAL_ROOT . '/core/includes/common.inc';
+ require_once __DIR__ . '/BridgeDrupal8.php';
+ drupal_static('conf_path', "sites/{$config['site']}");
+ drupal_bootstrap(DRUPAL_BOOTSTRAP_CODE);
+ $kernel = new DrupalKernel('prod', FALSE, NULL, cache('bootstrap'));
+ $kernel->boot();
+ return new BridgeDrupal8();
+} \ No newline at end of file