Module: EffectiveLogging
- Defined in:
- lib/effective_logging.rb,
lib/effective_logging/engine.rb,
lib/effective_logging/version.rb,
lib/effective_logging/user_logger.rb,
lib/effective_logging/email_logger.rb,
lib/effective_logging/log_page_views.rb,
lib/effective_logging/set_current_user.rb,
lib/effective_logging/active_record_logger.rb,
lib/generators/effective_logging/install_generator.rb
Defined Under Namespace
Modules: Generators, LogPageViews, SetCurrentUser
Classes: ActiveRecordLogger, EmailLogger, Engine, UserLogger
Constant Summary
collapse
- VERSION =
'2.1.1'.freeze
Class Method Summary
collapse
Class Method Details
.authorize!(controller, action, resource) ⇒ Object
37
38
39
|
# File 'lib/effective_logging.rb', line 37
def self.authorize!(controller, action, resource)
raise Effective::AccessDenied unless authorized?(controller, action, resource)
end
|
.authorized?(controller, action, resource) ⇒ Boolean
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/effective_logging.rb', line 24
def self.authorized?(controller, action, resource)
@_exceptions ||= [Effective::AccessDenied, (CanCan::AccessDenied if defined?(CanCan)), (Pundit::NotAuthorizedError if defined?(Pundit))].compact
return !!authorization_method unless authorization_method.respond_to?(:call)
controller = controller.controller if controller.respond_to?(:controller)
begin
!!(controller || self).instance_exec((controller || self), action, resource, &authorization_method)
rescue *@_exceptions
false
end
end
|
.current_user ⇒ Object
65
66
67
|
# File 'lib/effective_logging.rb', line 65
def self.current_user
@effective_logging_current_user
end
|
.current_user=(user) ⇒ Object
This is set by the “set_effective_logging_current_user” before_filter.
61
62
63
|
# File 'lib/effective_logging.rb', line 61
def self.current_user=(user)
@effective_logging_current_user = user
end
|
.log_changes_status ⇒ Object
56
57
58
|
# File 'lib/effective_logging.rb', line 56
def self.log_changes_status
'change'.freeze
end
|
.setup {|_self| ... } ⇒ Object
20
21
22
|
# File 'lib/effective_logging.rb', line 20
def self.setup
yield self
end
|
.statuses ⇒ Object
49
50
51
52
53
54
|
# File 'lib/effective_logging.rb', line 49
def self.statuses
@statuses ||= (
Array(@@additional_statuses).map { |status| status.to_s.downcase } | ['info', 'success', 'error', 'view', log_changes_status, ('email' if email_enabled), ('sign_in' if sign_in_enabled), ('sign_out' if sign_out_enabled)].compact
)
end
|
.supressed(&block) ⇒ Object
41
42
43
|
# File 'lib/effective_logging.rb', line 41
def self.supressed(&block)
@@supressed = true; yield; @@supressed = false
end
|
.supressed? ⇒ Boolean
45
46
47
|
# File 'lib/effective_logging.rb', line 45
def self.supressed?
@@supressed == true
end
|