Sha256: 24f0add31d71be0aba03df39ae67d801336f4058f157329a5b10d85abfd4d315
Contents?: true
Size: 782 Bytes
Versions: 8
Compression:
Stored size: 782 Bytes
Contents
module Saucy module AccountAuthorization extend ActiveSupport::Concern included do helper_method :current_account, :current_project include InstanceMethods end module InstanceMethods protected def current_account ::Account.find_by_keyword!(params[:account_id]) end def current_project ::Project.find_by_keyword!(params[:project_id]) end def authorize_admin unless current_user.admin_of?(current_account) deny_access("You must be an admin to access that page.") end end def authorize_member unless current_user.member_of?(current_project) deny_access("You do not have permission for this project.") end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems