Skip to content

Commit

Permalink
Add permission to bypass throttling
Browse files Browse the repository at this point in the history
  • Loading branch information
dsevillamartin authored and franzliedke committed Feb 7, 2020
1 parent 2f3d999 commit 711e775
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
8 changes: 7 additions & 1 deletion js/src/admin/components/PermissionGrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,12 @@ export default class PermissionGrid extends Component {
permission: 'discussion.delete'
}, 80);

items.add('postWithoutThrottle', {
icon: 'fas fa-swimmer',
label: app.translator.trans('core.admin.permissions.post_without_throttle_label'),
permission: 'postWithoutThrottle'
}, 70);

items.add('editPosts', {
icon: 'fas fa-pencil-alt',
label: app.translator.trans('core.admin.permissions.edit_posts_label'),
Expand All @@ -233,7 +239,7 @@ export default class PermissionGrid extends Component {
label: app.translator.trans('core.admin.permissions.edit_users_label'),
permission: 'user.edit'
}, 60);

return items;
}

Expand Down
4 changes: 4 additions & 0 deletions src/Post/Floodgate.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ public function __construct(Dispatcher $events)
*/
public function assertNotFlooding(User $actor)
{
if ($actor->can('postWithoutThrottle')) {
return;
}

if ($this->isFlooding($actor)) {
throw new FloodingException;
}
Expand Down

0 comments on commit 711e775

Please sign in to comment.