Add script 'get-openssl-version.sh'.
This commit is contained in:
@ -0,0 +1,316 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* mysql tests for the authpdo plugin
|
||||
*
|
||||
* @group plugin_authpdo
|
||||
* @group plugins
|
||||
*/
|
||||
class mysql_plugin_authpdo_test extends DokuWikiTest {
|
||||
|
||||
protected $driver = 'mysql';
|
||||
protected $host = '';
|
||||
protected $database = 'authpdo_testing';
|
||||
protected $user = '';
|
||||
protected $pass = '';
|
||||
protected $port = '';
|
||||
|
||||
public function setUp() : void {
|
||||
parent::setUp();
|
||||
$configuration = DOKU_UNITTEST . "{$this->driver}.conf.php";
|
||||
if(!file_exists($configuration)) {
|
||||
return;
|
||||
}
|
||||
/** @var $conf array */
|
||||
include $configuration;
|
||||
$this->host = $conf['host'];
|
||||
$this->user = $conf['user'];
|
||||
$this->pass = $conf['pass'];
|
||||
$this->port = $conf['port'];
|
||||
}
|
||||
|
||||
/**
|
||||
* try to remove the last set up database
|
||||
*
|
||||
* it might still be there if something went wrong
|
||||
*/
|
||||
public function tearDown() : void {
|
||||
parent::tearDown();
|
||||
$this->dropDatabase();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if database credentials and extensions exist
|
||||
*/
|
||||
public function test_requirements() {
|
||||
if(!$this->host || !$this->user) {
|
||||
$this->markTestSkipped("Skipped {$this->driver} tests. Missing configuration");
|
||||
}
|
||||
if(!class_exists('PDO')) {
|
||||
$this->markTestSkipped("Skipped {$this->driver} tests. Missing PDO extension");
|
||||
}
|
||||
if(!in_array($this->driver, pdo_drivers())) {
|
||||
$this->markTestSkipped("Skipped {$this->driver} tests. Missing pdo_{$this->driver} extension");
|
||||
}
|
||||
$this->assertTrue(true); // avoid being marked as risky for having no assertion
|
||||
}
|
||||
|
||||
/**
|
||||
* create the database for testing
|
||||
*/
|
||||
protected function createDatabase() {
|
||||
$pdo = new PDO(
|
||||
"{$this->driver}:host={$this->host};port={$this->port}", $this->user, $this->pass,
|
||||
array(
|
||||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, // we want exceptions, not error codes
|
||||
)
|
||||
);
|
||||
$pdo->exec("DROP DATABASE IF EXISTS {$this->database}");
|
||||
$pdo->exec("CREATE DATABASE {$this->database}");
|
||||
$pdo = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* remove the database
|
||||
*/
|
||||
protected function dropDatabase() {
|
||||
$pdo = new PDO(
|
||||
"{$this->driver}:host={$this->host};port={$this->port}", $this->user, $this->pass,
|
||||
array(
|
||||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, // we want exceptions, not error codes
|
||||
)
|
||||
);
|
||||
try {
|
||||
$pdo->exec("DROP DATABASE IF EXISTS {$this->database}");
|
||||
} catch (PDOException $e) {
|
||||
// ignore - sometimes this fails even though the database was deleted
|
||||
}
|
||||
$pdo = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* imports a database dump
|
||||
*
|
||||
* @param $file
|
||||
*/
|
||||
protected function importDatabase($file) {
|
||||
// connect to database and import dump
|
||||
$pdo = null;
|
||||
$pdo = new PDO(
|
||||
"{$this->driver}:dbname={$this->database};host={$this->host};port={$this->port}", $this->user, $this->pass,
|
||||
array(
|
||||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, // we want exceptions, not error codes
|
||||
)
|
||||
);
|
||||
$sql = file_get_contents($file);
|
||||
$pdo->exec($sql);
|
||||
$pdo = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Run general tests on all users
|
||||
*
|
||||
* @param auth_plugin_authpdo $auth
|
||||
* @param array $users
|
||||
*/
|
||||
protected function runGeneralTests(auth_plugin_authpdo $auth, $users) {
|
||||
global $conf;
|
||||
$info = 'DSN: ' . $auth->getConf('dsn');
|
||||
$this->assertTrue($auth->success, $info);
|
||||
|
||||
if($auth->canDo('getUsers')) {
|
||||
$list = $auth->retrieveUsers();
|
||||
$this->assertGreaterThanOrEqual(count($users), count($list), $info);
|
||||
}
|
||||
|
||||
if($auth->canDo('getGroups')) {
|
||||
$list = $auth->retrieveGroups();
|
||||
$this->assertGreaterThanOrEqual(1, $list, $info);
|
||||
}
|
||||
|
||||
if($auth->canDo('getUserCount')) {
|
||||
$count = $auth->getUserCount();
|
||||
$this->assertGreaterThanOrEqual(count($users), $count);
|
||||
}
|
||||
|
||||
if($auth->canDo('addUser')) {
|
||||
$newuser = array(
|
||||
'user' => 'newuserfoobar',
|
||||
'name' => 'First LastFoobar',
|
||||
'pass' => 'password',
|
||||
'mail' => 'newuserfoobar@example.com',
|
||||
'grps' => array('acompletelynewgroup')
|
||||
);
|
||||
$ok = $auth->createUser(
|
||||
$newuser['user'],
|
||||
$newuser['pass'],
|
||||
$newuser['name'],
|
||||
$newuser['mail'],
|
||||
$newuser['grps']
|
||||
);
|
||||
$this->assertTrue($ok, $info);
|
||||
$check = $auth->getUserData($newuser['user']);
|
||||
$this->assertEquals($newuser['user'], $check['user'], $info);
|
||||
$this->assertEquals($newuser['mail'], $check['mail'], $info);
|
||||
$groups = array_merge($newuser['grps'], array($conf['defaultgroup']));
|
||||
$this->assertEquals($groups, $check['grps'], $info);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* run all the tests with the given user, depending on the capabilities
|
||||
*
|
||||
* @param auth_plugin_authpdo $auth
|
||||
* @param $user
|
||||
*/
|
||||
protected function runUserTests(auth_plugin_authpdo $auth, $user) {
|
||||
global $conf;
|
||||
$info = 'DSN: ' . $auth->getConf('dsn') . ' User:' . $user['user'];
|
||||
|
||||
// minimal setup
|
||||
$this->assertTrue($auth->checkPass($user['user'], $user['pass']), $info);
|
||||
$check = $auth->getUserData($user['user']);
|
||||
$this->assertEquals($user['user'], $check['user'], $info);
|
||||
$this->assertEquals($user['name'], $check['name'], $info);
|
||||
$this->assertEquals($user['mail'], $check['mail'], $info);
|
||||
$groups = array_merge($user['grps'], array($conf['defaultgroup']));
|
||||
$this->assertEquals($groups, $check['grps'], $info);
|
||||
|
||||
// getUsers
|
||||
if($auth->canDo('getUsers')) {
|
||||
$list = $auth->retrieveUsers(0, -1, array('user' => $user['user']));
|
||||
$this->assertGreaterThanOrEqual(1, count($list));
|
||||
$list = $auth->retrieveUsers(0, -1, array('name' => $user['name']));
|
||||
$this->assertGreaterThanOrEqual(1, count($list));
|
||||
$list = $auth->retrieveUsers(0, -1, array('mail' => $user['mail']));
|
||||
$this->assertGreaterThanOrEqual(1, count($list));
|
||||
}
|
||||
|
||||
// getUserCount
|
||||
if($auth->canDo('getUserCount')) {
|
||||
$count = $auth->getUserCount(array('user' => $user['user']));
|
||||
$this->assertGreaterThanOrEqual(1, $count);
|
||||
$count = $auth->getUserCount(array('name' => $user['name']));
|
||||
$this->assertGreaterThanOrEqual(1, $count);
|
||||
$count = $auth->getUserCount(array('mail' => $user['mail']));
|
||||
$this->assertGreaterThanOrEqual(1, $count);
|
||||
}
|
||||
|
||||
// modGroups
|
||||
if($auth->canDo('modGroups')) {
|
||||
$newgroup = 'foobar';
|
||||
$ok = $auth->modifyUser($user['user'], array('grps' => array($newgroup)));
|
||||
$this->assertTrue($ok, $info);
|
||||
$check = $auth->getUserData($user['user']);
|
||||
$this->assertTrue(in_array($newgroup, $check['grps']), $info);
|
||||
}
|
||||
|
||||
// modPass
|
||||
if($auth->canDo('modPass')) {
|
||||
$newpass = 'foobar';
|
||||
$ok = $auth->modifyUser($user['user'], array('pass' => $newpass));
|
||||
$this->assertTrue($ok, $info);
|
||||
$this->assertTrue($auth->checkPass($user['user'], $newpass), $info);
|
||||
}
|
||||
|
||||
// modMail
|
||||
if($auth->canDo('modMail')) {
|
||||
$newmail = 'foobar@example.com';
|
||||
$ok = $auth->modifyUser($user['user'], array('mail' => $newmail));
|
||||
$this->assertTrue($ok, $info);
|
||||
$check = $auth->getUserData($user['user']);
|
||||
$this->assertEquals($newmail, $check['mail'], $info);
|
||||
}
|
||||
|
||||
// modName
|
||||
if($auth->canDo('modName')) {
|
||||
$newname = 'FirstName Foobar';
|
||||
$ok = $auth->modifyUser($user['user'], array('name' => $newname));
|
||||
$this->assertTrue($ok, $info);
|
||||
$check = $auth->getUserData($user['user']);
|
||||
$this->assertEquals($newname, $check['name'], $info);
|
||||
}
|
||||
|
||||
// modLogin
|
||||
if($auth->canDo('modLogin')) {
|
||||
$newuser = 'foobar' . $user['user'];
|
||||
$ok = $auth->modifyUser($user['user'], array('user' => $newuser));
|
||||
$this->assertTrue($ok, $info);
|
||||
$check = $auth->getUserData($newuser);
|
||||
$this->assertEquals($newuser, $check['user'], $info);
|
||||
// rename back
|
||||
$ok = $auth->modifyUser($newuser, array('user' => $user['user']));
|
||||
$this->assertTrue($ok, $info);
|
||||
}
|
||||
|
||||
// delUser
|
||||
if($auth->canDo('delUser')) {
|
||||
$num = $auth->deleteUsers(array($user['user']));
|
||||
$this->assertEquals(1, $num, $info);
|
||||
$this->assertFalse($auth->getUserData($user['user']), $info);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* prepares the individual configurations for testing
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function data_provider() {
|
||||
$testdata = array();
|
||||
|
||||
$files = glob(__DIR__ . "/{$this->driver}/*.php");
|
||||
foreach($files as $file) {
|
||||
$dump = preg_replace('/\.php$/', '.sql', $file);
|
||||
$dbname = 'authpdo_testing_' . basename($file, '.php');
|
||||
|
||||
/** @var $data array */
|
||||
include $file;
|
||||
|
||||
$testdata[] = array($dbname, $dump, $data);
|
||||
}
|
||||
|
||||
return $testdata;
|
||||
}
|
||||
|
||||
/**
|
||||
* This triggers all the tests based on the dumps and configurations
|
||||
*
|
||||
* @dataProvider data_provider
|
||||
* @depends test_requirements
|
||||
* @param string $dbname Name of the database to use
|
||||
* @param string $dump The path to the dump file to import
|
||||
* @param array|string $data config and test user setup. When a string is passed, test is skipped with that msg
|
||||
*/
|
||||
public function test_database($dbname, $dump, $data){
|
||||
global $conf;
|
||||
|
||||
if(!is_array($data)) {
|
||||
$this->markTestSkipped($data);
|
||||
return;
|
||||
}
|
||||
|
||||
$this->database = $dbname;
|
||||
|
||||
$this->createDatabase();
|
||||
$this->importDatabase($dump);
|
||||
|
||||
// Setup the configuration and initialize a new auth object
|
||||
$conf['plugin']['authpdo'] = array();
|
||||
$conf['plugin']['authpdo'] = $data['conf'];
|
||||
$conf['plugin']['authpdo']['dsn'] = "{$this->driver}:dbname={$this->database};host={$this->host};port={$this->port}";
|
||||
$conf['plugin']['authpdo']['user'] = $this->user;
|
||||
$conf['plugin']['authpdo']['pass'] = $this->pass;
|
||||
$conf['plugin']['authpdo']['debug'] = 1;
|
||||
if($data['passcrypt']) $conf['passcrypt'] = $data['passcrypt'];
|
||||
$auth = new auth_plugin_authpdo();
|
||||
|
||||
$this->runGeneralTests($auth, $data['users']);
|
||||
foreach($data['users'] as $user) {
|
||||
$this->runUserTests($auth, $user);
|
||||
}
|
||||
|
||||
$this->dropDatabase();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,104 @@
|
||||
<?php
|
||||
/**
|
||||
* Confiuration for fluxbb. They have a very simplistic model. There is no separate display name and a user can
|
||||
* only be in a single group.
|
||||
*/
|
||||
/** @noinspection SqlResolve */
|
||||
$data = array(
|
||||
'passcrypt' => 'sha1',
|
||||
'conf' => array(
|
||||
'select-user' => '
|
||||
SELECT id AS uid,
|
||||
username AS user,
|
||||
username AS name,
|
||||
password AS hash,
|
||||
email AS mail
|
||||
FROM fluy_users
|
||||
WHERE username = :user
|
||||
',
|
||||
'select-user-groups' => '
|
||||
SELECT g_title AS `group`
|
||||
FROM fluy_groups G, fluy_users U
|
||||
WHERE U.id = :uid
|
||||
AND U.group_id = G.g_id
|
||||
',
|
||||
'select-groups' => '
|
||||
SELECT g_id AS gid, g_title AS `group`
|
||||
FROM fluy_groups
|
||||
',
|
||||
'insert-user' => '
|
||||
INSERT INTO fluy_users
|
||||
(group_id, username, password, email)
|
||||
VALUES (0, :user, :hash, :mail)
|
||||
',
|
||||
'delete-user' => '
|
||||
DELETE FROM fluy_users
|
||||
WHERE id = :uid
|
||||
',
|
||||
'list-users' => '
|
||||
SELECT DISTINCT username AS user
|
||||
FROM fluy_users U, fluy_groups G
|
||||
WHERE U.id = G.g_id
|
||||
AND G.g_title LIKE :group
|
||||
AND U.username LIKE :user
|
||||
AND U.username LIKE :name
|
||||
AND U.email LIKE :mail
|
||||
ORDER BY username
|
||||
LIMIT :limit
|
||||
OFFSET :start
|
||||
',
|
||||
'count-users' => '
|
||||
SELECT COUNT(DISTINCT username) AS `count`
|
||||
FROM fluy_users U, fluy_groups G
|
||||
WHERE U.id = G.g_id
|
||||
AND G.g_title LIKE :group
|
||||
AND U.username LIKE :user
|
||||
AND U.username LIKE :name
|
||||
AND U.email LIKE :mail
|
||||
',
|
||||
'update-user-info' => '', // we can't do this because username = displayname
|
||||
'update-user-login' => '
|
||||
UPDATE fluy_users
|
||||
SET username = :newlogin
|
||||
WHERE id = :uid
|
||||
',
|
||||
'update-user-pass' => '
|
||||
UPDATE fluy_users
|
||||
SET password = :hash
|
||||
WHERE id = :uid
|
||||
',
|
||||
'insert-group' => '
|
||||
INSERT INTO fluy_groups (g_title) VALUES (:group)
|
||||
',
|
||||
'join-group' => '
|
||||
UPDATE fluy_users
|
||||
SET group_id = :gid
|
||||
WHERE id = :uid
|
||||
',
|
||||
'leave-group' => '
|
||||
SELECT 1
|
||||
', // we do a no-op for this
|
||||
),
|
||||
'users' => array(
|
||||
array(
|
||||
'user' => 'admin',
|
||||
'pass' => 'pass',
|
||||
'name' => 'admin',
|
||||
'mail' => 'admin@example.com',
|
||||
'grps' =>
|
||||
array(
|
||||
0 => 'Administrators',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'user' => 'test1',
|
||||
'pass' => 'password',
|
||||
'name' => 'test1',
|
||||
'mail' => 'test1@example.com',
|
||||
'grps' =>
|
||||
array(
|
||||
0 => 'test',
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
@ -0,0 +1,136 @@
|
||||
-- phpMyAdmin SQL Dump
|
||||
-- version 4.0.10.7
|
||||
-- http://www.phpmyadmin.net
|
||||
--
|
||||
-- Host: localhost:3306
|
||||
-- Generation Time: Feb 12, 2016 at 03:06 PM
|
||||
-- Server version: 10.0.23-MariaDB
|
||||
-- PHP Version: 5.4.31
|
||||
|
||||
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
|
||||
SET time_zone = "+00:00";
|
||||
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8 */;
|
||||
|
||||
--
|
||||
-- Database: `dokuwiki_flux570`
|
||||
--
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `fluy_groups`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `fluy_groups` (
|
||||
`g_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`g_title` varchar(50) NOT NULL DEFAULT '',
|
||||
`g_user_title` varchar(50) DEFAULT NULL,
|
||||
`g_promote_min_posts` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`g_promote_next_group` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`g_moderator` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`g_mod_edit_users` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`g_mod_rename_users` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`g_mod_change_passwords` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`g_mod_ban_users` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`g_mod_promote_users` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`g_read_board` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`g_view_users` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`g_post_replies` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`g_post_topics` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`g_edit_posts` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`g_delete_posts` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`g_delete_topics` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`g_post_links` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`g_set_title` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`g_search` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`g_search_users` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`g_send_email` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`g_post_flood` smallint(6) NOT NULL DEFAULT '30',
|
||||
`g_search_flood` smallint(6) NOT NULL DEFAULT '30',
|
||||
`g_email_flood` smallint(6) NOT NULL DEFAULT '60',
|
||||
`g_report_flood` smallint(6) NOT NULL DEFAULT '60',
|
||||
PRIMARY KEY (`g_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=6 ;
|
||||
|
||||
--
|
||||
-- Dumping data for table `fluy_groups`
|
||||
--
|
||||
|
||||
INSERT INTO `fluy_groups` (`g_id`, `g_title`, `g_user_title`, `g_promote_min_posts`, `g_promote_next_group`, `g_moderator`, `g_mod_edit_users`, `g_mod_rename_users`, `g_mod_change_passwords`, `g_mod_ban_users`, `g_mod_promote_users`, `g_read_board`, `g_view_users`, `g_post_replies`, `g_post_topics`, `g_edit_posts`, `g_delete_posts`, `g_delete_topics`, `g_post_links`, `g_set_title`, `g_search`, `g_search_users`, `g_send_email`, `g_post_flood`, `g_search_flood`, `g_email_flood`, `g_report_flood`) VALUES
|
||||
(1, 'Administrators', 'Administrator', 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0),
|
||||
(2, 'Moderators', 'Moderator', 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0),
|
||||
(3, 'Guests', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 60, 30, 0, 0),
|
||||
(4, 'Members', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 60, 30, 60, 60),
|
||||
(5, 'test', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 60, 30, 60, 60);
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `fluy_users`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `fluy_users` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`group_id` int(10) unsigned NOT NULL DEFAULT '3',
|
||||
`username` varchar(200) NOT NULL DEFAULT '',
|
||||
`password` varchar(40) NOT NULL DEFAULT '',
|
||||
`email` varchar(80) NOT NULL DEFAULT '',
|
||||
`title` varchar(50) DEFAULT NULL,
|
||||
`realname` varchar(40) DEFAULT NULL,
|
||||
`url` varchar(100) DEFAULT NULL,
|
||||
`jabber` varchar(80) DEFAULT NULL,
|
||||
`icq` varchar(12) DEFAULT NULL,
|
||||
`msn` varchar(80) DEFAULT NULL,
|
||||
`aim` varchar(30) DEFAULT NULL,
|
||||
`yahoo` varchar(30) DEFAULT NULL,
|
||||
`location` varchar(30) DEFAULT NULL,
|
||||
`signature` text,
|
||||
`disp_topics` tinyint(3) unsigned DEFAULT NULL,
|
||||
`disp_posts` tinyint(3) unsigned DEFAULT NULL,
|
||||
`email_setting` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`notify_with_post` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`auto_notify` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`show_smilies` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`show_img` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`show_img_sig` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`show_avatars` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`show_sig` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`timezone` float NOT NULL DEFAULT '0',
|
||||
`dst` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`time_format` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`date_format` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`language` varchar(25) NOT NULL DEFAULT 'English',
|
||||
`style` varchar(25) NOT NULL DEFAULT 'Air',
|
||||
`num_posts` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`last_post` int(10) unsigned DEFAULT NULL,
|
||||
`last_search` int(10) unsigned DEFAULT NULL,
|
||||
`last_email_sent` int(10) unsigned DEFAULT NULL,
|
||||
`last_report_sent` int(10) unsigned DEFAULT NULL,
|
||||
`registered` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`registration_ip` varchar(39) NOT NULL DEFAULT '0.0.0.0',
|
||||
`last_visit` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`admin_note` varchar(30) DEFAULT NULL,
|
||||
`activate_string` varchar(80) DEFAULT NULL,
|
||||
`activate_key` varchar(8) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `fluy_users_username_idx` (`username`(25)),
|
||||
KEY `fluy_users_registered_idx` (`registered`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ;
|
||||
|
||||
--
|
||||
-- Dumping data for table `fluy_users`
|
||||
--
|
||||
|
||||
INSERT INTO `fluy_users` (`id`, `group_id`, `username`, `password`, `email`, `title`, `realname`, `url`, `jabber`, `icq`, `msn`, `aim`, `yahoo`, `location`, `signature`, `disp_topics`, `disp_posts`, `email_setting`, `notify_with_post`, `auto_notify`, `show_smilies`, `show_img`, `show_img_sig`, `show_avatars`, `show_sig`, `timezone`, `dst`, `time_format`, `date_format`, `language`, `style`, `num_posts`, `last_post`, `last_search`, `last_email_sent`, `last_report_sent`, `registered`, `registration_ip`, `last_visit`, `admin_note`, `activate_string`, `activate_key`) VALUES
|
||||
(1, 3, 'Guest', 'Guest', 'Guest', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 'English', 'Air', 0, NULL, NULL, NULL, NULL, 0, '0.0.0.0', 0, NULL, NULL, NULL),
|
||||
(2, 1, 'admin', '9d4e1e23bd5b727046a9e3b4b7db57bd8d6ee684', 'admin@example.com', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 'English', 'Air', 1, 1455307304, NULL, NULL, NULL, 1455307304, '86.56.56.211', 1455307448, NULL, NULL, NULL),
|
||||
(3, 5, 'test1', '5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8', 'test1@example.com', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 'English', 'Air', 0, NULL, NULL, NULL, NULL, 1455307527, '86.56.56.217', 1455307529, NULL, NULL, NULL);
|
||||
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
@ -0,0 +1,144 @@
|
||||
<?php
|
||||
/**
|
||||
* Configuration for mybb. Password checking is done in SQL
|
||||
*
|
||||
* mybb stores additional group ids in a commaseparated list of mybb_users.addtionalgroups This
|
||||
* is currently not supported in the setup below. If someone can come up with a clever config for
|
||||
* that PRs would be welcome.
|
||||
*/
|
||||
/** @noinspection SqlResolve */
|
||||
$data = array(
|
||||
'passcrypt' => 'sha1',
|
||||
'conf' => array(
|
||||
'select-user' => '
|
||||
SELECT uid,
|
||||
username AS user,
|
||||
username AS name,
|
||||
email AS mail
|
||||
FROM mybb_users
|
||||
WHERE username = :user
|
||||
',
|
||||
'check-pass' => '
|
||||
SELECT uid
|
||||
FROM mybb_users
|
||||
WHERE username = :user
|
||||
AND password = MD5(CONCAT(MD5(salt), MD5(:clear)))
|
||||
',
|
||||
'select-user-groups' => '
|
||||
SELECT UG.title AS `group`,
|
||||
UG.gid
|
||||
FROM mybb_usergroups UG,
|
||||
mybb_users U
|
||||
WHERE U.usergroup = UG.gid
|
||||
AND U.uid = :uid
|
||||
',
|
||||
'select-groups' => '
|
||||
SELECT gid, title AS `group`
|
||||
FROM mybb_usergroups
|
||||
',
|
||||
'insert-user' => '
|
||||
SET @salt = LEFT(UUID(), 10);
|
||||
INSERT INTO mybb_users
|
||||
(username, email, salt, password, regdate)
|
||||
VALUES (:user, :mail, @salt, MD5(CONCAT(MD5(@salt), MD5(:clear))), UNIX_TIMESTAMP() )
|
||||
',
|
||||
'delete-user' => '
|
||||
DELETE FROM mybb_users
|
||||
WHERE uid = :uid
|
||||
',
|
||||
'list-users' => '
|
||||
SELECT U.username AS user
|
||||
FROM mybb_usergroups UG,
|
||||
mybb_users U
|
||||
WHERE U.usergroup = UG.gid
|
||||
AND UG.title LIKE :group
|
||||
AND U.username LIKE :user
|
||||
AND U.username LIKE :name
|
||||
AND U.email LIKE :mail
|
||||
ORDER BY U.username
|
||||
LIMIT :limit
|
||||
OFFSET :start
|
||||
',
|
||||
'count-users' => '
|
||||
SELECT COUNT(U.username) AS `count`
|
||||
FROM mybb_usergroups UG,
|
||||
mybb_users U
|
||||
WHERE U.usergroup = UG.gid
|
||||
AND UG.title LIKE :group
|
||||
AND U.username LIKE :user
|
||||
AND U.username LIKE :name
|
||||
AND U.email LIKE :mail
|
||||
',
|
||||
'update-user-info' => '
|
||||
UPDATE mybb_users
|
||||
SET email = :mail
|
||||
WHERE uid = :uid
|
||||
', // we do not support changing the full name as that is the same as the login
|
||||
'update-user-login' => '
|
||||
UPDATE mybb_users
|
||||
SET username = :newlogin
|
||||
WHERE uid = :uid
|
||||
',
|
||||
'update-user-pass' => '
|
||||
SET @salt = LEFT(UUID(), 10);
|
||||
UPDATE mybb_users
|
||||
SET salt = @salt,
|
||||
password = MD5(CONCAT(MD5(@salt), MD5(:clear)))
|
||||
WHERE uid = :uid
|
||||
',
|
||||
'insert-group' => '
|
||||
INSERT INTO mybb_usergroups (title)
|
||||
VALUES (:group)
|
||||
',
|
||||
'join-group' => '
|
||||
UPDATE mybb_users
|
||||
SET usergroup = :gid
|
||||
WHERE uid = :uid
|
||||
',
|
||||
'leave-group' => '', // makes probably no sense to implement
|
||||
),
|
||||
'users' => array(
|
||||
array(
|
||||
'user' => 'Test One',
|
||||
'pass' => 'fakepass',
|
||||
'name' => 'Test One',
|
||||
'mail' => 'no_one@nowhere.com',
|
||||
'grps' =>
|
||||
array(
|
||||
0 => 'Registered',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'user' => 'Test Two',
|
||||
'pass' => 'fakepass',
|
||||
'name' => 'Test Two',
|
||||
'mail' => 'no_one@nowhere.com',
|
||||
'grps' =>
|
||||
array(
|
||||
0 => 'Super Moderators',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'user' => 'Test Three',
|
||||
'pass' => 'fakepass',
|
||||
'name' => 'Test Three',
|
||||
'mail' => 'no_one@nowhere.com',
|
||||
'grps' =>
|
||||
array(
|
||||
0 => 'Administrators',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'user' => 'Test Four',
|
||||
'pass' => 'fakepass',
|
||||
'name' => 'Test Four',
|
||||
'mail' => 'no_one@nowhere.com',
|
||||
'grps' =>
|
||||
array(
|
||||
0 => 'Moderators',
|
||||
),
|
||||
),
|
||||
|
||||
|
||||
),
|
||||
);
|
@ -0,0 +1,306 @@
|
||||
-- phpMyAdmin SQL Dump
|
||||
-- version 4.4.14
|
||||
-- http://www.phpmyadmin.net
|
||||
--
|
||||
-- Host: 127.0.0.1
|
||||
-- Generation Time: Aug 19, 2016 at 04:02 PM
|
||||
-- Server version: 5.5.45
|
||||
-- PHP Version: 5.4.45
|
||||
|
||||
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
|
||||
SET time_zone = "+00:00";
|
||||
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8mb4 */;
|
||||
|
||||
--
|
||||
-- Database: `mybb`
|
||||
--
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `mybb_usergroups`
|
||||
--
|
||||
|
||||
CREATE TABLE `mybb_usergroups` (
|
||||
`gid` smallint(5) unsigned NOT NULL,
|
||||
`type` tinyint(1) unsigned NOT NULL DEFAULT '2',
|
||||
`title` varchar(120) NOT NULL DEFAULT '',
|
||||
`description` text NOT NULL DEFAULT '',
|
||||
`namestyle` varchar(200) NOT NULL DEFAULT '{username}',
|
||||
`usertitle` varchar(120) NOT NULL DEFAULT '',
|
||||
`stars` smallint(4) unsigned NOT NULL DEFAULT '0',
|
||||
`starimage` varchar(120) NOT NULL DEFAULT '',
|
||||
`image` varchar(120) NOT NULL DEFAULT '',
|
||||
`disporder` smallint(6) unsigned NOT NULL DEFAULT '0',
|
||||
`isbannedgroup` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`canview` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`canviewthreads` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`canviewprofiles` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`candlattachments` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`canviewboardclosed` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`canpostthreads` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`canpostreplys` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`canpostattachments` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`canratethreads` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`modposts` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`modthreads` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`mod_edit_posts` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`modattachments` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`caneditposts` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`candeleteposts` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`candeletethreads` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`caneditattachments` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`canpostpolls` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`canvotepolls` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`canundovotes` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`canusepms` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`cansendpms` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`cantrackpms` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`candenypmreceipts` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`pmquota` int(3) unsigned NOT NULL DEFAULT '0',
|
||||
`maxpmrecipients` int(4) unsigned NOT NULL DEFAULT '5',
|
||||
`cansendemail` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`cansendemailoverride` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`maxemails` int(3) unsigned NOT NULL DEFAULT '5',
|
||||
`emailfloodtime` int(3) unsigned NOT NULL DEFAULT '5',
|
||||
`canviewmemberlist` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`canviewcalendar` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`canaddevents` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`canbypasseventmod` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`canmoderateevents` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`canviewonline` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`canviewwolinvis` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`canviewonlineips` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`cancp` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`issupermod` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`cansearch` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`canusercp` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`canuploadavatars` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`canratemembers` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`canchangename` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`canbereported` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`canchangewebsite` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`showforumteam` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`usereputationsystem` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`cangivereputations` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`candeletereputations` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`reputationpower` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`maxreputationsday` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`maxreputationsperuser` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`maxreputationsperthread` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`candisplaygroup` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`attachquota` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`cancustomtitle` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`canwarnusers` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`canreceivewarnings` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`maxwarningsday` int(3) unsigned NOT NULL DEFAULT '3',
|
||||
`canmodcp` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`showinbirthdaylist` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`canoverridepm` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`canusesig` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`canusesigxposts` smallint(5) unsigned NOT NULL DEFAULT '0',
|
||||
`signofollow` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`edittimelimit` int(4) unsigned NOT NULL DEFAULT '0',
|
||||
`maxposts` int(4) unsigned NOT NULL DEFAULT '0',
|
||||
`showmemberlist` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`canmanageannounce` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`canmanagemodqueue` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`canmanagereportedcontent` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`canviewmodlogs` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`caneditprofiles` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`canbanusers` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`canviewwarnlogs` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`canuseipsearch` tinyint(1) NOT NULL DEFAULT '0'
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=8 DEFAULT CHARSET=utf8;
|
||||
|
||||
--
|
||||
-- Dumping data for table `mybb_usergroups`
|
||||
--
|
||||
|
||||
INSERT INTO `mybb_usergroups` (`gid`, `type`, `title`, `description`, `namestyle`, `usertitle`, `stars`, `starimage`, `image`, `disporder`, `isbannedgroup`, `canview`, `canviewthreads`, `canviewprofiles`, `candlattachments`, `canviewboardclosed`, `canpostthreads`, `canpostreplys`, `canpostattachments`, `canratethreads`, `modposts`, `modthreads`, `mod_edit_posts`, `modattachments`, `caneditposts`, `candeleteposts`, `candeletethreads`, `caneditattachments`, `canpostpolls`, `canvotepolls`, `canundovotes`, `canusepms`, `cansendpms`, `cantrackpms`, `candenypmreceipts`, `pmquota`, `maxpmrecipients`, `cansendemail`, `cansendemailoverride`, `maxemails`, `emailfloodtime`, `canviewmemberlist`, `canviewcalendar`, `canaddevents`, `canbypasseventmod`, `canmoderateevents`, `canviewonline`, `canviewwolinvis`, `canviewonlineips`, `cancp`, `issupermod`, `cansearch`, `canusercp`, `canuploadavatars`, `canratemembers`, `canchangename`, `canbereported`, `canchangewebsite`, `showforumteam`, `usereputationsystem`, `cangivereputations`, `candeletereputations`, `reputationpower`, `maxreputationsday`, `maxreputationsperuser`, `maxreputationsperthread`, `candisplaygroup`, `attachquota`, `cancustomtitle`, `canwarnusers`, `canreceivewarnings`, `maxwarningsday`, `canmodcp`, `showinbirthdaylist`, `canoverridepm`, `canusesig`, `canusesigxposts`, `signofollow`, `edittimelimit`, `maxposts`, `showmemberlist`, `canmanageannounce`, `canmanagemodqueue`, `canmanagereportedcontent`, `canviewmodlogs`, `caneditprofiles`, `canbanusers`, `canviewwarnlogs`, `canuseipsearch`) VALUES
|
||||
(1, 1, 'Guests', 'The default group that all visitors are assigned to unless they''re logged in.', '{username}', 'Unregistered', 0, '', '', 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
|
||||
(2, 1, 'Registered', 'After registration, all users are placed in this group by default.', '{username}', '', 0, 'images/star.png', '', 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 200, 5, 1, 0, 5, 5, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 5, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0),
|
||||
(3, 1, 'Super Moderators', 'These users can moderate any forum.', '<span style="color: #CC00CC;"><strong>{username}</strong></span>', 'Super Moderator', 6, 'images/star.png', '', 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 250, 5, 1, 0, 10, 5, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 10, 0, 0, 1, 0, 1, 1, 1, 3, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1),
|
||||
(4, 1, 'Administrators', 'The group all administrators belong to.', '<span style="color: green;"><strong><em>{username}</em></strong></span>', 'Administrator', 7, 'images/star.png', '', 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 2, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1),
|
||||
(5, 1, 'Awaiting Activation', 'Users that have not activated their account by email or manually been activated yet.', '{username}', 'Account not Activated', 0, 'images/star.png', '', 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 5, 0, 0, 5, 5, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0),
|
||||
(6, 1, 'Moderators', 'These users moderate specific forums.', '<span style="color: #CC00CC;"><strong>{username}</strong></span>', 'Moderator', 5, 'images/star.png', '', 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 250, 5, 1, 0, 5, 5, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 10, 0, 0, 1, 0, 1, 1, 1, 3, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1),
|
||||
(7, 1, 'Banned', 'The default user group to which members that are banned are moved to.', '<s>{username}</s>', 'Banned', 0, 'images/star.png', '', 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
|
||||
--
|
||||
-- Indexes for dumped tables
|
||||
--
|
||||
|
||||
--
|
||||
-- Indexes for table `mybb_usergroups`
|
||||
--
|
||||
ALTER TABLE `mybb_usergroups`
|
||||
ADD PRIMARY KEY (`gid`);
|
||||
|
||||
--
|
||||
-- AUTO_INCREMENT for dumped tables
|
||||
--
|
||||
|
||||
--
|
||||
-- AUTO_INCREMENT for table `mybb_usergroups`
|
||||
--
|
||||
ALTER TABLE `mybb_usergroups`
|
||||
MODIFY `gid` smallint(5) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=8;
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
-- phpMyAdmin SQL Dump
|
||||
-- version 4.4.14
|
||||
-- http://www.phpmyadmin.net
|
||||
--
|
||||
-- Host: 127.0.0.1
|
||||
-- Generation Time: Aug 19, 2016 at 03:47 PM
|
||||
-- Server version: 5.5.45
|
||||
-- PHP Version: 5.4.45
|
||||
|
||||
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
|
||||
SET time_zone = "+00:00";
|
||||
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8mb4 */;
|
||||
|
||||
--
|
||||
-- Database: `mybb`
|
||||
--
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `mybb_users`
|
||||
--
|
||||
|
||||
CREATE TABLE `mybb_users` (
|
||||
`uid` int(10) unsigned NOT NULL,
|
||||
`username` varchar(120) NOT NULL DEFAULT '',
|
||||
`password` varchar(120) NOT NULL DEFAULT '',
|
||||
`salt` varchar(10) NOT NULL DEFAULT '',
|
||||
`loginkey` varchar(50) NOT NULL DEFAULT '',
|
||||
`email` varchar(220) NOT NULL DEFAULT '',
|
||||
`postnum` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`threadnum` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`avatar` varchar(200) NOT NULL DEFAULT '',
|
||||
`avatardimensions` varchar(10) NOT NULL DEFAULT '',
|
||||
`avatartype` varchar(10) NOT NULL DEFAULT '0',
|
||||
`usergroup` smallint(5) unsigned NOT NULL DEFAULT '0',
|
||||
`additionalgroups` varchar(200) NOT NULL DEFAULT '',
|
||||
`displaygroup` smallint(5) unsigned NOT NULL DEFAULT '0',
|
||||
`usertitle` varchar(250) NOT NULL DEFAULT '',
|
||||
`regdate` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`lastactive` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`lastvisit` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`lastpost` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`website` varchar(200) NOT NULL DEFAULT '',
|
||||
`icq` varchar(10) NOT NULL DEFAULT '',
|
||||
`aim` varchar(50) NOT NULL DEFAULT '',
|
||||
`yahoo` varchar(50) NOT NULL DEFAULT '',
|
||||
`skype` varchar(75) NOT NULL DEFAULT '',
|
||||
`google` varchar(75) NOT NULL DEFAULT '',
|
||||
`birthday` varchar(15) NOT NULL DEFAULT '',
|
||||
`birthdayprivacy` varchar(4) NOT NULL DEFAULT 'all',
|
||||
`signature` text NOT NULL DEFAULT '',
|
||||
`allownotices` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`hideemail` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`subscriptionmethod` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`invisible` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`receivepms` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`receivefrombuddy` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`pmnotice` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`pmnotify` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`buddyrequestspm` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`buddyrequestsauto` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`threadmode` varchar(8) NOT NULL DEFAULT '',
|
||||
`showimages` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`showvideos` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`showsigs` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`showavatars` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`showquickreply` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`showredirect` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`ppp` smallint(6) unsigned NOT NULL DEFAULT '0',
|
||||
`tpp` smallint(6) unsigned NOT NULL DEFAULT '0',
|
||||
`daysprune` smallint(6) unsigned NOT NULL DEFAULT '0',
|
||||
`dateformat` varchar(4) NOT NULL DEFAULT '',
|
||||
`timeformat` varchar(4) NOT NULL DEFAULT '',
|
||||
`timezone` varchar(5) NOT NULL DEFAULT '',
|
||||
`dst` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`dstcorrection` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`buddylist` text NOT NULL DEFAULT '',
|
||||
`ignorelist` text NOT NULL DEFAULT '',
|
||||
`style` smallint(5) unsigned NOT NULL DEFAULT '0',
|
||||
`away` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`awaydate` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`returndate` varchar(15) NOT NULL DEFAULT '',
|
||||
`awayreason` varchar(200) NOT NULL DEFAULT '',
|
||||
`pmfolders` text NOT NULL DEFAULT '',
|
||||
`notepad` text NOT NULL DEFAULT '',
|
||||
`referrer` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`referrals` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`reputation` int(11) NOT NULL DEFAULT '0',
|
||||
`regip` varbinary(16) NOT NULL DEFAULT '',
|
||||
`lastip` varbinary(16) NOT NULL DEFAULT '',
|
||||
`language` varchar(50) NOT NULL DEFAULT '',
|
||||
`timeonline` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`showcodebuttons` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`totalpms` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`unreadpms` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`warningpoints` int(3) unsigned NOT NULL DEFAULT '0',
|
||||
`moderateposts` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`moderationtime` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`suspendposting` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`suspensiontime` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`suspendsignature` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`suspendsigtime` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`coppauser` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`classicpostbit` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`loginattempts` smallint(2) unsigned NOT NULL DEFAULT '1',
|
||||
`usernotes` text NOT NULL DEFAULT '',
|
||||
`sourceeditor` tinyint(1) NOT NULL DEFAULT '0'
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=88 DEFAULT CHARSET=utf8;
|
||||
|
||||
--
|
||||
-- Dumping data for table `mybb_users`
|
||||
--
|
||||
|
||||
INSERT INTO `mybb_users` (`uid`, `username`, `password`, `salt`, `loginkey`, `email`, `postnum`, `threadnum`, `avatar`, `avatardimensions`, `avatartype`, `usergroup`, `additionalgroups`, `displaygroup`, `usertitle`, `regdate`, `lastactive`, `lastvisit`, `lastpost`, `website`, `icq`, `aim`, `yahoo`, `skype`, `google`, `birthday`, `birthdayprivacy`, `signature`, `allownotices`, `hideemail`, `subscriptionmethod`, `invisible`, `receivepms`, `receivefrombuddy`, `pmnotice`, `pmnotify`, `buddyrequestspm`, `buddyrequestsauto`, `threadmode`, `showimages`, `showvideos`, `showsigs`, `showavatars`, `showquickreply`, `showredirect`, `ppp`, `tpp`, `daysprune`, `dateformat`, `timeformat`, `timezone`, `dst`, `dstcorrection`, `buddylist`, `ignorelist`, `style`, `away`, `awaydate`, `returndate`, `awayreason`, `pmfolders`, `notepad`, `referrer`, `referrals`, `reputation`, `regip`, `lastip`, `language`, `timeonline`, `showcodebuttons`, `totalpms`, `unreadpms`, `warningpoints`, `moderateposts`, `moderationtime`, `suspendposting`, `suspensiontime`, `suspendsignature`, `suspendsigtime`, `coppauser`, `classicpostbit`, `loginattempts`, `usernotes`, `sourceeditor`) VALUES
|
||||
(84, 'Test One', '6e90cf918ebce3a577fd72cea919dc64', '0pBnrIIv', 'xALZxWcfw18AhO6M7YxptBrxZqyrJB04CWlyaIniO3ZyMn6P1f', 'no_one@nowhere.com', 0, 0, '', '', '', 2, '', 0, '', 1471614765, 1471614765, 1471614765, 0, '', '0', '', '', '', '', '', 'all', '', 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 'linear', 1, 1, 1, 1, 1, 1, 0, 0, 0, '0', '0', '0', 0, 2, '', '', 0, 0, 0, '0', '', '', '', 0, 0, 0, '', '', '', 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, '', 0),
|
||||
(85, 'Test Two', 'e85f6b7e5804b42d7c7d99329dc1a43f', 'NSX3xNT1', 'VucYxl7EGnsoqVW75COGNAdB0YgtWHc9RFqo4LxIhhtpEFxdIE', 'no_one@nowhere.com', 0, 0, '', '', '', 3, '', 0, '', 1471614850, 1471614850, 1471614850, 0, '', '0', '', '', '', '', '', 'all', '', 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 'linear', 1, 1, 1, 1, 1, 1, 0, 0, 0, '0', '0', '0', 0, 2, '', '', 0, 0, 0, '0', '', '', '', 0, 0, 0, '', '', '', 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, '', 0),
|
||||
(86, 'Test Three', '3669c9583702ca6e32c7817f4bc34f5f', 'CVEbGFXH', 'GivwOlOKuvpfTs8Dc263fNnPdSQW1k1C1fHt7gukTJdRvTZGca', 'no_one@nowhere.com', 0, 0, '', '', '', 4, '', 0, '', 1471615021, 1471615021, 1471615021, 0, '', '0', '', '', '', '', '', 'all', '', 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 'linear', 1, 1, 1, 1, 1, 1, 0, 0, 0, '0', '0', '0', 0, 2, '', '', 0, 0, 0, '0', '', '', '', 0, 0, 0, '', '', '', 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, '', 0),
|
||||
(87, 'Test Four', '693a0cd028c9adb4cb28d8a8be3dc7af', 'x6q7QFmU', 'S4oU92jET3yjvbiganAKCYde9ksoacJeb4sC247qvYftgwsYmu', 'no_one@nowhere.com', 0, 0, '', '', '', 6, '', 0, '', 1471615064, 1471615064, 1471615064, 0, '', '0', '', '', '', '', '', 'all', '', 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 'linear', 1, 1, 1, 1, 1, 1, 0, 0, 0, '0', '0', '0', 0, 2, '', '', 0, 0, 0, '0', '', '', '', 0, 0, 0, '', '', '', 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, '', 0);
|
||||
|
||||
--
|
||||
-- Indexes for dumped tables
|
||||
--
|
||||
|
||||
--
|
||||
-- Indexes for table `mybb_users`
|
||||
--
|
||||
ALTER TABLE `mybb_users`
|
||||
ADD PRIMARY KEY (`uid`),
|
||||
ADD UNIQUE KEY `username` (`username`),
|
||||
ADD KEY `usergroup` (`usergroup`),
|
||||
ADD KEY `regip` (`regip`),
|
||||
ADD KEY `lastip` (`lastip`);
|
||||
|
||||
--
|
||||
-- AUTO_INCREMENT for dumped tables
|
||||
--
|
||||
|
||||
--
|
||||
-- AUTO_INCREMENT for table `mybb_users`
|
||||
--
|
||||
ALTER TABLE `mybb_users`
|
||||
MODIFY `uid` int(10) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=88;
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
@ -0,0 +1,115 @@
|
||||
<?php
|
||||
/**
|
||||
* Basic Wordpress config
|
||||
*
|
||||
* Wordpress has no proper groups. This configures the default access permissions as groups. Better group
|
||||
* support is available through a Wrdpress plugin
|
||||
*/
|
||||
/** @noinspection SqlResolve */
|
||||
$data = array(
|
||||
'passcrypt' => 'pmd5',
|
||||
'conf' => array(
|
||||
'select-user' => '
|
||||
SELECT ID AS uid,
|
||||
user_login AS user,
|
||||
display_name AS name,
|
||||
user_pass AS hash,
|
||||
user_email AS mail
|
||||
FROM wpvk_users
|
||||
WHERE user_login = :user
|
||||
',
|
||||
'select-user-groups' => '
|
||||
SELECT CONCAT("group",meta_value) AS `group`
|
||||
FROM wpvk_usermeta
|
||||
WHERE user_id = :uid
|
||||
AND meta_key = "wpvk_user_level"
|
||||
',
|
||||
'select-groups' => '',
|
||||
'insert-user' => '',
|
||||
'delete-user' => '',
|
||||
'list-users' => '
|
||||
SELECT DISTINCT user_login AS user
|
||||
FROM wpvk_users U, wpvk_usermeta M
|
||||
WHERE U.ID = M.user_id
|
||||
AND M.meta_key = "wpvk_user_level"
|
||||
AND CONCAT("group", M.meta_value) LIKE :group
|
||||
AND U.user_login LIKE :user
|
||||
AND U.display_name LIKE :name
|
||||
AND U.user_email LIKE :mail
|
||||
ORDER BY user_login
|
||||
LIMIT :limit
|
||||
OFFSET :start
|
||||
',
|
||||
'count-users' => '
|
||||
SELECT COUNT(DISTINCT user_login) as `count`
|
||||
FROM wpvk_users U, wpvk_usermeta M
|
||||
WHERE U.ID = M.user_id
|
||||
AND M.meta_key = "wpvk_user_level"
|
||||
AND CONCAT("group", M.meta_value) LIKE :group
|
||||
AND U.user_login LIKE :user
|
||||
AND U.display_name LIKE :name
|
||||
AND U.user_email LIKE :mail
|
||||
',
|
||||
'update-user-info' => '
|
||||
UPDATE wpvk_users
|
||||
SET display_name = :name,
|
||||
user_email = :mail
|
||||
WHERE ID = :uid
|
||||
',
|
||||
'update-user-login' => '
|
||||
UPDATE wpvk_users
|
||||
SET user_login = :newlogin
|
||||
WHERE ID = :uid
|
||||
',
|
||||
'update-user-pass' => '
|
||||
UPDATE wpvk_users
|
||||
SET user_pass = :hash
|
||||
WHERE ID = :uid
|
||||
',
|
||||
'insert-group' => '',
|
||||
'join-group' => '',
|
||||
'leave-group' => '',
|
||||
),
|
||||
'users' => array(
|
||||
array(
|
||||
'user' => 'admin',
|
||||
'pass' => 'pass',
|
||||
'name' => 'admin',
|
||||
'mail' => 'admin@example.com',
|
||||
'grps' =>
|
||||
array(
|
||||
0 => 'group10',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'user' => 'test1',
|
||||
'pass' => 'pass',
|
||||
'name' => 'Test1 Subscriber',
|
||||
'mail' => 'test1@example.com',
|
||||
'grps' =>
|
||||
array(
|
||||
0 => 'group0',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'user' => 'test2',
|
||||
'pass' => 'pass',
|
||||
'name' => 'Test2 Contributor',
|
||||
'mail' => 'test2@example.com',
|
||||
'grps' =>
|
||||
array(
|
||||
0 => 'group1',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'user' => 'test3',
|
||||
'pass' => 'pass',
|
||||
'name' => 'Test3 Author',
|
||||
'mail' => 'test3@example.com',
|
||||
'grps' =>
|
||||
array(
|
||||
0 => 'group2',
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
@ -0,0 +1,130 @@
|
||||
-- phpMyAdmin SQL Dump
|
||||
-- version 4.0.10.7
|
||||
-- http://www.phpmyadmin.net
|
||||
--
|
||||
-- Host: localhost:3306
|
||||
-- Generation Time: Feb 10, 2016 at 02:02 PM
|
||||
-- Server version: 10.0.23-MariaDB
|
||||
-- PHP Version: 5.4.31
|
||||
|
||||
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
|
||||
SET time_zone = "+00:00";
|
||||
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8 */;
|
||||
|
||||
--
|
||||
-- Database: `dokuwiki_wp240`
|
||||
--
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `wpvk_usermeta`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `wpvk_usermeta` (
|
||||
`umeta_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`user_id` bigint(20) unsigned NOT NULL DEFAULT '0',
|
||||
`meta_key` varchar(255) DEFAULT NULL,
|
||||
`meta_value` longtext,
|
||||
PRIMARY KEY (`umeta_id`),
|
||||
KEY `user_id` (`user_id`),
|
||||
KEY `meta_key` (`meta_key`(191))
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=52 ;
|
||||
|
||||
--
|
||||
-- Dumping data for table `wpvk_usermeta`
|
||||
--
|
||||
|
||||
INSERT INTO `wpvk_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES
|
||||
(1, 1, 'nickname', 'admin'),
|
||||
(2, 1, 'first_name', 'First'),
|
||||
(3, 1, 'last_name', 'Last'),
|
||||
(4, 1, 'description', ''),
|
||||
(5, 1, 'rich_editing', 'true'),
|
||||
(6, 1, 'comment_shortcuts', 'false'),
|
||||
(7, 1, 'admin_color', 'fresh'),
|
||||
(8, 1, 'use_ssl', '0'),
|
||||
(9, 1, 'show_admin_bar_front', 'true'),
|
||||
(10, 1, 'wpvk_capabilities', 'a:1:{s:13:"administrator";b:1;}'),
|
||||
(11, 1, 'wpvk_user_level', '10'),
|
||||
(12, 1, 'dismissed_wp_pointers', ''),
|
||||
(13, 1, 'show_welcome_panel', '1'),
|
||||
(14, 1, 'session_tokens', 'a:1:{s:64:"3e9f99a7068bf3fb79f50e111b6ef10f599beb466c27152205d4b89360c5004d";a:4:{s:10:"expiration";i:1456340157;s:2:"ip";s:12:"86.56.56.217";s:2:"ua";s:104:"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.82 Safari/537.36";s:5:"login";i:1455130557;}}'),
|
||||
(15, 1, 'wpvk_dashboard_quick_press_last_post_id', '3'),
|
||||
(16, 2, 'nickname', 'test1'),
|
||||
(17, 2, 'first_name', 'Test1'),
|
||||
(18, 2, 'last_name', 'Subscriber'),
|
||||
(19, 2, 'description', ''),
|
||||
(20, 2, 'rich_editing', 'true'),
|
||||
(21, 2, 'comment_shortcuts', 'false'),
|
||||
(22, 2, 'admin_color', 'fresh'),
|
||||
(23, 2, 'use_ssl', '0'),
|
||||
(24, 2, 'show_admin_bar_front', 'true'),
|
||||
(25, 2, 'wpvk_capabilities', 'a:1:{s:10:"subscriber";b:1;}'),
|
||||
(26, 2, 'wpvk_user_level', '0'),
|
||||
(27, 2, 'dismissed_wp_pointers', ''),
|
||||
(28, 3, 'nickname', 'test2'),
|
||||
(29, 3, 'first_name', 'Test2'),
|
||||
(30, 3, 'last_name', 'Contributor'),
|
||||
(31, 3, 'description', ''),
|
||||
(32, 3, 'rich_editing', 'true'),
|
||||
(33, 3, 'comment_shortcuts', 'false'),
|
||||
(34, 3, 'admin_color', 'fresh'),
|
||||
(35, 3, 'use_ssl', '0'),
|
||||
(36, 3, 'show_admin_bar_front', 'true'),
|
||||
(37, 3, 'wpvk_capabilities', 'a:1:{s:11:"contributor";b:1;}'),
|
||||
(38, 3, 'wpvk_user_level', '1'),
|
||||
(39, 3, 'dismissed_wp_pointers', ''),
|
||||
(40, 4, 'nickname', 'test3'),
|
||||
(41, 4, 'first_name', 'Test3'),
|
||||
(42, 4, 'last_name', 'Author'),
|
||||
(43, 4, 'description', ''),
|
||||
(44, 4, 'rich_editing', 'true'),
|
||||
(45, 4, 'comment_shortcuts', 'false'),
|
||||
(46, 4, 'admin_color', 'fresh'),
|
||||
(47, 4, 'use_ssl', '0'),
|
||||
(48, 4, 'show_admin_bar_front', 'true'),
|
||||
(49, 4, 'wpvk_capabilities', 'a:1:{s:6:"author";b:1;}'),
|
||||
(50, 4, 'wpvk_user_level', '2'),
|
||||
(51, 4, 'dismissed_wp_pointers', '');
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `wpvk_users`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `wpvk_users` (
|
||||
`ID` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`user_login` varchar(60) NOT NULL DEFAULT '',
|
||||
`user_pass` varchar(255) NOT NULL DEFAULT '',
|
||||
`user_nicename` varchar(50) NOT NULL DEFAULT '',
|
||||
`user_email` varchar(100) NOT NULL DEFAULT '',
|
||||
`user_url` varchar(100) NOT NULL DEFAULT '',
|
||||
`user_registered` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`user_activation_key` varchar(255) NOT NULL DEFAULT '',
|
||||
`user_status` int(11) NOT NULL DEFAULT '0',
|
||||
`display_name` varchar(250) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`ID`),
|
||||
KEY `user_login_key` (`user_login`),
|
||||
KEY `user_nicename` (`user_nicename`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=5 ;
|
||||
|
||||
--
|
||||
-- Dumping data for table `wpvk_users`
|
||||
--
|
||||
|
||||
INSERT INTO `wpvk_users` (`ID`, `user_login`, `user_pass`, `user_nicename`, `user_email`, `user_url`, `user_registered`, `user_activation_key`, `user_status`, `display_name`) VALUES
|
||||
(1, 'admin', '$P$BlO2X5nM.djjfsPjOBHz97GHZmpBRr.', 'admin', 'admin@example.com', '', '2016-02-10 18:55:26', '', 0, 'admin'),
|
||||
(2, 'test1', '$P$B3BfWySh.ymDeURK0OXMFo4vh4JprO0', 'test1', 'test1@example.com', '', '2016-02-10 18:57:47', '', 0, 'Test1 Subscriber'),
|
||||
(3, 'test2', '$P$BMNEUEo5nalKEswryuP69KXEfz8Y.z.', 'test2', 'test2@example.com', '', '2016-02-10 18:58:32', '', 0, 'Test2 Contributor'),
|
||||
(4, 'test3', '$P$B2PP3AP6NF/jLO0HYu3xf577rBnp2j.', 'test3', 'test3@example.com', '', '2016-02-10 18:59:19', '', 0, 'Test3 Author');
|
||||
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* pgsql tests for the authpdo plugin
|
||||
*
|
||||
* @group plugin_authpdo
|
||||
* @group plugins
|
||||
*/
|
||||
class pgsql_plugin_authpdo_test extends mysql_plugin_authpdo_test {
|
||||
|
||||
protected $driver = 'pgsql';
|
||||
|
||||
}
|
@ -0,0 +1,140 @@
|
||||
<?php
|
||||
/**
|
||||
* Django application config
|
||||
*
|
||||
*/
|
||||
/** @noinspection SqlResolve */
|
||||
$data = array(
|
||||
'passcrypt' => 'djangopbkdf2_sha256',
|
||||
'conf' => array(
|
||||
'select-user' => '
|
||||
SELECT id AS uid,
|
||||
username AS "user",
|
||||
CONCAT_WS(\' \', first_name, last_name) AS name,
|
||||
password AS hash,
|
||||
email AS mail
|
||||
FROM auth_user
|
||||
WHERE username = :user
|
||||
',
|
||||
'select-user-groups' => '
|
||||
SELECT G.name AS "group"
|
||||
FROM auth_group G, auth_user_groups UG
|
||||
WHERE UG.user_id = :uid
|
||||
AND UG.group_id = G.id
|
||||
',
|
||||
'select-groups' => '
|
||||
SELECT id AS gid, name AS "group"
|
||||
FROM auth_group
|
||||
',
|
||||
'insert-user' => '
|
||||
INSERT INTO auth_user
|
||||
(password, is_superuser, username, first_name, last_name, email, is_staff, is_active, date_joined)
|
||||
VALUES (:hash, false, :user, SPLIT_PART(:name,\' \',1), SPLIT_PART(:name,\' \',2), :mail, false, true, NOW())
|
||||
',
|
||||
'delete-user' => '
|
||||
DELETE FROM auth_user_user_permissions
|
||||
WHERE user_id = :uid
|
||||
;
|
||||
DELETE FROM auth_user
|
||||
WHERE id = :uid
|
||||
',
|
||||
'list-users' => '
|
||||
SELECT DISTINCT U.username AS "user"
|
||||
FROM auth_user U, auth_user_groups UG, auth_group G
|
||||
WHERE U.id = UG.user_id
|
||||
AND G.id = UG.group_id
|
||||
AND G.name LIKE :group
|
||||
AND U.username LIKE :user
|
||||
AND CONCAT_WS(\' \', U.first_name, U.last_name) LIKE :name
|
||||
AND U.email LIKE :mail
|
||||
ORDER BY username
|
||||
LIMIT :limit
|
||||
OFFSET :start
|
||||
',
|
||||
'count-users' => '
|
||||
SELECT COUNT(DISTINCT U.username) AS count
|
||||
FROM auth_user U, auth_user_groups UG, auth_group G
|
||||
WHERE U.id = UG.user_id
|
||||
AND G.id = UG.group_id
|
||||
AND G.name LIKE :group
|
||||
AND U.username LIKE :user
|
||||
AND CONCAT_WS(\' \', U.first_name, U.last_name) LIKE :name
|
||||
AND U.email LIKE :mail
|
||||
',
|
||||
'update-user-info' => '
|
||||
UPDATE auth_user
|
||||
SET first_name = SPLIT_PART(:name,\' \',1),
|
||||
last_name = SPLIT_PART(:name,\' \',2),
|
||||
email = :mail
|
||||
WHERE id = :uid
|
||||
',
|
||||
'update-user-login' => '
|
||||
UPDATE auth_user
|
||||
SET username = :newlogin
|
||||
WHERE id = :uid
|
||||
',
|
||||
'update-user-pass' => '
|
||||
UPDATE auth_user
|
||||
SET password = :hash
|
||||
WHERE id = :uid
|
||||
',
|
||||
'insert-group' => '
|
||||
INSERT INTO auth_group (name) VALUES (:group)
|
||||
',
|
||||
'join-group' => '
|
||||
INSERT INTO auth_user_groups (user_id, group_id) VALUES (:uid, :gid)
|
||||
',
|
||||
'leave-group' => '
|
||||
DELETE FROM auth_user_groups
|
||||
WHERE user_id = :uid
|
||||
AND group_id = :gid
|
||||
',
|
||||
),
|
||||
'users' => array(
|
||||
array(
|
||||
'user' => 'test-billing',
|
||||
'pass' => 'P4zzW0rd!',
|
||||
'name' => 'Joana Gröschel',
|
||||
'mail' => 'jg@billing.com',
|
||||
'grps' =>
|
||||
array(
|
||||
0 => 'Billing',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'user' => 'test-kunde',
|
||||
'pass' => 'P4zzW0rd!',
|
||||
'name' => 'Niels Buchberger',
|
||||
'mail' => 'ng@kunde.com',
|
||||
'grps' =>
|
||||
array(
|
||||
0 => 'Kunden',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'user' => 'test-mitarbeiter',
|
||||
'pass' => 'P4zzW0rd!',
|
||||
'name' => 'Claus Wernke',
|
||||
'mail' => 'cw@mitarbeiter.com',
|
||||
'grps' =>
|
||||
array(
|
||||
0 => 'Mitarbeiter',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'user' => 'test-projektleiter',
|
||||
'pass' => 'P4zzW0rd!',
|
||||
'name' => 'Sascha Weiher',
|
||||
'mail' => 'sw@projektleiter.com',
|
||||
'grps' =>
|
||||
array(
|
||||
0 => 'Projektleiter',
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
// passwords in the dump use the newest format, we need PHP support for that
|
||||
if(!function_exists('hash_pbkdf2') || !in_array('sha256', hash_algos())){
|
||||
$data = 'missing pbkdf2 hash support to check passwords - django test has to be skipped';
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,218 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Class testable_auth_plugin_authpdo
|
||||
*
|
||||
* makes protected methods public for testing
|
||||
*/
|
||||
class testable_auth_plugin_authpdo extends auth_plugin_authpdo {
|
||||
public function getPluginName() {
|
||||
return 'authpdo';
|
||||
}
|
||||
|
||||
public function selectGroups() {
|
||||
return parent::selectGroups();
|
||||
}
|
||||
|
||||
public function addGroup($group) {
|
||||
return parent::addGroup($group);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* General tests for the authpdo plugin
|
||||
*
|
||||
* @group plugin_authpdo
|
||||
* @group plugins
|
||||
*/
|
||||
class sqlite_plugin_authpdo_test extends DokuWikiTest {
|
||||
|
||||
protected $dbfile;
|
||||
|
||||
public function test_pdo_sqlite_support() {
|
||||
if(!class_exists('PDO') || !in_array('sqlite',PDO::getAvailableDrivers())) {
|
||||
$this->markTestSkipped('skipping all authpdo tests for sqlite. Need PDO_sqlite extension');
|
||||
}
|
||||
$this->assertTrue(true); // avoid being marked as risky for having no assertion
|
||||
}
|
||||
|
||||
public function setUp() : void {
|
||||
parent::setUp();
|
||||
$this->dbfile = tempnam('/tmp/', 'pluginpdo_test_');
|
||||
copy(__DIR__ . '/test.sqlite3', $this->dbfile);
|
||||
|
||||
global $conf;
|
||||
|
||||
$conf['plugin']['authpdo']['debug'] = 1;
|
||||
$conf['plugin']['authpdo']['dsn'] = 'sqlite:' . $this->dbfile;
|
||||
$conf['plugin']['authpdo']['user'] = '';
|
||||
$conf['plugin']['authpdo']['pass'] = '';
|
||||
|
||||
$conf['plugin']['authpdo']['select-user'] = 'SELECT id AS uid, login AS user, name, pass AS clear, mail FROM user WHERE login = :user';
|
||||
$conf['plugin']['authpdo']['select-user-groups'] = 'SELECT * FROM member AS m, "group" AS g WHERE m.gid = g.id AND m.uid = :uid';
|
||||
$conf['plugin']['authpdo']['select-groups'] = 'SELECT id AS gid, "group" FROM "group"';
|
||||
|
||||
$conf['plugin']['authpdo']['insert-user'] = 'INSERT INTO user (login, pass, name, mail) VALUES (:user, :hash, :name, :mail)';
|
||||
$conf['plugin']['authpdo']['delete-user'] = 'DELETE FROM user WHERE id = :uid';
|
||||
|
||||
$conf['plugin']['authpdo']['list-users'] = 'SELECT DISTINCT login as user
|
||||
FROM user U, member M, "group" G
|
||||
WHERE U.id = M.uid
|
||||
AND M.gid = G.id
|
||||
AND G."group" LIKE :group
|
||||
AND U.login LIKE :user
|
||||
AND U.name LIKE :name
|
||||
AND U.mail LIKE :mail
|
||||
ORDER BY login
|
||||
LIMIT :start,:limit';
|
||||
|
||||
$conf['plugin']['authpdo']['count-users'] = 'SELECT COUNT(DISTINCT login) as count
|
||||
FROM user U, member M, "group" G
|
||||
WHERE U.id = M.uid
|
||||
AND M.gid = G.id
|
||||
AND G."group" LIKE :group
|
||||
AND U.login LIKE :user
|
||||
AND U.name LIKE :name
|
||||
AND U.mail LIKE :mail';
|
||||
|
||||
|
||||
$conf['plugin']['authpdo']['update-user-login'] = 'UPDATE user SET login = :newlogin WHERE id = :uid';
|
||||
$conf['plugin']['authpdo']['update-user-info'] = 'UPDATE user SET name = :name, mail = :mail WHERE id = :uid';
|
||||
$conf['plugin']['authpdo']['update-user-pass'] = 'UPDATE user SET pass = :hash WHERE id = :uid';
|
||||
|
||||
$conf['plugin']['authpdo']['insert-group'] = 'INSERT INTO "group" ("group") VALUES (:group)';
|
||||
$conf['plugin']['authpdo']['join-group'] = 'INSERT INTO member (uid, gid) VALUES (:uid, :gid)';
|
||||
$conf['plugin']['authpdo']['leave-group'] = 'DELETE FROM member WHERE uid = :uid AND gid = :gid';
|
||||
}
|
||||
|
||||
public function tearDown() : void {
|
||||
parent::tearDown();
|
||||
unlink($this->dbfile);
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends test_pdo_sqlite_support
|
||||
*/
|
||||
public function test_internals() {
|
||||
$auth = new testable_auth_plugin_authpdo();
|
||||
|
||||
$groups = $auth->selectGroups();
|
||||
$this->assertArrayHasKey('user', $groups);
|
||||
$this->assertEquals(1, $groups['user']['gid']);
|
||||
$this->assertArrayHasKey('admin', $groups);
|
||||
$this->assertEquals(2, $groups['admin']['gid']);
|
||||
|
||||
$ok = $auth->addGroup('test');
|
||||
$this->assertTrue($ok);
|
||||
$groups = $auth->selectGroups();
|
||||
$this->assertArrayHasKey('test', $groups);
|
||||
$this->assertEquals(4, $groups['test']['gid']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends test_pdo_sqlite_support
|
||||
*/
|
||||
public function test_userinfo() {
|
||||
global $conf;
|
||||
$auth = new auth_plugin_authpdo();
|
||||
|
||||
// clear text pasword (with default config above
|
||||
$this->assertFalse($auth->checkPass('nobody', 'nope'));
|
||||
$this->assertFalse($auth->checkPass('admin', 'nope'));
|
||||
$this->assertTrue($auth->checkPass('admin', 'password'));
|
||||
|
||||
// now with a hashed password
|
||||
$conf['plugin']['authpdo']['select-user'] = 'SELECT id AS uid, login AS user, name, pass AS hash, mail FROM user WHERE login = :user';
|
||||
$this->assertFalse($auth->checkPass('admin', 'password'));
|
||||
$this->assertFalse($auth->checkPass('user', md5('password')));
|
||||
|
||||
// access user data
|
||||
$info = $auth->getUserData('admin');
|
||||
$this->assertEquals('admin', $info['user']);
|
||||
$this->assertEquals('The Admin', $info['name']);
|
||||
$this->assertEquals('admin@example.com', $info['mail']);
|
||||
$this->assertEquals(array('additional', 'admin', 'user'), $info['grps']);
|
||||
|
||||
// group retrieval
|
||||
$this->assertEquals(array('additional', 'admin', 'user'), $auth->retrieveGroups());
|
||||
$this->assertEquals(array('admin', 'user'), $auth->retrieveGroups(1));
|
||||
$this->assertEquals(array('additional'), $auth->retrieveGroups(0, 1));
|
||||
|
||||
// user creation
|
||||
$auth->createUser('test', 'password', 'A Test user', 'test@example.com', array('newgroup'));
|
||||
$info = $auth->getUserData('test');
|
||||
$this->assertEquals('test', $info['user']);
|
||||
$this->assertEquals('A Test user', $info['name']);
|
||||
$this->assertEquals('test@example.com', $info['mail']);
|
||||
$this->assertEquals(array('newgroup', 'user'), $info['grps']);
|
||||
$this->assertEquals(array('additional', 'admin', 'newgroup', 'user'), $auth->retrieveGroups());
|
||||
|
||||
// user modification
|
||||
$auth->modifyUser('test', array('user' => 'tester', 'name' => 'The Test User', 'pass' => 'secret'));
|
||||
$info = $auth->getUserData('tester');
|
||||
$this->assertEquals('tester', $info['user']);
|
||||
$this->assertEquals('The Test User', $info['name']);
|
||||
$this->assertTrue($auth->checkPass('tester','secret'));
|
||||
|
||||
// move user to different groups
|
||||
$auth->modifyUser('tester', array('grps' => array('user', 'admin', 'another')));
|
||||
$info = $auth->getUserData('tester');
|
||||
$this->assertEquals(array('admin', 'another', 'user'), $info['grps']);
|
||||
|
||||
|
||||
$expect = array(
|
||||
'admin' => array(
|
||||
'user' => 'admin',
|
||||
'name' => 'The Admin',
|
||||
'mail' => 'admin@example.com',
|
||||
'uid' => '1',
|
||||
'grps' => array('additional', 'admin', 'user')
|
||||
),
|
||||
'user' => array(
|
||||
'user' => 'user',
|
||||
'name' => 'A normal user',
|
||||
'mail' => 'user@example.com',
|
||||
'uid' => '2',
|
||||
'grps' => array('user')
|
||||
),
|
||||
'tester' => array(
|
||||
'user' => 'tester',
|
||||
'name' => 'The Test User',
|
||||
'mail' => 'test@example.com',
|
||||
'uid' => '3',
|
||||
'grps' => array('admin', 'another', 'user')
|
||||
)
|
||||
);
|
||||
|
||||
// list users
|
||||
$users = $auth->retrieveUsers();
|
||||
$this->assertEquals(array($expect['admin'], $expect['tester'], $expect['user']), $users);
|
||||
|
||||
$users = $auth->retrieveUsers(1); // offset
|
||||
$this->assertEquals(array($expect['tester'], $expect['user']), $users);
|
||||
|
||||
$users = $auth->retrieveUsers(1, 1); // offset + limit
|
||||
$this->assertEquals(array($expect['tester']), $users);
|
||||
|
||||
$users = $auth->retrieveUsers(0, -1, array('group' => 'admin')); // full group
|
||||
$this->assertEquals(array($expect['admin'], $expect['tester']), $users);
|
||||
$count = $auth->getUserCount(array('grps' => 'admin'));
|
||||
$this->assertSame(2, $count);
|
||||
|
||||
$users = $auth->retrieveUsers(0, -1, array('group' => 'dmi')); // substring
|
||||
$this->assertEquals(array($expect['admin'], $expect['tester']), $users);
|
||||
$count = $auth->getUserCount(array('grps' => 'dmi'));
|
||||
$this->assertSame(2, $count);
|
||||
|
||||
$users = $auth->retrieveUsers(0, -1, array('user' => 'dmi')); // substring
|
||||
$this->assertEquals(array($expect['admin']), $users);
|
||||
$count = $auth->getUserCount(array('user' => 'dmi'));
|
||||
$this->assertSame(1, $count);
|
||||
|
||||
// delete user
|
||||
$num = $auth->deleteUsers(array('tester', 'foobar'));
|
||||
$this->assertSame(1, $num);
|
||||
|
||||
}
|
||||
|
||||
}
|
Binary file not shown.
Reference in New Issue
Block a user