Use CanCanCan for messages controller

This commit is contained in:
Andy Allan 2019-01-09 15:27:29 +01:00
parent fac3f0ef24
commit 425f42dd80
2 changed files with 4 additions and 1 deletions

View file

@ -17,6 +17,7 @@ class Ability
if user
can :welcome, :site
can [:create, :edit, :comment, :subscribe, :unsubscribe], DiaryEntry
can [:new, :create, :reply, :show, :inbox, :outbox, :mark, :destroy], Message
can [:close, :reopen], Note
can [:new, :create], Report
can [:account, :go_public, :make_friend, :remove_friend, :api_details, :api_gpx_files], User

View file

@ -3,7 +3,9 @@ class MessagesController < ApplicationController
before_action :authorize_web
before_action :set_locale
before_action :require_user
authorize_resource
before_action :lookup_user, :only => [:new, :create]
before_action :check_database_readable
before_action :check_database_writable, :only => [:new, :create, :reply, :mark, :destroy]