Sha256: e6bca4982b9478e9ba7d0966dae4e98cc139e52c040e86dabc07f8d7ea2d9013
Contents?: true
Size: 970 Bytes
Versions: 2
Compression:
Stored size: 970 Bytes
Contents
module Saucy module AccountAuthorization extend ActiveSupport::Concern included do helper_method :current_account, :current_project, :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 current_project? params[:project_id].present? end def current_account? params[:account_id].present? 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
saucy-0.2.2 | lib/saucy/account_authorization.rb |
saucy-0.2.1 | lib/saucy/account_authorization.rb |