Sha256: ac7f608dfb8895bec9d4a79cd8a95bf6dbd9cc5b98145e0c01621b6aadbd6c67
Contents?: true
Size: 900 Bytes
Versions: 3
Compression:
Stored size: 900 Bytes
Contents
module Arpa module Additions module Resource def self.included(base) base.helper_method :has_access? end def has_access?(resource, action) return unless has_session_or_current_user? verifier.has_access?(resource, action) end def reset_permissions verifier.reset_permissions end def verifier @verifier ||= Arpa::Services::Verifier.new(session, current_user) end private def has_session_or_current_user? sess = try(:session) c_user = try(:current_user) return true if sess && c_user log = Logger.new(STDOUT) log.warn("The ApplicationController must has a attribute or method 'session'") unless sess log.warn("The ApplicationController must has a attribute or method 'current_user'") unless c_user false end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
arpa-0.0.7 | lib/arpa/additions/resource.rb |
arpa-0.0.6 | lib/arpa/additions/resource.rb |
arpa-0.0.5 | lib/arpa/additions/resource.rb |