mod profile image shit

This commit is contained in:
Pachira 2016-09-16 21:57:51 +02:00
parent 45b9ca91e4
commit 4c5ff241b6
5 changed files with 68 additions and 64 deletions

View file

@ -117,37 +117,37 @@ class SetupCommand extends Command
[
'rank_id' => config('rank.inactive'),
'permissions_site' => '00000000000000000000000000000001',
'permissions_manage' => '00',
'permissions_manage' => '000',
],
[
'rank_id' => config('rank.regular'),
'permissions_site' => '11110000111111111100111101101100',
'permissions_manage' => '00',
'permissions_manage' => '000',
],
[
'rank_id' => config('rank.mod'),
'permissions_site' => '11110001111111111111111111111100',
'permissions_manage' => '11',
'permissions_manage' => '111',
],
[
'rank_id' => config('rank.admin'),
'permissions_site' => '11110111111111111111111111111100',
'permissions_manage' => '11',
'permissions_manage' => '111',
],
[
'rank_id' => config('rank.bot'),
'permissions_site' => '11110000111111111100111101101100',
'permissions_manage' => '00',
'permissions_manage' => '000',
],
[
'rank_id' => config('rank.premium'),
'permissions_site' => '11110001111111111111111111111100',
'permissions_manage' => '00',
'permissions_manage' => '000',
],
[
'rank_id' => config('rank.banned'),
'permissions_site' => '11110000000011010100101000100010',
'permissions_manage' => '00',
'permissions_manage' => '000',
],
];

View file

@ -164,7 +164,7 @@ class FileController extends Controller
$user = User::construct($params[0] ?? 0);
if (session_check()) {
if (!CurrentSession::$user->permission(Manage::USE_MANAGE, Perms::MANAGE)
if (!CurrentSession::$user->permission(Manage::CHANGE_IMAGES, Perms::MANAGE)
&& ($user->id !== CurrentSession::$user->id
|| !$user->permission(constant("Sakura\Perms\Site::CHANGE_" . strtoupper($method)))
|| $user->permission(Site::DEACTIVATED)

View file

@ -94,15 +94,13 @@ class Perms
}
// Fetch from the db
$get = $get->get();
$get = $get->first();
// Check if anything was returned
if ($get) {
$get = get_object_vars($get[0]);
if (array_key_exists($this->column, $get) && $get['rank_id']) {
if (property_exists($get, $this->column) && $get->rank_id) {
// Perform a bitwise OR
$perm = $perm | bindec((string) $get[$this->column]);
$perm = $perm | bindec((string) $get->{$this->column});
}
}
@ -138,15 +136,13 @@ class Perms
}
// Fetch from the db
$get = $get->get();
$get = $get->first();
// Check if anything was returned
if ($get) {
$get = get_object_vars($get[0]);
if (array_key_exists($this->column, $get) && $get['user_id']) {
if (property_exists($get, $this->column) && $get->user_id) {
// Perform a bitwise OR
$perm = $perm | bindec((string) $get[$this->column]);
$perm = $perm | bindec((string) $get->{$this->column});
}
}

View file

@ -22,4 +22,9 @@ class Manage
* Can this user toggle the restriction status of users?
*/
const CAN_RESTRICT_USERS = 2;
/**
* Can this user alter other user's profile images?
*/
const CHANGE_IMAGES = 4;
}

95
composer.lock generated
View file

@ -535,16 +535,16 @@
},
{
"name": "doctrine/dbal",
"version": "v2.5.4",
"version": "v2.5.5",
"source": {
"type": "git",
"url": "https://github.com/doctrine/dbal.git",
"reference": "abbdfd1cff43a7b99d027af3be709bc8fc7d4769"
"reference": "9f8c05cd5225a320d56d4bfdb4772f10d045a0c9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/dbal/zipball/abbdfd1cff43a7b99d027af3be709bc8fc7d4769",
"reference": "abbdfd1cff43a7b99d027af3be709bc8fc7d4769",
"url": "https://api.github.com/repos/doctrine/dbal/zipball/9f8c05cd5225a320d56d4bfdb4772f10d045a0c9",
"reference": "9f8c05cd5225a320d56d4bfdb4772f10d045a0c9",
"shasum": ""
},
"require": {
@ -553,7 +553,7 @@
},
"require-dev": {
"phpunit/phpunit": "4.*",
"symfony/console": "2.*"
"symfony/console": "2.*||^3.0"
},
"suggest": {
"symfony/console": "For helpful console commands such as SQL execution and import of files."
@ -602,7 +602,7 @@
"persistence",
"queryobject"
],
"time": "2016-01-05 22:11:12"
"time": "2016-09-09 19:13:33"
},
{
"name": "doctrine/inflector",
@ -766,16 +766,16 @@
},
{
"name": "illuminate/container",
"version": "v5.2.37",
"version": "v5.2.45",
"source": {
"type": "git",
"url": "https://github.com/illuminate/container.git",
"reference": "7ec395833738b9059f829348ddc9a59d0118ac88"
"reference": "5139cebc8293b6820b91aef6f4b4e18bde33c9b2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/illuminate/container/zipball/7ec395833738b9059f829348ddc9a59d0118ac88",
"reference": "7ec395833738b9059f829348ddc9a59d0118ac88",
"url": "https://api.github.com/repos/illuminate/container/zipball/5139cebc8293b6820b91aef6f4b4e18bde33c9b2",
"reference": "5139cebc8293b6820b91aef6f4b4e18bde33c9b2",
"shasum": ""
},
"require": {
@ -800,25 +800,25 @@
"authors": [
{
"name": "Taylor Otwell",
"email": "taylorotwell@gmail.com"
"email": "taylor@laravel.com"
}
],
"description": "The Illuminate Container package.",
"homepage": "http://laravel.com",
"time": "2016-05-29 02:18:23"
"time": "2016-08-01 13:49:14"
},
{
"name": "illuminate/contracts",
"version": "v5.2.37",
"version": "v5.2.45",
"source": {
"type": "git",
"url": "https://github.com/illuminate/contracts.git",
"reference": "f4f44d7c6d20404da8dfc655bd3d6dd788dfdce5"
"reference": "22bde7b048a33c702d9737fc1446234fff9b1363"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/illuminate/contracts/zipball/f4f44d7c6d20404da8dfc655bd3d6dd788dfdce5",
"reference": "f4f44d7c6d20404da8dfc655bd3d6dd788dfdce5",
"url": "https://api.github.com/repos/illuminate/contracts/zipball/22bde7b048a33c702d9737fc1446234fff9b1363",
"reference": "22bde7b048a33c702d9737fc1446234fff9b1363",
"shasum": ""
},
"require": {
@ -842,25 +842,25 @@
"authors": [
{
"name": "Taylor Otwell",
"email": "taylorotwell@gmail.com"
"email": "taylor@laravel.com"
}
],
"description": "The Illuminate Contracts package.",
"homepage": "http://laravel.com",
"time": "2016-05-31 21:36:13"
"time": "2016-08-08 11:46:08"
},
{
"name": "illuminate/database",
"version": "v5.2.37",
"version": "v5.2.45",
"source": {
"type": "git",
"url": "https://github.com/illuminate/database.git",
"reference": "c0746930dc6a6ff9b72945152609d61a3b3829c6"
"reference": "4a70c0598ed41d18a99f23c12be4e22b5006d30a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/illuminate/database/zipball/c0746930dc6a6ff9b72945152609d61a3b3829c6",
"reference": "c0746930dc6a6ff9b72945152609d61a3b3829c6",
"url": "https://api.github.com/repos/illuminate/database/zipball/4a70c0598ed41d18a99f23c12be4e22b5006d30a",
"reference": "4a70c0598ed41d18a99f23c12be4e22b5006d30a",
"shasum": ""
},
"require": {
@ -896,7 +896,7 @@
"authors": [
{
"name": "Taylor Otwell",
"email": "taylorotwell@gmail.com"
"email": "taylor@laravel.com"
}
],
"description": "The Illuminate Database package.",
@ -907,20 +907,20 @@
"orm",
"sql"
],
"time": "2016-06-06 13:12:46"
"time": "2016-08-25 07:01:20"
},
{
"name": "illuminate/filesystem",
"version": "v5.2.37",
"version": "v5.2.45",
"source": {
"type": "git",
"url": "https://github.com/illuminate/filesystem.git",
"reference": "e9c3ba4fce5853f559f805a5626b18517a55b8b3"
"reference": "39668a50e0cf1d673e58e7dbb437475708cfb508"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/illuminate/filesystem/zipball/e9c3ba4fce5853f559f805a5626b18517a55b8b3",
"reference": "e9c3ba4fce5853f559f805a5626b18517a55b8b3",
"url": "https://api.github.com/repos/illuminate/filesystem/zipball/39668a50e0cf1d673e58e7dbb437475708cfb508",
"reference": "39668a50e0cf1d673e58e7dbb437475708cfb508",
"shasum": ""
},
"require": {
@ -952,25 +952,25 @@
"authors": [
{
"name": "Taylor Otwell",
"email": "taylorotwell@gmail.com"
"email": "taylor@laravel.com"
}
],
"description": "The Illuminate Filesystem package.",
"homepage": "http://laravel.com",
"time": "2016-05-31 15:08:27"
"time": "2016-08-17 17:21:29"
},
{
"name": "illuminate/support",
"version": "v5.2.37",
"version": "v5.2.45",
"source": {
"type": "git",
"url": "https://github.com/illuminate/support.git",
"reference": "6e86ac2b4e3d0c42c2dc846dbac3e74d378a812b"
"reference": "510230ab62a7d85dc70203f4fdca6fb71a19e08a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/illuminate/support/zipball/6e86ac2b4e3d0c42c2dc846dbac3e74d378a812b",
"reference": "6e86ac2b4e3d0c42c2dc846dbac3e74d378a812b",
"url": "https://api.github.com/repos/illuminate/support/zipball/510230ab62a7d85dc70203f4fdca6fb71a19e08a",
"reference": "510230ab62a7d85dc70203f4fdca6fb71a19e08a",
"shasum": ""
},
"require": {
@ -980,6 +980,9 @@
"paragonie/random_compat": "~1.4",
"php": ">=5.5.9"
},
"replace": {
"tightenco/collect": "self.version"
},
"suggest": {
"illuminate/filesystem": "Required to use the composer class (5.2.*).",
"jeremeamia/superclosure": "Required to be able to serialize closures (~2.2).",
@ -1008,12 +1011,12 @@
"authors": [
{
"name": "Taylor Otwell",
"email": "taylorotwell@gmail.com"
"email": "taylor@laravel.com"
}
],
"description": "The Illuminate Support package.",
"homepage": "http://laravel.com",
"time": "2016-05-30 02:40:53"
"time": "2016-08-05 14:49:58"
},
{
"name": "nesbot/carbon",
@ -1502,16 +1505,16 @@
},
{
"name": "symfony/translation",
"version": "v3.1.3",
"version": "v3.1.4",
"source": {
"type": "git",
"url": "https://github.com/symfony/translation.git",
"reference": "7713ddf81518d0823b027fe74ec390b80f6b6536"
"reference": "a35edc277513c9bc0f063ca174c36b346f974528"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/translation/zipball/7713ddf81518d0823b027fe74ec390b80f6b6536",
"reference": "7713ddf81518d0823b027fe74ec390b80f6b6536",
"url": "https://api.github.com/repos/symfony/translation/zipball/a35edc277513c9bc0f063ca174c36b346f974528",
"reference": "a35edc277513c9bc0f063ca174c36b346f974528",
"shasum": ""
},
"require": {
@ -1562,20 +1565,20 @@
],
"description": "Symfony Translation Component",
"homepage": "https://symfony.com",
"time": "2016-07-26 08:04:17"
"time": "2016-08-05 08:37:39"
},
{
"name": "twig/twig",
"version": "v1.24.1",
"version": "v1.24.2",
"source": {
"type": "git",
"url": "https://github.com/twigphp/Twig.git",
"reference": "3566d311a92aae4deec6e48682dc5a4528c4a512"
"reference": "33093f6e310e6976baeac7b14f3a6ec02f2d79b7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/twigphp/Twig/zipball/3566d311a92aae4deec6e48682dc5a4528c4a512",
"reference": "3566d311a92aae4deec6e48682dc5a4528c4a512",
"url": "https://api.github.com/repos/twigphp/Twig/zipball/33093f6e310e6976baeac7b14f3a6ec02f2d79b7",
"reference": "33093f6e310e6976baeac7b14f3a6ec02f2d79b7",
"shasum": ""
},
"require": {
@ -1623,7 +1626,7 @@
"keywords": [
"templating"
],
"time": "2016-05-30 09:11:59"
"time": "2016-09-01 17:50:53"
}
],
"packages-dev": [],