From 93ff094f1560d26f86e485f372c74ae02afc2ae6 Mon Sep 17 00:00:00 2001 From: flashwave Date: Sun, 23 Oct 2016 15:54:01 +0200 Subject: [PATCH] permissions v2 step 1 --- app/User.php | 29 ++++- composer.lock | 59 +++++----- ...6_11_23_152450_restructure_permissions.php | 101 ++++++++++++++++++ 3 files changed, 160 insertions(+), 29 deletions(-) create mode 100644 database/2016_11_23_152450_restructure_permissions.php diff --git a/app/User.php b/app/User.php index 4405bf2..0239319 100644 --- a/app/User.php +++ b/app/User.php @@ -218,25 +218,43 @@ class User * Title of the track this user last listened to. * @var string */ - public $musicTrack; + public $musicTrack = ''; /** * Artist of the track this user last listened to. * @var string */ - public $musicArtist; + public $musicArtist = ''; /** * Last time this was updated. * @var int */ - public $musicCheck; + public $musicCheck = 0; /** * Whether the user is actively listening. * @var bool */ - public $musicListening; + public $musicListening = false; + + /** + * Is this user active? + * @var bool + */ + public $activated = false; + + /** + * Is this user verified? + * @var bool + */ + public $verified = false; + + /** + * Is this user restricted? + * @var bool + */ + public $restricted = false; /** * The user's birthday. @@ -364,6 +382,9 @@ class User $this->musicArtist = $userRow->user_music_artist; $this->musicListening = boolval($userRow->user_music_listening); $this->musicCheck = intval($userRow->user_music_check); + $this->activated = boolval($userRow->user_activated); + $this->verified = boolval($userRow->user_verified); + $this->restricted = boolval($userRow->user_restricted); // Temporary backwards compatible IP storage system try { diff --git a/composer.lock b/composer.lock index 473081f..4f9eabc 100644 --- a/composer.lock +++ b/composer.lock @@ -1167,23 +1167,23 @@ }, { "name": "paypal/rest-api-sdk-php", - "version": "1.7.4", + "version": "1.9.0", "source": { "type": "git", "url": "https://github.com/paypal/PayPal-PHP-SDK.git", - "reference": "d62e8db407827229c6c7aabfa54792d0113b99e4" + "reference": "97e5102dc8e8a3c1ee954aa067505671caa65b59" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/paypal/PayPal-PHP-SDK/zipball/d62e8db407827229c6c7aabfa54792d0113b99e4", - "reference": "d62e8db407827229c6c7aabfa54792d0113b99e4", + "url": "https://api.github.com/repos/paypal/PayPal-PHP-SDK/zipball/97e5102dc8e8a3c1ee954aa067505671caa65b59", + "reference": "97e5102dc8e8a3c1ee954aa067505671caa65b59", "shasum": "" }, "require": { "ext-curl": "*", "ext-json": "*", "php": ">=5.3.0", - "psr/log": "1.0.0" + "psr/log": "^1.0.0" }, "require-dev": { "phpunit/phpunit": "3.7.*" @@ -1196,7 +1196,7 @@ }, "notification-url": "https://packagist.org/downloads/", "license": [ - "Apache2" + "Apache-2.0" ], "authors": [ { @@ -1212,7 +1212,7 @@ "rest", "sdk" ], - "time": "2016-07-15 20:42:18" + "time": "2016-10-21 18:07:19" }, { "name": "phroute/phroute", @@ -1306,22 +1306,30 @@ }, { "name": "psr/log", - "version": "1.0.0", + "version": "1.0.2", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b" + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/fe0936ee26643249e916849d48e3a51d5f5e278b", - "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b", + "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", "shasum": "" }, + "require": { + "php": ">=5.3.0" + }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, "autoload": { - "psr-0": { - "Psr\\Log\\": "" + "psr-4": { + "Psr\\Log\\": "Psr/Log/" } }, "notification-url": "https://packagist.org/downloads/", @@ -1335,12 +1343,13 @@ } ], "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", "keywords": [ "log", "psr", "psr-3" ], - "time": "2012-12-21 11:40:51" + "time": "2016-10-10 12:19:37" }, { "name": "swiftmailer/swiftmailer", @@ -1557,16 +1566,16 @@ }, { "name": "symfony/translation", - "version": "v3.1.4", + "version": "v3.1.5", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "a35edc277513c9bc0f063ca174c36b346f974528" + "reference": "93013a18d272e59dab8e67f583155b78c68947eb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/a35edc277513c9bc0f063ca174c36b346f974528", - "reference": "a35edc277513c9bc0f063ca174c36b346f974528", + "url": "https://api.github.com/repos/symfony/translation/zipball/93013a18d272e59dab8e67f583155b78c68947eb", + "reference": "93013a18d272e59dab8e67f583155b78c68947eb", "shasum": "" }, "require": { @@ -1617,20 +1626,20 @@ ], "description": "Symfony Translation Component", "homepage": "https://symfony.com", - "time": "2016-08-05 08:37:39" + "time": "2016-09-06 11:02:40" }, { "name": "twig/twig", - "version": "v1.24.2", + "version": "v1.26.1", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "33093f6e310e6976baeac7b14f3a6ec02f2d79b7" + "reference": "a09d8ee17ac1cfea29ed60c83960ad685c6a898d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/33093f6e310e6976baeac7b14f3a6ec02f2d79b7", - "reference": "33093f6e310e6976baeac7b14f3a6ec02f2d79b7", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/a09d8ee17ac1cfea29ed60c83960ad685c6a898d", + "reference": "a09d8ee17ac1cfea29ed60c83960ad685c6a898d", "shasum": "" }, "require": { @@ -1643,7 +1652,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.24-dev" + "dev-master": "1.26-dev" } }, "autoload": { @@ -1678,7 +1687,7 @@ "keywords": [ "templating" ], - "time": "2016-09-01 17:50:53" + "time": "2016-10-05 18:57:41" } ], "packages-dev": [], diff --git a/database/2016_11_23_152450_restructure_permissions.php b/database/2016_11_23_152450_restructure_permissions.php new file mode 100644 index 0000000..7124382 --- /dev/null +++ b/database/2016_11_23_152450_restructure_permissions.php @@ -0,0 +1,101 @@ +table('users', function (Blueprint $table) { + $table->text('user_activated') + ->default(0); + + $table->text('user_verified') + ->default(0); + + $table->text('user_restricted') + ->default(0); + }); + + $schema->create('perms', function (Blueprint $table) { + $table->integer('user_id')->default(0); + $table->integer('rank_id')->default(0); + + $table->boolean('perm_change_profile')->default(false); + $table->boolean('perm_change_avatar')->default(false); + $table->boolean('perm_change_background')->default(false); + $table->boolean('perm_change_header')->default(false); + $table->boolean('perm_change_userpage')->default(false); + $table->boolean('perm_change_signature')->default(false); + $table->boolean('perm_change_username')->default(false); + $table->boolean('perm_change_user_title')->default(false); + + $table->boolean('perm_deactivate_account')->default(false); + + $table->boolean('perm_view_user_links')->default(false); + $table->boolean('perm_view_user_details')->default(false); + + $table->boolean('perm_manage_ranks')->default(false); + $table->boolean('perm_manage_friends')->default(false); + + $table->boolean('perm_comments_create')->default(false); + $table->boolean('perm_comments_edit')->default(false); + $table->boolean('perm_comments_delete')->default(false); + $table->boolean('perm_comments_vote')->default(false); + + $table->boolean('perm_is_mod')->default(false); + $table->boolean('perm_is_admin')->default(false); + $table->boolean('perm_can_restrict')->default(false); + $table->boolean('perm_manage_profile_images')->default(false); + }); + + $schema->create('forum_perms', function (Blueprint $table) { + $table->integer('forum_id')->default(0); + $table->integer('user_id')->default(0); + $table->integer('rank_id')->default(0); + + $table->boolean('perm_view')->default(false); + $table->boolean('perm_reply')->default(false); + + $table->boolean('perm_topic_create')->default(false); + $table->boolean('perm_topic_delete')->default(false); + $table->boolean('perm_topic_move')->default(false); + + $table->boolean('perm_edit')->default(false); + $table->boolean('perm_edit_any')->default(false); + + $table->boolean('perm_delete')->default(false); + $table->boolean('perm_delete_any')->default(false); + + $table->boolean('perm_bypass_rules')->default(false); + + $table->boolean('perm_change_type')->default(false); + $table->boolean('perm_change_status')->default(false); + }); + } + + /** + * Reverse the migrations. + * @return void + */ + public function down() + { + $schema = DB::getSchemaBuilder(); + $schema->drop('forum_perms'); + $schema->drop('perms'); + $schema->table('users', function (Blueprint $table) { + $table->dropColumn([ + 'user_activated', + 'user_verified', + 'user_restricted', + ]); + }); + } +}