Module: ModelAuthorization::InstanceMethods

Defined in:
lib/base_auth.rb

Instance Method Summary collapse

Instance Method Details

#authorize(user) ⇒ Object

re-implement this in your model if you check authorization in a different way



164
165
166
# File 'lib/base_auth.rb', line 164

def authorize(user)
  user.id == self.user_id
end

#authorize!(for_user) ⇒ Object



158
159
160
161
# File 'lib/base_auth.rb', line 158

def authorize!(for_user)
  invoke_permission_denied_action( {} ) unless self.authorize(for_user)
  self
end