All notable changes to this project will be documented in this file.
This project adheres to Semantic Versioning.
- Hook into railties correctly
- clean release to fix file permissions of files that were broken in 1.3.0
- When you map a power to a controller method you can now override the generated method. The original implementation can be accessed with
super
. - When trying to map multiple controller method with the name, an error is now raised. Previously only the last mapping was used.
- Add support for Ruby 3.2
.with_power
now also forwards keyword arguments to the Power initializer correctly
- Activate rubygems MFA
- support rails 7
- remove no longer supported ruby versions (2.3.8, 2.4.5)
- Consul no longer depends on the whole rails framework
- add Ruby 3 compatibility
This releases fix a security issue where in a controller with multiple power
directives, the :only
and :except
options of the last directive was applied to all directives.
Affected code looks like this:
class UsersController < ApplicationController
power :foo
power :bar, only: :index
...
end
In this example both the powers :foo
and :bar
were only checked for the #index
action. Other actions were left unprotected by powers checks.
Controllers with a single power
directive are unaffected.
Contollers where neither power
uses :only
or :except
options are unaffected.
This vulnerability has been assigned the CVE identifier CVE-2019-16377.
- The RSpec matcher
check_power
now also sees powers inherited by a parent controller.
- The
#arity
of power methods with optional arguments is now preserved.
- Methods defined with
power
now preserve the arity of their block.
- Removed
Power.for_record(record)
. UsePower.for_model(record.class)
instead. - Removed
Power#for_record(record)
. UsePower#for_model(record.class)
instead. - Removed
Power#name_for_record(record)
. UsePower#name_for_model(record.class)
instead.
- inherit power guards upon controller inheritance (fixes #40)
- drop support for Rails 2.3
- migrate tests to Gemika
- Bang methods should return the scope when successful (e.g.
power.notes!
returns the scope you defined in the power) - improve the error message for scoped powers
- Fix controller integration when using
ActionController::API
.
Thanks to derekprior.
- All powers memoize.
Please check commits.