diff --git a/.travis.yml b/.travis.yml index 0b590c2..caa49c1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,8 @@ before_script: - git clone git://github.com/NetCommons3/NetCommons3 $NETCOMMONS_BUILD_DIR - cd $NETCOMMONS_BUILD_DIR - git checkout $NETCOMMONS_VERSION - - . tools/build/plugins/cakephp/travis/pre.sh + - travis_wait . tools/build/plugins/cakephp/travis/pre.sh + - . tools/build/plugins/cakephp/travis/environment.sh script: - . tools/build/plugins/cakephp/travis/main.sh diff --git a/Config/Migration/1403771220_init.php b/Config/Migration/1403771220_init.php deleted file mode 100644 index cb98bd4..0000000 --- a/Config/Migration/1403771220_init.php +++ /dev/null @@ -1,61 +0,0 @@ - - * @link http://www.netcommons.org NetCommons Project - * @license http://www.netcommons.org/license.txt NetCommons License - */ - -/** - * Users migration - * - * @author Jun Nishikawa - * @package NetCommons\Users\Config\Migration - */ -class Init extends CakeMigration { - -/** - * Migration description - * - * @var string - */ - public $description = ''; - -/** - * Actions to be performed - * - * @var array $migration - */ - public $migration = array( - 'up' => array( - 'create_table' => array( - ), - ), - 'down' => array( - 'drop_table' => array( - 'user_attributes', 'user_attributes_users', 'user_select_attributes', 'user_select_attributes_users', 'users' - ), - ), - ); - -/** - * Before migration callback - * - * @param string $direction up or down direction of migration process - * @return bool Should process continue - */ - public function before($direction) { - return true; - } - -/** - * After migration callback - * - * @param string $direction up or down direction of migration process - * @return bool Should process continue - */ - public function after($direction) { - return true; - } -} diff --git a/Config/Migration/1434983278_init.php b/Config/Migration/1434983278_init.php new file mode 100644 index 0000000..7323039 --- /dev/null +++ b/Config/Migration/1434983278_init.php @@ -0,0 +1,157 @@ + + * @link http://www.netcommons.org NetCommons Project + * @license http://www.netcommons.org/license.txt NetCommons License + * @copyright Copyright 2014, NetCommons Project + */ + +/** + * Init migration + * + * @package NetCommons\Users\Config\Migration + */ +class Init extends CakeMigration { + +/** + * Migration description + * + * @var string + */ + public $description = 'init'; + +/** + * Actions to be performed + * + * @var array $migration + */ + public $migration = array( + 'up' => array( + 'create_table' => array( + 'roles_user_attributes' => array( + 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary'), + 'role_key' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'user_attribute_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false), + 'can_read' => array('type' => 'boolean', 'null' => true, 'default' => null), + 'can_edit' => array('type' => 'boolean', 'null' => true, 'default' => null), + 'created_user' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false), + 'created' => array('type' => 'datetime', 'null' => true, 'default' => null), + 'modified_user' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false), + 'modified' => array('type' => 'datetime', 'null' => true, 'default' => null), + 'indexes' => array( + 'PRIMARY' => array('column' => 'id', 'unique' => 1), + ), + 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB'), + ), + 'user_attributes' => array( + 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary'), + 'language_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 6, 'unsigned' => false), + 'data_type' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 4, 'unsigned' => false, 'comment' => 'Data type of user_attribute. +1: input text, 2: radio, 3: checkbox, 4: select, 5: textarea, 6: email, 7: mobile email, 8: link, 9: html, 10: file, 11: image file, 12: auto increment, 13: date, 14: created datetime, 15: modified datetime'), + 'plugin_type' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 4, 'unsigned' => false, 'comment' => 'Plugin type of this record belongs to. +1: All, 2: Users, 3: FlexibleDatabases / FlexibleForms'), + 'label' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => 'Label of the user_attribute. +e.g.) Nickname, Age, Email Address', 'charset' => 'utf8'), + 'required' => array('type' => 'boolean', 'null' => true, 'default' => null), + 'can_read_self' => array('type' => 'boolean', 'null' => true, 'default' => null), + 'can_edit_self' => array('type' => 'boolean', 'null' => true, 'default' => null), + 'weight' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false, 'comment' => '表示順'), + 'created_user' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false), + 'created' => array('type' => 'datetime', 'null' => true, 'default' => null), + 'modified_user' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false), + 'modified' => array('type' => 'datetime', 'null' => true, 'default' => null), + 'indexes' => array( + 'PRIMARY' => array('column' => 'id', 'unique' => 1), + ), + 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB'), + ), + 'user_attributes_users' => array( + 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary'), + 'language_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 6, 'unsigned' => false), + 'user_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false), + 'user_attribute_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false), + 'key' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => 'Key to identify record meaning. +e.g.) nickname, age, ', 'charset' => 'utf8'), + 'value' => array('type' => 'text', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'created_user' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false), + 'created' => array('type' => 'datetime', 'null' => true, 'default' => null), + 'modified_user' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false), + 'modified' => array('type' => 'datetime', 'null' => true, 'default' => null), + 'indexes' => array( + 'PRIMARY' => array('column' => 'id', 'unique' => 1), + ), + 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB'), + ), + 'user_select_attributes' => array( + 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary'), + 'language_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 6, 'unsigned' => false), + 'user_attribute_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false), + 'created_user' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false), + 'created' => array('type' => 'datetime', 'null' => true, 'default' => null), + 'modified_user' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false), + 'modified' => array('type' => 'datetime', 'null' => true, 'default' => null), + 'indexes' => array( + 'PRIMARY' => array('column' => 'id', 'unique' => 1), + ), + 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB'), + ), + 'user_select_attributes_users' => array( + 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary'), + 'user_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false), + 'user_select_attribute_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false), + 'value' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false, 'comment' => 'Value of the record. +e.g.) 0, 1, 5, 10'), + 'created_user' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false), + 'created' => array('type' => 'datetime', 'null' => true, 'default' => null), + 'modified_user' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false), + 'modified' => array('type' => 'datetime', 'null' => true, 'default' => null), + 'indexes' => array( + 'PRIMARY' => array('column' => 'id', 'unique' => 1), + ), + 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB'), + ), + 'users' => array( + 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary'), + 'username' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'password' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'role_key' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'created_user' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false), + 'created' => array('type' => 'datetime', 'null' => true, 'default' => null), + 'modified_user' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false), + 'modified' => array('type' => 'datetime', 'null' => true, 'default' => null), + 'indexes' => array( + 'PRIMARY' => array('column' => 'id', 'unique' => 1), + ), + 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB'), + ), + ), + ), + 'down' => array( + 'drop_table' => array( + 'roles_user_attributes', 'user_attributes', 'user_attributes_users', 'user_select_attributes', 'user_select_attributes_users', 'users' + ), + ), + ); + +/** + * Before migration callback + * + * @param string $direction Direction of migration process (up or down) + * @return bool Should process continue + */ + public function before($direction) { + return true; + } + +/** + * After migration callback + * + * @param string $direction Direction of migration process (up or down) + * @return bool Should process continue + */ + public function after($direction) { + return true; + } +} diff --git a/Config/Schema/empty b/Config/Schema/empty deleted file mode 100644 index e69de29..0000000 diff --git a/Config/Schema/schema.php b/Config/Schema/schema.php index da6233f..4522550 100644 --- a/Config/Schema/schema.php +++ b/Config/Schema/schema.php @@ -1,18 +1,180 @@ + * @author Noriko Arai + * @author Shohei Nakajima * @link http://www.netcommons.org NetCommons Project * @license http://www.netcommons.org/license.txt NetCommons License + * @copyright Copyright 2014, NetCommons Project */ /** - * Users schema + * Schema file * - * @author Jun Nishikawa - * @package NetCommons\Users\Config\Migration + * @author Shohei Nakajima + * @package NetCommons\NetCommons\Config\Schema + * @SuppressWarnings(PHPMD.LongVariable) + * @SuppressWarnings(PHPMD.TooManyFields) */ -class UsersSchema extends CakeSchema { +class AppSchema extends CakeSchema { + +/** + * Database connection + * + * @var string + */ + public $connection = 'master'; + +/** + * before + * + * @param array $event savent + * @return bool + */ + public function before($event = array()) { + return true; + } + +/** + * after + * + * @param array $event event + * @return void + */ + public function after($event = array()) { + } + +/** + * roles_user_attributes table + * + * @var array + */ + public $roles_user_attributes = array( + 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary'), + 'role_key' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'user_attribute_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false), + 'can_read' => array('type' => 'boolean', 'null' => true, 'default' => null), + 'can_edit' => array('type' => 'boolean', 'null' => true, 'default' => null), + 'created_user' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false), + 'created' => array('type' => 'datetime', 'null' => true, 'default' => null), + 'modified_user' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false), + 'modified' => array('type' => 'datetime', 'null' => true, 'default' => null), + 'indexes' => array( + 'PRIMARY' => array('column' => 'id', 'unique' => 1) + ), + 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB') + ); + +/** + * user_attributes table + * + * @var array + */ + public $user_attributes = array( + 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary'), + 'language_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 6, 'unsigned' => false), + 'data_type' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 4, 'unsigned' => false, 'comment' => 'Data type of user_attribute. +1: input text, 2: radio, 3: checkbox, 4: select, 5: textarea, 6: email, 7: mobile email, 8: link, 9: html, 10: file, 11: image file, 12: auto increment, 13: date, 14: created datetime, 15: modified datetime'), + 'plugin_type' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 4, 'unsigned' => false, 'comment' => 'Plugin type of this record belongs to. +1: All, 2: Users, 3: FlexibleDatabases / FlexibleForms'), + 'label' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => 'Label of the user_attribute. +e.g.) Nickname, Age, Email Address', 'charset' => 'utf8'), + 'required' => array('type' => 'boolean', 'null' => true, 'default' => null), + 'can_read_self' => array('type' => 'boolean', 'null' => true, 'default' => null), + 'can_edit_self' => array('type' => 'boolean', 'null' => true, 'default' => null), + 'weight' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false, 'comment' => '表示順'), + 'created_user' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false), + 'created' => array('type' => 'datetime', 'null' => true, 'default' => null), + 'modified_user' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false), + 'modified' => array('type' => 'datetime', 'null' => true, 'default' => null), + 'indexes' => array( + 'PRIMARY' => array('column' => 'id', 'unique' => 1) + ), + 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB') + ); + +/** + * user_attributes_users table + * + * @var array + */ + public $user_attributes_users = array( + 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary'), + 'language_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 6, 'unsigned' => false), + 'user_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false), + 'user_attribute_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false), + 'key' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => 'Key to identify record meaning. +e.g.) nickname, age, ', 'charset' => 'utf8'), + 'value' => array('type' => 'text', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'created_user' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false), + 'created' => array('type' => 'datetime', 'null' => true, 'default' => null), + 'modified_user' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false), + 'modified' => array('type' => 'datetime', 'null' => true, 'default' => null), + 'indexes' => array( + 'PRIMARY' => array('column' => 'id', 'unique' => 1) + ), + 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB') + ); + +/** + * user_select_attributes table + * + * @var array + */ + public $user_select_attributes = array( + 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary'), + 'language_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 6, 'unsigned' => false), + 'user_attribute_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false), + 'created_user' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false), + 'created' => array('type' => 'datetime', 'null' => true, 'default' => null), + 'modified_user' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false), + 'modified' => array('type' => 'datetime', 'null' => true, 'default' => null), + 'indexes' => array( + 'PRIMARY' => array('column' => 'id', 'unique' => 1) + ), + 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB') + ); + +/** + * user_select_attributes_users table + * + * @var array + */ + public $user_select_attributes_users = array( + 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary'), + 'user_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false), + 'user_select_attribute_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false), + 'value' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false, 'comment' => 'Value of the record. +e.g.) 0, 1, 5, 10'), + 'created_user' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false), + 'created' => array('type' => 'datetime', 'null' => true, 'default' => null), + 'modified_user' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false), + 'modified' => array('type' => 'datetime', 'null' => true, 'default' => null), + 'indexes' => array( + 'PRIMARY' => array('column' => 'id', 'unique' => 1) + ), + 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB') + ); + +/** + * users table + * + * @var array + */ + public $users = array( + 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary'), + 'username' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'password' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'role_key' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'created_user' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false), + 'created' => array('type' => 'datetime', 'null' => true, 'default' => null), + 'modified_user' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false), + 'modified' => array('type' => 'datetime', 'null' => true, 'default' => null), + 'indexes' => array( + 'PRIMARY' => array('column' => 'id', 'unique' => 1) + ), + 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB') + ); } diff --git a/composer.json b/composer.json index 6113076..3461768 100644 --- a/composer.json +++ b/composer.json @@ -17,18 +17,18 @@ } }, "require": { - "cakephp/cakephp": "~2.4", - "cakephp/debug_kit": "~2.2", - "cakedc/migrations": "~2.2", - "twbs/bootstrap": "~3.1", - "components/jquery": "~2.1" + "cakedc/migrations": "~2.2", + "cakephp/cakephp": "~2.6.9", + "cakephp/debug_kit": "~2.2", + "components/jquery": "~2.1", + "twbs/bootstrap": "~3.1" }, "require-dev": { - "netcommons/auth": "@dev", - "netcommons/roles": "@dev", - "netcommons/rooms": "@dev", - "mustangostang/spyc": "@dev", - "satooshi/php-coveralls": "@dev" + "mustangostang/spyc": "@dev", + "netcommons/auth": "@dev", + "netcommons/roles": "@dev", + "netcommons/rooms": "@dev", + "satooshi/php-coveralls": "@dev" }, "config": { "vendor-dir": "vendors"