All notable changes to this project will be documented in this file.
This project adheres to Semantic Versioning.
- Add tests for Ruby 4.0 and Rails 8.1
- Introduce
required_ruby_versionin gemspec so people on legacy Ruby versions don't receive future upgrades - Drop tests and support for Ruby < 3 and Rails < 7.2
- Increase gemspec version constraints to Rails >= 6.0
- Drop tests (and support) for Ruby 2.5
- Test against Rails 8.0
- Drop tests for Rails 5.2
- Test against Ruby 3.4 instead of Ruby 3.3
- 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_powernow 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
...
endIn 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_powernow also sees powers inherited by a parent controller.
- The
#arityof power methods with optional arguments is now preserved.
- Methods defined with
powernow 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.