permissions v2 step 1

This commit is contained in:
flash 2016-10-23 15:54:01 +02:00
parent fbdd6b96da
commit 93ff094f15
3 changed files with 160 additions and 29 deletions

View file

@ -218,25 +218,43 @@ class User
* Title of the track this user last listened to. * Title of the track this user last listened to.
* @var string * @var string
*/ */
public $musicTrack; public $musicTrack = '';
/** /**
* Artist of the track this user last listened to. * Artist of the track this user last listened to.
* @var string * @var string
*/ */
public $musicArtist; public $musicArtist = '';
/** /**
* Last time this was updated. * Last time this was updated.
* @var int * @var int
*/ */
public $musicCheck; public $musicCheck = 0;
/** /**
* Whether the user is actively listening. * Whether the user is actively listening.
* @var bool * @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. * The user's birthday.
@ -364,6 +382,9 @@ class User
$this->musicArtist = $userRow->user_music_artist; $this->musicArtist = $userRow->user_music_artist;
$this->musicListening = boolval($userRow->user_music_listening); $this->musicListening = boolval($userRow->user_music_listening);
$this->musicCheck = intval($userRow->user_music_check); $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 // Temporary backwards compatible IP storage system
try { try {

59
composer.lock generated
View file

@ -1167,23 +1167,23 @@
}, },
{ {
"name": "paypal/rest-api-sdk-php", "name": "paypal/rest-api-sdk-php",
"version": "1.7.4", "version": "1.9.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/paypal/PayPal-PHP-SDK.git", "url": "https://github.com/paypal/PayPal-PHP-SDK.git",
"reference": "d62e8db407827229c6c7aabfa54792d0113b99e4" "reference": "97e5102dc8e8a3c1ee954aa067505671caa65b59"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/paypal/PayPal-PHP-SDK/zipball/d62e8db407827229c6c7aabfa54792d0113b99e4", "url": "https://api.github.com/repos/paypal/PayPal-PHP-SDK/zipball/97e5102dc8e8a3c1ee954aa067505671caa65b59",
"reference": "d62e8db407827229c6c7aabfa54792d0113b99e4", "reference": "97e5102dc8e8a3c1ee954aa067505671caa65b59",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"ext-curl": "*", "ext-curl": "*",
"ext-json": "*", "ext-json": "*",
"php": ">=5.3.0", "php": ">=5.3.0",
"psr/log": "1.0.0" "psr/log": "^1.0.0"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "3.7.*" "phpunit/phpunit": "3.7.*"
@ -1196,7 +1196,7 @@
}, },
"notification-url": "https://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
"Apache2" "Apache-2.0"
], ],
"authors": [ "authors": [
{ {
@ -1212,7 +1212,7 @@
"rest", "rest",
"sdk" "sdk"
], ],
"time": "2016-07-15 20:42:18" "time": "2016-10-21 18:07:19"
}, },
{ {
"name": "phroute/phroute", "name": "phroute/phroute",
@ -1306,22 +1306,30 @@
}, },
{ {
"name": "psr/log", "name": "psr/log",
"version": "1.0.0", "version": "1.0.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/php-fig/log.git", "url": "https://github.com/php-fig/log.git",
"reference": "fe0936ee26643249e916849d48e3a51d5f5e278b" "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/php-fig/log/zipball/fe0936ee26643249e916849d48e3a51d5f5e278b", "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d",
"reference": "fe0936ee26643249e916849d48e3a51d5f5e278b", "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d",
"shasum": "" "shasum": ""
}, },
"require": {
"php": ">=5.3.0"
},
"type": "library", "type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": { "autoload": {
"psr-0": { "psr-4": {
"Psr\\Log\\": "" "Psr\\Log\\": "Psr/Log/"
} }
}, },
"notification-url": "https://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
@ -1335,12 +1343,13 @@
} }
], ],
"description": "Common interface for logging libraries", "description": "Common interface for logging libraries",
"homepage": "https://github.com/php-fig/log",
"keywords": [ "keywords": [
"log", "log",
"psr", "psr",
"psr-3" "psr-3"
], ],
"time": "2012-12-21 11:40:51" "time": "2016-10-10 12:19:37"
}, },
{ {
"name": "swiftmailer/swiftmailer", "name": "swiftmailer/swiftmailer",
@ -1557,16 +1566,16 @@
}, },
{ {
"name": "symfony/translation", "name": "symfony/translation",
"version": "v3.1.4", "version": "v3.1.5",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/translation.git", "url": "https://github.com/symfony/translation.git",
"reference": "a35edc277513c9bc0f063ca174c36b346f974528" "reference": "93013a18d272e59dab8e67f583155b78c68947eb"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/translation/zipball/a35edc277513c9bc0f063ca174c36b346f974528", "url": "https://api.github.com/repos/symfony/translation/zipball/93013a18d272e59dab8e67f583155b78c68947eb",
"reference": "a35edc277513c9bc0f063ca174c36b346f974528", "reference": "93013a18d272e59dab8e67f583155b78c68947eb",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1617,20 +1626,20 @@
], ],
"description": "Symfony Translation Component", "description": "Symfony Translation Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2016-08-05 08:37:39" "time": "2016-09-06 11:02:40"
}, },
{ {
"name": "twig/twig", "name": "twig/twig",
"version": "v1.24.2", "version": "v1.26.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/twigphp/Twig.git", "url": "https://github.com/twigphp/Twig.git",
"reference": "33093f6e310e6976baeac7b14f3a6ec02f2d79b7" "reference": "a09d8ee17ac1cfea29ed60c83960ad685c6a898d"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/twigphp/Twig/zipball/33093f6e310e6976baeac7b14f3a6ec02f2d79b7", "url": "https://api.github.com/repos/twigphp/Twig/zipball/a09d8ee17ac1cfea29ed60c83960ad685c6a898d",
"reference": "33093f6e310e6976baeac7b14f3a6ec02f2d79b7", "reference": "a09d8ee17ac1cfea29ed60c83960ad685c6a898d",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1643,7 +1652,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "1.24-dev" "dev-master": "1.26-dev"
} }
}, },
"autoload": { "autoload": {
@ -1678,7 +1687,7 @@
"keywords": [ "keywords": [
"templating" "templating"
], ],
"time": "2016-09-01 17:50:53" "time": "2016-10-05 18:57:41"
} }
], ],
"packages-dev": [], "packages-dev": [],

View file

@ -0,0 +1,101 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Sakura\DB;
class RestructurePermissions extends Migration
{
/**
* Run the migrations.
* @return void
*/
public function up()
{
$schema = DB::getSchemaBuilder();
$schema->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',
]);
});
}
}