action_authorization 0.2.3 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/MIT-LICENSE +20 -0
- data/README.md +8 -25
- data/Rakefile +2 -9
- data/lib/action_authorization/version.rb +1 -1
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 54416a7e815288367cea967a9198f197cc2fe10e76e35fcac702406c8b5f8215
|
4
|
+
data.tar.gz: 6097c18236273bf1ebce5439813ae6383805a2a66f264321fac402d64792aa2d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3274dbb63f416cd663a7f47f817d7551fe3abdabaa222d0c067c2fad8e7503a074347a469a43c311c018b949d5bff0bbc36253381d38dc045ac92288295a7d1
|
7
|
+
data.tar.gz: f6fb7dbb58d0933b4c96623093fda6c8b902b5af769b2c2298ac35e053e39da9a659ea8bc86c8d1b4bb3b3d5ad188a7e4894c3f7a8603cb4f38fb7d56f5bdc61
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2017-2023 Aaron Baldwin
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,9 +1,7 @@
|
|
1
1
|
# ActionAuthorization
|
2
|
-
|
3
2
|
A base policy class for authorizing controller actions with access to the current_user and object.
|
4
3
|
|
5
4
|
## Installation
|
6
|
-
|
7
5
|
Add this line to your application's Gemfile:
|
8
6
|
|
9
7
|
```ruby
|
@@ -11,19 +9,19 @@ gem 'action_authorization'
|
|
11
9
|
```
|
12
10
|
|
13
11
|
And then execute:
|
12
|
+
```bash
|
13
|
+
bundle
|
14
|
+
```
|
14
15
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
$ gem install action_authorization
|
16
|
+
Or install it with:
|
17
|
+
```bash
|
18
|
+
gem install action_authorization
|
19
|
+
```
|
20
20
|
|
21
21
|
## Requirements
|
22
|
-
|
23
22
|
ActionAuthorization requires a **current_user** method that returns the currently logged in user.
|
24
23
|
|
25
24
|
## Usage
|
26
|
-
|
27
25
|
Include the ActionAuthorization module in your ApplicationController (or indvidual controller(s))
|
28
26
|
|
29
27
|
```ruby
|
@@ -33,7 +31,6 @@ end
|
|
33
31
|
```
|
34
32
|
|
35
33
|
Create an authorization policy for a resource.
|
36
|
-
|
37
34
|
``` ruby
|
38
35
|
class DocumentPolicy < ActionAuthorization::BasePolicy
|
39
36
|
def show?
|
@@ -43,7 +40,6 @@ end
|
|
43
40
|
```
|
44
41
|
|
45
42
|
Call **authorize** method in controller action.
|
46
|
-
|
47
43
|
```ruby
|
48
44
|
class DocumentController < ApplicationController
|
49
45
|
def show
|
@@ -67,18 +63,5 @@ Check if authorized before displaying a link in the view.
|
|
67
63
|
<%= link_to(@document.name, @document) if policy(@document).show? %>
|
68
64
|
```
|
69
65
|
|
70
|
-
|
71
|
-
## Development
|
72
|
-
|
73
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
74
|
-
|
75
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
76
|
-
|
77
|
-
## Contributing
|
78
|
-
|
79
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/wwidea/action_authorization.
|
80
|
-
|
81
|
-
|
82
66
|
## License
|
83
|
-
|
84
|
-
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
67
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
CHANGED
@@ -1,10 +1,3 @@
|
|
1
|
-
require "bundler/
|
2
|
-
require "rake/testtask"
|
3
|
-
|
4
|
-
Rake::TestTask.new(:test) do |t|
|
5
|
-
t.libs << "test"
|
6
|
-
t.libs << "lib"
|
7
|
-
t.test_files = FileList['test/**/*_test.rb']
|
8
|
-
end
|
1
|
+
require "bundler/setup"
|
9
2
|
|
10
|
-
|
3
|
+
require "bundler/gem_tasks"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: action_authorization
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Baldwin
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-01-
|
12
|
+
date: 2023-01-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -33,6 +33,7 @@ executables: []
|
|
33
33
|
extensions: []
|
34
34
|
extra_rdoc_files: []
|
35
35
|
files:
|
36
|
+
- MIT-LICENSE
|
36
37
|
- README.md
|
37
38
|
- Rakefile
|
38
39
|
- lib/action_authorization.rb
|
@@ -45,6 +46,7 @@ licenses:
|
|
45
46
|
metadata:
|
46
47
|
homepage_uri: https://github.com/wwidea/action_authorization
|
47
48
|
source_code_uri: https://github.com/wwidea/action_authorization
|
49
|
+
rubygems_mfa_required: 'true'
|
48
50
|
post_install_message:
|
49
51
|
rdoc_options: []
|
50
52
|
require_paths:
|
@@ -53,14 +55,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
53
55
|
requirements:
|
54
56
|
- - ">="
|
55
57
|
- !ruby/object:Gem::Version
|
56
|
-
version:
|
58
|
+
version: 2.7.0
|
57
59
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
58
60
|
requirements:
|
59
61
|
- - ">="
|
60
62
|
- !ruby/object:Gem::Version
|
61
63
|
version: '0'
|
62
64
|
requirements: []
|
63
|
-
rubygems_version: 3.
|
65
|
+
rubygems_version: 3.4.5
|
64
66
|
signing_key:
|
65
67
|
specification_version: 4
|
66
68
|
summary: Rails controller object-level action authorization.
|