mirror of
https://github.com/flarum/core.git
synced 2025-10-10 06:24:26 +02:00
Update core permissions stuff
This commit is contained in:
@@ -182,16 +182,6 @@ class CoreServiceProvider extends ServiceProvider
|
||||
|
||||
public function registerPermissions()
|
||||
{
|
||||
$this->extend(
|
||||
new Permission('forum.view'),
|
||||
new Permission('forum.startDiscussion'),
|
||||
new Permission('discussion.reply'),
|
||||
new Permission('discussion.editPosts'),
|
||||
new Permission('discussion.deletePosts'),
|
||||
new Permission('discussion.rename'),
|
||||
new Permission('discussion.delete')
|
||||
);
|
||||
|
||||
Forum::allow('*', function ($forum, $user, $action) {
|
||||
if ($user->hasPermission('forum.'.$action)) {
|
||||
return true;
|
||||
@@ -199,7 +189,7 @@ class CoreServiceProvider extends ServiceProvider
|
||||
});
|
||||
|
||||
Post::allow('*', function ($post, $user, $action) {
|
||||
if ($user->hasPermission('post.'.$action)) {
|
||||
if ($post->discussion->can($user, $action.'Posts')) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
@@ -2,15 +2,4 @@
|
||||
|
||||
class Permission extends Model
|
||||
{
|
||||
protected static $permissions = [];
|
||||
|
||||
public static function getPermissions()
|
||||
{
|
||||
return static::$permissions;
|
||||
}
|
||||
|
||||
public static function addPermission($permission)
|
||||
{
|
||||
static::$permissions[] = $permission;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user