====== authdrupal7 Plugin ====== ---- plugin ---- description: Authenticate using Drupal 7 login credentials author : Matthias Jung email : matzekuh@web.de type : auth lastupdate : 2015-07-29 compatible : Hrun, Detritus, Frusterick Manners, Elenor of Tsort depends : conflicts : similar : tags : authentication, drupal, drupal7, login, users downloadurl: https://github.com/matzekuh/authdrupal7/zipball/master bugtracker : https://github.com/matzekuh/authdrupal7/issues sourcerepo : https://github.com/matzekuh/authdrupal7 donationurl: screenshot_img : ---- ===== Installation ===== :!: **Note:** Wrong use of some settings can make your wiki unreachable. Be sure to read the full documentation before installing/activating the plugin. :!: **External requirements:** This plugin requires the following additional components that must be installed separately: * [[https://www.drupal.org/|Drupal 7]] Search and install the plugin using the [[plugin:extension|Extension Manager]]. Refer to [[:Plugins]] on how to install plugins manually. ===== Usage ===== When using the plugin Dokuwiki will get the user and login information from a Drupal 7 database. Users can login using their Drupal 7 login credentials. Registering and modifying users is not possible (and most likely will not be) as this functionality is provided by Drupal.\\ Dokuwiki will read user groups and memberships from the Drupal 7 database as well. Make sure you read the configuration instructions further below on this page. ===== Configuration and Settings ===== After installation and activation the plugin can be configured using the dokuwiki configuration page. Make sure you stick to the suggested order unless you know exactly what you do. === 1. Plugin configuration === You will find an authdrupal7-section on your config page. Edit the following values: * server: //this will most likely be ''localhost''// * user: //mysql-username with at least reading access to the Drupal database// * password * database: //name of the drupal database on your mysql-server// * charset: //charset of the mysql-database// * drupalPrefix: //Prefix of your Drupal tables, e.g. ''mypre_'', make sure it ends with an underscore// * drupalRoot: //Path to your Drupal installation, make sure it ends with an ''/''// You have the possibility to change the SQL statements retrieving needed information. For most Drupal installations the default statements should work fine. === 2. ACL settings === Dokuwiki will use the Drupal roles as usergroups. To get the correct permissions for your users you have to edit the ACL settings. When granting permissions the user group names are replaced with Drupal role names. If you want to grant access to all Drupal users that are members of the role ''wiki'' use the user group name ''@wiki''. === 3. Authentication === Go to the authentication section of the configuration page. * Add at least one valid Drupal role or Drupal username to the superuser list e.g. ''@administrator''. I highly recommend that you are part of this group as this will be necessary to access the administration section afterwards. :!: I highly recommend to keep ''@admin'' as well, so you can easily switch back to ''authplain''. * You might add valid Drupal roles/usernames to the managers list. * __Afterwards__ set the authentication method to ''authdrupal7''. ==== About Drupal roles ==== I highly recommend that you create new Drupal roles for use in your Dokuwiki permissions. Doing this you will be able to grant or deny wiki permissions without affecting your drupal permission. Not neccessarily should every Drupal admin have superuser rights in Dokuwiki. Create and assign this roles using Drupal administration tools. ===== Configuration details ===== ==== SQL statements (defaults) ==== === checkPass === SQL statement for retrieving the password hash for a given user for downstream comparison. SELECT pass FROM %{drupal_prefix}users WHERE name=\'%{user}\' It is mandatory that the returned hash comes in a field named ''pass''. === getUserInfo === SQL statement to retrieve information about a given user. SELECT name, mail FROM %{drupal_prefix}users WHERE name=\'%{user}\' It is mandatory that the returned values come in fields named ''name'' and ''mail''. === getGroups === SQL statement to retrieve a given users role memberships. SELECT roles.name FROM %{drupal_prefix}users users INNER JOIN %{drupal_prefix}users_roles userroles INNER JOIN %{drupal_prefix}role roles WHERE users.uid = userroles.uid AND roles.rid = userroles.rid AND users.name = \'%{user}\' It is mandatory that the returned values come in a field named ''name''. === getUserCount === SQL statement to retrieve the number of non-deactivated user accounts. SELECT COUNT(*) AS num FROM %{drupal_prefix}users WHERE status = 1 It is mandatory that the returned value comes in a field named ''num''. ===== Development ===== The ''authdrupal7'' plugin widely bases on the [[plugin:authmysql]] plugin by Andreas Gohr. Some changes were neccessary as Drupal uses some algorithms for hashing passwords that were not realizable using the [[plugin:authmysql]] plugin. The plugin includes these methods from the Drupal 7 installation. === Change Log === {{rss>https://github.com/matzekuh/authdrupal7/commits/master.atom date}} === Bug Tracking === [[https://github.com/matzekuh/authdrupal7/issues]] ===== Discussion ===== Compatibility with PHP7 is proposed in pull-request https://github.com/matzekuh/authdrupal7/pull/5 by user miroj