Skip to content

Commit

Permalink
Finish 5.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Schlaefer committed Nov 16, 2019
2 parents 7d085ea + 5657e5e commit e849bf1
Show file tree
Hide file tree
Showing 160 changed files with 6,932 additions and 2,258 deletions.
1,016 changes: 1,016 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<include name="webroot/**"/>
<include name=".htaccess"/>
<include name="index.php"/>
<include name="CHANGELOG.md"/>
<include name="README.md"/>
<exclude name="**/css/src/**"/>
<exclude name="plugins/*/tests/**"/>
Expand Down
10 changes: 4 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"josegonzalez/dotenv": "*",
"mobiledetect/mobiledetectlib": "2.*",

"aura/di": "^2.2.5",
"aura/di": "^4.0",
"davidyell/proffer": "^1.0",
"jbbcode/jbbcode": "~1.4",
"markstory/geshi": "^3",
Expand Down Expand Up @@ -99,12 +99,11 @@

"cs-check": "phpcs --runtime-set ignore_warnings_on_exit true",
"cs-fix": "phpcbf > /dev/null || true",
"check": ["@cs-fix", "@cs-check"],
"php-check": ["@phpstan", "@cs-fix", "@cs-check"],
"phpstan": "vendor/bin/phpstan analyse --ansi",
"coverage": [
"unset XDEBUG_CONFIG",
"Composer\\Config::disableProcessTimeout",
"composer phpunit -- --coverage-html docs/local/"
"unset XDEBUG_CONFIG; composer phpunit -- --coverage-html docs/local/"
],
"phpunit-stop": [
"Composer\\Config::disableProcessTimeout",
Expand All @@ -117,8 +116,7 @@
"test": [
"unset XDEBUG_CONFIG",
"@phpunit",
"@phpstan",
"@check"
"@php-check"
],

"js-all": "yarn run test",
Expand Down
32 changes: 18 additions & 14 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions config/Migrations/20191013000000_Saito5x5x0.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php
use Migrations\AbstractMigration;

class Saito5x5x0 extends AbstractMigration
{

public function up()
{
$this->execute('DELETE FROM `settings` WHERE `name` IN (\'block_user_ui\')');
}

public function down()
{
}
}

2 changes: 1 addition & 1 deletion config/Seeds/UsersSeed.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function run()
{
$data = [
'id' => 1,
'user_type' => 'admin',
'user_type' => 'owner',
'username' => '__set_by_installer__',
'password' => '__set_by_installer__',
'activate_code' => '0',
Expand Down
1 change: 1 addition & 0 deletions config/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
/**
* Load additional config files
*/
Configure::load('permissions', 'default');
Configure::load('saito_config', 'default');
Configure::config('saitoCore', new PhpConfig(APP . '/Lib/'));
Configure::load('version', 'saitoCore');
Expand Down
115 changes: 115 additions & 0 deletions config/permissions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
<?php declare(strict_types=1);

/**
* Saito - The Threaded Web Forum
*
* @copyright Copyright (c) the Saito Project Developers
* @link https://github.com/Schlaefer/Saito
* @license http://opensource.org/licenses/MIT
*/

use Saito\User\Permission\ResourceAC;
use Saito\User\Permission\Resource;
use Saito\User\Permission\Resources;
use Saito\User\Permission\Roles;

/**
* Create roles and assign which permissions from other roles are allowed too
*
* Add translations in nondynamic.po as 'permission.role.<ID-number>'
*/
$config['Saito']['Permission']['Roles'] = (new Roles)
// Non logged-in visitors
->add('anon', 0)
// Registered and logged-in users
->add('user', 1, ['anon'])
// Moderators
->add('mod', 2, ['user', 'anon'])
// Administrators
->add('admin', 3, ['mod', 'user', 'anon'])
// Owners
->add('owner', 4, ['admin', 'mod', 'user', 'anon']);

/**
* Permissions
*
* everbody > owner > role
*/
$config['Saito']['Permission']['Resources'] = (new Resources())
/**
* Allow roles access to resource based on roles
*/
// Access to the administration backend
->add((new Resource('saito.core.admin.backend'))
->allow((new ResourceAC())->asRole('admin')))
// Pin or lock a posting
->add((new Resource('saito.core.posting.pinAndLock'))
->allow((new ResourceAC())->asRole('mod')))
// Delete a posting
->add((new Resource('saito.core.posting.delete'))
->allow((new ResourceAC())->asRole('mod')))
// Allow user to edit their own postings
->add((new Resource('saito.core.posting.edit'))
->allow((new ResourceAC())->onOwn()))
// "Moderator" mode. Restricted to other user and accessible categories
->add((new Resource('saito.core.posting.edit.restricted'))
->allow((new ResourceAC())->asRole('mod')))
// Allows unrestricted editing of postings
->add((new Resource('saito.core.posting.edit.unrestricted'))
->allow((new ResourceAC())->asRole('admin')))
// Show user's IP address if available
->add((new Resource('saito.core.posting.ip.view'))
->allow((new ResourceAC())->asRole('mod')))
// Merge postings
->add((new Resource('saito.core.posting.merge'))
->allow((new ResourceAC())->asRole('mod')))
// Show a user's activation status
->add((new Resource('saito.core.user.activate.view'))
->allow((new ResourceAC())->asRole('admin')))
// Contact a user no matter their contact settings
->add((new Resource('saito.core.user.contact'))
->allow((new ResourceAC())->asRole('admin')))
// Delete user
->add((new Resource('saito.core.user.delete'))
->allow((new ResourceAC())->asRole('mod')->onRole('user'))
->allow((new ResourceAC())->asRole('admin')->onRoles('mod', 'user'))
->allow((new ResourceAC())->asRole('owner')))
// Edit a user's profile page
->add((new Resource('saito.core.user.edit'))
->allow((new ResourceAC())->onOwn())
->allow((new ResourceAC())->asRole('admin')))
// Change a user's email address
->add((new Resource('saito.core.user.email.set'))
->allow((new ResourceAC())->asRole('admin')))
// Allows locking-out of users
->add((new Resource('saito.core.user.lock.set'))
->allow((new ResourceAC())->asRole('mod')->onRole('user'))
->allow((new ResourceAC())->asRole('admin')->onRoles('mod', 'user'))
->allow((new ResourceAC())->asRole('owner')))
// Show a user's blocking status
->add((new Resource('saito.core.user.lock.view'))
->allow((new ResourceAC())->asRole('user')))
// Change a user's name
->add((new Resource('saito.core.user.name.set'))
->allow((new ResourceAC())->asRole('admin')))
// Change a user's password
->add((new Resource('saito.core.user.password.set'))
->allow((new ResourceAC())->asRole('admin')->onRoles('mod', 'user'))
->allow((new ResourceAC())->asRole('owner')))
// Change a user's role. Allowed ranks: all the current user has but not
// their own rank.
->add((new Resource('saito.core.user.role.set.restricted'))
->allow((new ResourceAC())->asRole('admin')->onRoles('mod', 'user')))
// Change a user's role. Allowed ranks: all the current user has including
// their own rank.
->add((new Resource('saito.core.user.role.set.unrestricted'))
->allow((new ResourceAC())->asRole('owner')))
// Deleting bookmarks
->add((new Resource('saito.plugin.bookmarks.delete'))
->allow((new ResourceAC())->onOwn()))
// Use the register form
->add((new Resource('saito.core.user.register'))
->allow((new ResourceAC())->asEverybody()))
;

return $config;
1 change: 0 additions & 1 deletion config/saito_config.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,5 +125,4 @@
->addType('video/mp4')
->addType('video/webm');


return $config;
2 changes: 1 addition & 1 deletion dev/docker/php7/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: "3.1"
services:
webserver:
build: apache
container_name: saito5-webserver-71
container_name: saito5-webserver-72
volumes:
- ./../../../:/var/www/html
ports:
Expand Down
Loading

0 comments on commit e849bf1

Please sign in to comment.