README.md in unidom-authorization-1.1 vs README.md in unidom-authorization-1.2
- old
+ new
@@ -32,16 +32,20 @@
Unidom::Authorization::Authorizing.authorize! permission: permission, authorized: user
# or
permission.authorize! user, by: current_user, at: Time.now
permission.authorized? user, at: Time.now # true
+user.is_authorized! permission: permission, by: administrator, at: Time.now
+user.is_authorized? permission: permission, at: Time.now # true
```
## Include the Conerns
```ruby
include Unidom::Authorization::Concerns::AsAuthorized
```
### As Authorized concern
-The As Authorized concern do the following tasks for the includer automatically:
-1. Define the has_many :authorizings macro as: ``has_many :authorizings, class_name: 'Unidom::Authorization::Authorizing', as: :authorized``
-2. Define the has_many :permissions macro as: ``has_many :permissions, through: :authorizings, source: :permission``
+The As Authorized concern do the following tasks for the includer automatically:
+1. Define the has_many :authorizings macro as: ``has_many :authorizings, class_name: 'Unidom::Authorization::Authorizing', as: :authorized``
+2. Define the has_many :permissions macro as: ``has_many :permissions, through: :authorizings, source: :permission``
+3. Define the #is_authorized! method as: ``def is_authorized!(permission: nil, by: nil, at: Time.now)``
+4. Define the #is_authorized? method ``def is_authorized?(permission: nil, at: Time.now)``