CanCanCanSee 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/CanCanCanSee/version.rb +1 -1
- metadata +1 -13
- data/.gitignore +0 -9
- data/.rspec +0 -2
- data/.travis.yml +0 -4
- data/CODE_OF_CONDUCT.md +0 -49
- data/CanCanCanSee.gemspec +0 -35
- data/Gemfile +0 -4
- data/LICENSE.txt +0 -26
- data/README.md +0 -69
- data/Rakefile +0 -6
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/lib/tasks/custom_actions.rake +0 -42
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ce43f661e96187f9f4b05e8c16ec15722bffc73
|
4
|
+
data.tar.gz: e1348a69567cef9cd0300594a38b5fffb158015b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 315fb145ac52e23f3a6578c33358d14d87b625f402a89b756721efb1b4d3d86d983efa795c2209b0e68649576255da63ff8ebd3f4f6c0f5bff68289a91cfa393
|
7
|
+
data.tar.gz: 734f6189a81aeb2edaa7fda033c5d0365e3c38fb6084f9d99042d97007684dd154f37a47b1bf1e37123903d95a3e2e97979e93175e6feb0b5e87fbdf4469c4bf
|
data/lib/CanCanCanSee/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: CanCanCanSee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Schwaderer
|
@@ -74,21 +74,9 @@ executables: []
|
|
74
74
|
extensions: []
|
75
75
|
extra_rdoc_files: []
|
76
76
|
files:
|
77
|
-
- ".gitignore"
|
78
|
-
- ".rspec"
|
79
|
-
- ".travis.yml"
|
80
|
-
- CODE_OF_CONDUCT.md
|
81
|
-
- CanCanCanSee.gemspec
|
82
|
-
- Gemfile
|
83
|
-
- LICENSE.txt
|
84
|
-
- README.md
|
85
|
-
- Rakefile
|
86
|
-
- bin/console
|
87
|
-
- bin/setup
|
88
77
|
- lib/CanCanCanSee.rb
|
89
78
|
- lib/CanCanCanSee/railtie.rb
|
90
79
|
- lib/CanCanCanSee/version.rb
|
91
|
-
- lib/tasks/custom_actions.rake
|
92
80
|
homepage: https://github.com/schwad/cancancansee
|
93
81
|
licenses:
|
94
82
|
- SCHWAD LICENSE
|
data/.gitignore
DELETED
data/.rspec
DELETED
data/.travis.yml
DELETED
data/CODE_OF_CONDUCT.md
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
# Contributor Code of Conduct
|
2
|
-
|
3
|
-
As contributors and maintainers of this project, and in the interest of
|
4
|
-
fostering an open and welcoming community, we pledge to respect all people who
|
5
|
-
contribute through reporting issues, posting feature requests, updating
|
6
|
-
documentation, submitting pull requests or patches, and other activities.
|
7
|
-
|
8
|
-
We are committed to making participation in this project a harassment-free
|
9
|
-
experience for everyone, regardless of level of experience, gender, gender
|
10
|
-
identity and expression, sexual orientation, disability, personal appearance,
|
11
|
-
body size, race, ethnicity, age, religion, or nationality.
|
12
|
-
|
13
|
-
Examples of unacceptable behavior by participants include:
|
14
|
-
|
15
|
-
* The use of sexualized language or imagery
|
16
|
-
* Personal attacks
|
17
|
-
* Trolling or insulting/derogatory comments
|
18
|
-
* Public or private harassment
|
19
|
-
* Publishing other's private information, such as physical or electronic
|
20
|
-
addresses, without explicit permission
|
21
|
-
* Other unethical or unprofessional conduct
|
22
|
-
|
23
|
-
Project maintainers have the right and responsibility to remove, edit, or
|
24
|
-
reject comments, commits, code, wiki edits, issues, and other contributions
|
25
|
-
that are not aligned to this Code of Conduct, or to ban temporarily or
|
26
|
-
permanently any contributor for other behaviors that they deem inappropriate,
|
27
|
-
threatening, offensive, or harmful.
|
28
|
-
|
29
|
-
By adopting this Code of Conduct, project maintainers commit themselves to
|
30
|
-
fairly and consistently applying these principles to every aspect of managing
|
31
|
-
this project. Project maintainers who do not follow or enforce the Code of
|
32
|
-
Conduct may be permanently removed from the project team.
|
33
|
-
|
34
|
-
This code of conduct applies both within project spaces and in public spaces
|
35
|
-
when an individual is representing the project or its community.
|
36
|
-
|
37
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
38
|
-
reported by contacting a project maintainer at nicholas.schwaderer@gmail.com. All
|
39
|
-
complaints will be reviewed and investigated and will result in a response that
|
40
|
-
is deemed necessary and appropriate to the circumstances. Maintainers are
|
41
|
-
obligated to maintain confidentiality with regard to the reporter of an
|
42
|
-
incident.
|
43
|
-
|
44
|
-
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
45
|
-
version 1.3.0, available at
|
46
|
-
[http://contributor-covenant.org/version/1/3/0/][version]
|
47
|
-
|
48
|
-
[homepage]: http://contributor-covenant.org
|
49
|
-
[version]: http://contributor-covenant.org/version/1/3/0/
|
data/CanCanCanSee.gemspec
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'CanCanCanSee/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = "CanCanCanSee"
|
8
|
-
spec.version = CanCanCanSee::VERSION
|
9
|
-
spec.authors = ["Nick Schwaderer"]
|
10
|
-
spec.email = ["nicholas.schwaderer@gmail.com"]
|
11
|
-
|
12
|
-
spec.summary = %q{Allows user to access read-only list of roles and abilities in controller and view}
|
13
|
-
spec.description = %q{Allows user to access read-only list of roles and abilities in controller and vie}
|
14
|
-
spec.homepage = "https://github.com/schwad/cancancansee"
|
15
|
-
spec.license = "SCHWAD LICENSE"
|
16
|
-
|
17
|
-
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
18
|
-
# delete this section to allow pushing this gem to any host.
|
19
|
-
if spec.respond_to?(:metadata)
|
20
|
-
spec.metadata['allowed_push_host'] = "https://rubygems.org"
|
21
|
-
else
|
22
|
-
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
23
|
-
end
|
24
|
-
|
25
|
-
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
26
|
-
spec.bindir = "exe"
|
27
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
|
-
spec.require_paths = ["lib"]
|
29
|
-
|
30
|
-
spec.add_development_dependency "bundler", "~> 1.11"
|
31
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
32
|
-
spec.add_development_dependency "rspec", "~> 3.0"
|
33
|
-
spec.add_development_dependency "pry", "~> 0.10.3"
|
34
|
-
|
35
|
-
end
|
data/Gemfile
DELETED
data/LICENSE.txt
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
The SCHWAD License (SCHWAD)
|
2
|
-
|
3
|
-
Copyright (c) 2016 Nick Schwaderer
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
1. The above copyright notice and this permission notice shall be included in
|
13
|
-
all copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
2. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
THE SOFTWARE.
|
22
|
-
|
23
|
-
3. This software shall not be used in any way to violate Isaac Asimov's "Three Laws of Robotics"
|
24
|
-
|
25
|
-
4. This software shall not be used by any organizations, corporations or entities that have violated
|
26
|
-
Isaac Asimov's "Three Laws of Robotics" with other products or actions.
|
data/README.md
DELETED
@@ -1,69 +0,0 @@
|
|
1
|
-
# CanCanCanSee
|
2
|
-
|
3
|
-
Read-only access to roles and abilities with CanCancan. Note: Since this relies on regex-magic at the moment, it requires a particular formatting that will be further articulated upon in future docs.
|
4
|
-
|
5
|
-
## Installation
|
6
|
-
|
7
|
-
Add this line to your application's Gemfile:
|
8
|
-
|
9
|
-
```ruby
|
10
|
-
gem 'CanCanCanSee'
|
11
|
-
```
|
12
|
-
|
13
|
-
And then execute:
|
14
|
-
|
15
|
-
$ bundle
|
16
|
-
|
17
|
-
Or install it yourself as:
|
18
|
-
|
19
|
-
$ gem install CanCanCanSee
|
20
|
-
|
21
|
-
## Usage
|
22
|
-
|
23
|
-
Your `Ability.rb` file should use a `case/when` statement for different roles and abilities for this to work.
|
24
|
-
|
25
|
-
Create a `config/initializers/cancancansee.rb` file, and if you have a normal Ability.rb file include:
|
26
|
-
|
27
|
-
`abilities_type = "single"`
|
28
|
-
|
29
|
-
And if you have a custom multiple Ability.rb setup include:
|
30
|
-
|
31
|
-
`abilities_type = "multiple"`
|
32
|
-
|
33
|
-
Then, anywhere in your code or CLI, you have access to this command:
|
34
|
-
|
35
|
-
```ruby
|
36
|
-
CanCanCanSee.all_abilities
|
37
|
-
|
38
|
-
#=> {"RoleOne"=>{"can"=>["manage Object"], "cannot"=>["delete Note", "edit Thing"},
|
39
|
-
#=> "RoleTwo"=>{"can"=>["edit User"], "cannot"=>["manage Telephone"]}}
|
40
|
-
|
41
|
-
#and if you only want to see abilities for a particular slug under multiple....
|
42
|
-
CanCanCanSee.all_abilities[my_slug]
|
43
|
-
|
44
|
-
#=> {"my_slug"=>{"RoleOne"=>{"can"=>["manage Object"], "cannot"=>["delete Note", "edit Thing"},
|
45
|
-
#=> "RoleTwo"=>{"can"=>["edit User"], "cannot"=>["manage Telephone"]}},
|
46
|
-
#=> "my_other_slug"=>{"RoleOne"=>{"can"=>["manage Object"], "cannot"=>["delete Note", "edit Thing"},
|
47
|
-
#=> "RoleTwo"=>{"can"=>["edit User"], "cannot"=>["manage Telephone"]}}
|
48
|
-
```
|
49
|
-
|
50
|
-
## Development
|
51
|
-
|
52
|
-
## TODO Before 1.0
|
53
|
-
|
54
|
-
* Cleanup needed for single
|
55
|
-
* Pretty Print CLI or something like rake abilities for cli!
|
56
|
-
* Confirm support for single and multiple Ability.rb files
|
57
|
-
* Capture blocks passed to abilities as well and store and render them instead of just signifying 'with block'
|
58
|
-
* Create docs to show style guidelines to have gem work
|
59
|
-
* Create post to show layout for slug-based auth
|
60
|
-
* Rake support for `cancancansee:abilities`
|
61
|
-
|
62
|
-
## Contributing
|
63
|
-
|
64
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/schwad/CanCanCanSee. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
65
|
-
|
66
|
-
|
67
|
-
## License
|
68
|
-
|
69
|
-
The gem is available as open source under the terms of the [SCHWAD License](https://github.com/schwad/cancancansee/LICENSE.txt).
|
data/Rakefile
DELETED
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "CanCanCanSee"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start
|
data/bin/setup
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
|
2
|
-
namespace :cancancansee do
|
3
|
-
|
4
|
-
desc 'List current abilities established.'
|
5
|
-
task :abilities do
|
6
|
-
CanCanCanSee.establish_variable
|
7
|
-
@current_slug_abilities = MY_GLOBAL_HOLDER_OF_ABILITY[Figaro.env.slug]
|
8
|
-
|
9
|
-
@current_slug_abilities.each do |key, value|
|
10
|
-
print "\n\n"
|
11
|
-
print "Role: #{key}\n"
|
12
|
-
value.each do |can, can_value|
|
13
|
-
print " #{can}\n"
|
14
|
-
can_value = can_value.sort
|
15
|
-
can_value.each do |can_value_element|
|
16
|
-
print " #{can_value_element}\n"
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
desc 'Lists current abilities for all slugs'
|
23
|
-
task :abilities_all_slugs do
|
24
|
-
@current_slug_abilities = MY_GLOBAL_HOLDER_OF_ABILITY
|
25
|
-
|
26
|
-
@current_slug_abilities.each do |key, value|
|
27
|
-
print "\n\n"
|
28
|
-
print "Slug: #{key}\n\n"
|
29
|
-
value.each do |role_key, role_value|
|
30
|
-
print "\n\n"
|
31
|
-
print " Role: #{role_key}\n\n"
|
32
|
-
role_value.each do |can, can_value|
|
33
|
-
print " #{can}\n"
|
34
|
-
can_value = can_value.sort
|
35
|
-
can_value.each do |can_value_element|
|
36
|
-
print " #{can_value_element}\n"
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|