rolify 3.3.0.rc3 → 3.3.0.rc4
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/.travis.yml +18 -11
- data/CHANGELOG.rdoc +18 -0
- data/Gemfile +16 -3
- data/README.md +17 -17
- data/Rakefile +17 -7
- data/UPGRADE.rdoc +22 -0
- data/gemfiles/Gemfile.rails-3.2 +17 -0
- data/gemfiles/Gemfile.rails-4.0 +26 -0
- data/lib/rolify.rb +1 -1
- data/lib/rolify/adapters/active_record/resource_adapter.rb +7 -7
- data/lib/rolify/adapters/active_record/role_adapter.rb +8 -8
- data/lib/rolify/configure.rb +1 -1
- data/lib/rolify/version.rb +1 -1
- data/rolify.gemspec +5 -12
- data/spec/README.rdoc +24 -0
- data/spec/rolify/custom_spec.rb +9 -16
- data/spec/rolify/namespace_spec.rb +9 -16
- data/spec/rolify/resource_spec.rb +13 -2
- data/spec/rolify/resourcifed_and_rolifed_spec.rb +5 -1
- data/spec/rolify/role_spec.rb +9 -16
- data/spec/rolify/shared_contexts.rb +9 -3
- data/spec/rolify/shared_examples/shared_examples_for_add_role.rb +2 -2
- data/spec/rolify/shared_examples/shared_examples_for_dynamic.rb +1 -1
- data/spec/rolify/shared_examples/shared_examples_for_has_any_role.rb +3 -3
- data/spec/rolify/shared_examples/shared_examples_for_only_has_role.rb +3 -3
- data/spec/rolify/shared_examples/shared_examples_for_roles.rb +1 -1
- data/spec/rolify/shared_examples/shared_examples_for_scopes.rb +10 -10
- data/spec/support/adapters/active_record.rb +7 -0
- data/spec/support/adapters/mongoid.rb +8 -4
- data/spec/support/data.rb +3 -0
- data/spec/support/schema.rb +5 -0
- metadata +22 -66
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -1,16 +1,23 @@
|
|
1
1
|
rvm:
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
- 1.9.3
|
3
|
+
- 2.0.0
|
4
|
+
- rbx-19mode
|
5
|
+
- jruby-19mode
|
6
|
+
|
7
|
+
gemfile:
|
8
|
+
- gemfiles/Gemfile.rails-3.2
|
9
|
+
- gemfiles/Gemfile.rails-4.0
|
6
10
|
|
7
11
|
env:
|
8
|
-
|
9
|
-
|
12
|
+
- ADAPTER=active_record
|
13
|
+
- ADAPTER=mongoid
|
10
14
|
|
11
|
-
before_install:
|
12
|
-
- gem update --system
|
13
|
-
- gem --version
|
14
|
-
- ruby -v
|
15
|
-
|
16
15
|
services: mongodb
|
16
|
+
|
17
|
+
before_script: rails --version
|
18
|
+
|
19
|
+
matrix:
|
20
|
+
allow_failures:
|
21
|
+
- rvm: rbx-19mode
|
22
|
+
- rvm: jruby-19mode
|
23
|
+
- gemfile: gemfiles/Gemfile.rails-4.0
|
data/CHANGELOG.rdoc
CHANGED
@@ -1,3 +1,21 @@
|
|
1
|
+
= 3.3 (not released yet)
|
2
|
+
* <b>DEPRECATION NOTICE:</b>Rails 3.1 support dropped: if you use Rails 3.1, please stick to rolify 3.2
|
3
|
+
* code cleanup in finders methods
|
4
|
+
* generators rewritten entirely. now using ActiveRecord/Mongoid model generator to create Role model
|
5
|
+
* added rspec matchers for detailed spec error messages (thanks to @delwyn)
|
6
|
+
* clean up specs (thanks to @delwyn), removed subject and let declarations in before(:all) block
|
7
|
+
* roles query needs 1 DB hit instead of 1 up to 3 (thanks to @terraplane)
|
8
|
+
* remove nil entries from ResourceAdapter#resources_find when using Mongoid adapter (thanks to @daviscabral)
|
9
|
+
* fixed a bug regarding redundant index for Mongoid Role model (thanks to @rschultheis)
|
10
|
+
* added support for rolify and resourcify methods on the same model class (specs by @amer)
|
11
|
+
* added support for namespaced models (thanks to @intrica)
|
12
|
+
* fixed compatibility issue with squeel when using symbols as role parameters (hint by @f3ndot)
|
13
|
+
* now raises a warning in the initializer if migration has not been run
|
14
|
+
* add support for primary key different than 'id' for resource Model (thanks to @rafaeldl)
|
15
|
+
* Rails 4 (thanks to @adammathys) and ruby 2.0 compliant
|
16
|
+
* configured travis-ci to run the specs on Rails 3.2/4.0 and Rubies 1.9.3/2.0/rbx/jruby
|
17
|
+
* added code climate to check for code smell
|
18
|
+
|
1
19
|
= 3.2 (Aug 7, 2012)
|
2
20
|
* <b>DEPRECATION NOTICE:</b> Ruby 1.8 support dropped ! Mongoid 3.0 only supports MRI 1.9.3, and HEAD, and JRuby 1.6.0+ in 1.9 mode
|
3
21
|
* removed <tt>dynamic_shortcuts</tt> arguments from the generator
|
data/Gemfile
CHANGED
@@ -1,4 +1,17 @@
|
|
1
|
-
source "
|
1
|
+
source "https://rubygems.org"
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
case ENV["ADAPTER"]
|
4
|
+
when nil, "active_record"
|
5
|
+
group :test do
|
6
|
+
gem "activerecord-jdbcsqlite3-adapter", :platform => "jruby"
|
7
|
+
gem "sqlite3", :platform => "ruby"
|
8
|
+
end
|
9
|
+
gem "activerecord", ">= 3.2.0", :require => "active_record"
|
10
|
+
when "mongoid"
|
11
|
+
gem "mongoid", ">= 3.1"
|
12
|
+
gem "bson_ext", :platform => "ruby"
|
13
|
+
else
|
14
|
+
raise "Unknown model adapter: #{ENV["ADAPTER"]}"
|
15
|
+
end
|
16
|
+
|
17
|
+
gemspec
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# rolify [![Gem Version](https://badge.fury.io/rb/rolify.png)](http://badge.fury.io/rb/rolify) [![build status](https://secure.travis-ci.org/EppO/rolify.png
|
1
|
+
# rolify [![Gem Version](https://badge.fury.io/rb/rolify.png)](http://badge.fury.io/rb/rolify) [![build status](https://secure.travis-ci.org/EppO/rolify.png)](http://travis-ci.org/EppO/rolify) [![dependency status](https://gemnasium.com/EppO/rolify.png)](https://gemnasium.com/EppO/rolify) [![Code Climate](https://codeclimate.com/github/EppO/rolify.png)](https://codeclimate.com/github/EppO/rolify)
|
2
2
|
|
3
3
|
Very simple Roles library without any authorization enforcement supporting scope on resource object.
|
4
4
|
|
@@ -15,10 +15,10 @@ This library can be easily integrated with any authentication gem ([devise](http
|
|
15
15
|
|
16
16
|
## Requirements
|
17
17
|
|
18
|
-
* Rails >= 3.
|
19
|
-
* ActiveRecord >= 3.
|
20
|
-
* supports ruby 1.9, JRuby 1.6.0+ (in 1.9 mode) and Rubinius 2.0.0dev (in 1.9 mode)
|
21
|
-
* support of ruby 1.8 has been dropped due to Mongoid 3.0 that only supports 1.9 new hash syntax
|
18
|
+
* Rails >= 3.2
|
19
|
+
* ActiveRecord >= 3.2 <b>or</b> Mongoid >= 3.1
|
20
|
+
* supports ruby 2.0/1.9.3, JRuby 1.6.0+ (in 1.9 mode) and Rubinius 2.0.0dev (in 1.9 mode)
|
21
|
+
* support of ruby 1.8 has been dropped due to Mongoid >=3.0 that only supports 1.9 new hash syntax
|
22
22
|
|
23
23
|
## Installation
|
24
24
|
|
@@ -28,12 +28,6 @@ In <b>Rails 3</b>, add this to your Gemfile and run the +bundle+ command.
|
|
28
28
|
gem "rolify"
|
29
29
|
```
|
30
30
|
|
31
|
-
Alternatively, you can install it as a plugin.
|
32
|
-
|
33
|
-
```
|
34
|
-
rails plugin install git://github.com/EppO/rolify.git
|
35
|
-
```
|
36
|
-
|
37
31
|
## Getting Started
|
38
32
|
|
39
33
|
### 1. Generate Role Model
|
@@ -41,13 +35,13 @@ Alternatively, you can install it as a plugin.
|
|
41
35
|
First, create your Role model and migration file using this generator:
|
42
36
|
|
43
37
|
```
|
44
|
-
rails g rolify
|
38
|
+
rails g rolify Role User
|
45
39
|
```
|
46
40
|
|
47
41
|
Role and User classes are the default. You can specify any Role class name you want. This is completly a new file so any name can do the job.
|
48
42
|
For the User class name, you would probably use the one provided by your authentication solution. rolify just adds some class methods in an existing User class.
|
49
43
|
|
50
|
-
If you want to use Mongoid instead of ActiveRecord,
|
44
|
+
If you want to use Mongoid instead of ActiveRecord, just add `--orm=mongoid` argument, and skip to step #3
|
51
45
|
|
52
46
|
### 2. Run the migration (only required when using ActiveRecord)
|
53
47
|
|
@@ -59,26 +53,26 @@ Let's migrate !
|
|
59
53
|
|
60
54
|
### 3.1 Configure your user model
|
61
55
|
|
62
|
-
This gem adds the `rolify` method to your User class. You can also specify optional callbacks
|
56
|
+
This gem adds the `rolify` method to your User class. You can also specify optional callbacks on the User class for when roles are added or removed:
|
63
57
|
|
64
58
|
```ruby
|
65
59
|
class User < ActiveRecord::Base
|
66
60
|
rolify :before_add => :before_add_method
|
67
61
|
|
68
|
-
def
|
62
|
+
def before_add_method(role)
|
69
63
|
# do something before it gets added
|
70
64
|
end
|
71
65
|
end
|
72
66
|
```
|
73
67
|
|
74
|
-
The `rolify` method accepts the following callback
|
68
|
+
The `rolify` method accepts the following callback options:
|
75
69
|
|
76
70
|
- `before_add`
|
77
71
|
- `after_add`
|
78
72
|
- `before_remove`
|
79
73
|
- `after_remove`
|
80
74
|
|
81
|
-
|
75
|
+
Mongoid callbacks are also supported and works the same way.
|
82
76
|
|
83
77
|
### 3.2 Configure your resource models
|
84
78
|
|
@@ -201,6 +195,12 @@ Starting from rolify 3.0, you can search roles on instance level or class level
|
|
201
195
|
* [Using rolify with Devise and Authority](https://github.com/EppO/rolify/wiki/Using-rolify-with-Devise-and-Authority)
|
202
196
|
* [Step-by-step tutorial](http://railsapps.github.com/tutorial-rails-bootstrap-devise-cancan.html) provided by [RailsApps](http://railsapps.github.com/)
|
203
197
|
|
198
|
+
## Upgrade from previous versions
|
199
|
+
|
200
|
+
Please read the [upgrade instructions](UPGRADE.rdoc).
|
201
|
+
|
204
202
|
## Questions or Problems?
|
205
203
|
|
206
204
|
If you have any issue or feature request with/for rolify, please add an [issue on GitHub](https://github.com/EppO/rolify/issues) or fork the project and send a pull request.
|
205
|
+
|
206
|
+
To get the specs running you should call `bundle` and then `rake`. See the spec/README for more information.
|
data/Rakefile
CHANGED
@@ -1,6 +1,16 @@
|
|
1
1
|
require 'bundler'
|
2
|
+
require 'rspec/core/rake_task'
|
3
|
+
|
2
4
|
Bundler::GemHelper.install_tasks
|
3
5
|
|
6
|
+
RSpec::Core::RakeTask.new(:generators) do |task|
|
7
|
+
task.pattern = "spec/generators/**/*_spec.rb"
|
8
|
+
end
|
9
|
+
|
10
|
+
RSpec::Core::RakeTask.new(:rolify) do |task|
|
11
|
+
task.pattern = "spec/rolify/**/*_spec.rb"
|
12
|
+
end
|
13
|
+
|
4
14
|
task :default => :spec
|
5
15
|
|
6
16
|
desc "Run all specs"
|
@@ -12,10 +22,10 @@ task "spec" do
|
|
12
22
|
fail if return_code1 != 0 || return_code2 != 0
|
13
23
|
end
|
14
24
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
end
|
25
|
+
desc "Run specs for all adapters"
|
26
|
+
task :spec_all do
|
27
|
+
%w[active_record mongoid].each do |model_adapter|
|
28
|
+
puts "ADAPTER = #{model_adapter}"
|
29
|
+
system "ADAPTER=#{model_adapter} rake"
|
30
|
+
end
|
31
|
+
end
|
data/UPGRADE.rdoc
CHANGED
@@ -20,3 +20,25 @@ If you use <i>dynamic methods</i> (<tt>user.is_admin?</tt> like methods), you sh
|
|
20
20
|
c.use_dynamic_shortcuts
|
21
21
|
end
|
22
22
|
The old fashion way still works though, but won't work anymore if the setter method name is changed in a possible future. You've been warned :-)
|
23
|
+
|
24
|
+
== From a rolify installation 3.x
|
25
|
+
|
26
|
+
=== Dependencies:
|
27
|
+
|
28
|
+
Starting from 3.3 release, rolify supports Rails 3.2 and newer.
|
29
|
+
|
30
|
+
Mongoid callbacks are supported if Mongoid 3.1 and newer is installed.
|
31
|
+
|
32
|
+
=== Rails Generators
|
33
|
+
|
34
|
+
Role model template when using Mongoid has been changed, you should re-run the generator.
|
35
|
+
|
36
|
+
Rails generator has been renamed to: <tt>rails g rolify</tt> and arguments have been changed:
|
37
|
+
* Role class name is now mandatory, User class name remains optional and its default is still <tt>User</tt>
|
38
|
+
* ORM optional argument is now <tt>-o</tt> or <tt>--orm=</tt>
|
39
|
+
For instance, here is a new rolify generator command example: <tt>rails g rolify Role</tt>
|
40
|
+
You can use <tt>rails g rolify --help</tt> to see all available options.
|
41
|
+
|
42
|
+
=== Testing
|
43
|
+
|
44
|
+
Starting from rolify 3.3, to run the specs you should run: <tt>rake spec</tt> or simply <tt>rake</tt>.
|
@@ -0,0 +1,17 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
case ENV["ADAPTER"]
|
4
|
+
when nil, "active_record"
|
5
|
+
group :test do
|
6
|
+
gem "activerecord-jdbcsqlite3-adapter", :platform => "jruby"
|
7
|
+
gem "sqlite3", :platform => "ruby"
|
8
|
+
end
|
9
|
+
gem "activerecord", "~> 3.2.0", :require => "active_record"
|
10
|
+
when "mongoid"
|
11
|
+
gem "mongoid", "~> 3.1"
|
12
|
+
gem "bson_ext", :platform => "ruby"
|
13
|
+
else
|
14
|
+
raise "Unknown model adapter: #{ENV["ADAPTER"]}"
|
15
|
+
end
|
16
|
+
|
17
|
+
gemspec :path => '../'
|
@@ -0,0 +1,26 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
case ENV["ADAPTER"]
|
4
|
+
when nil, "active_record"
|
5
|
+
gem "activerecord", "~> 4.0.0.beta1", :require => "active_record"
|
6
|
+
when "mongoid"
|
7
|
+
gem "mongoid", :git => "git://github.com/mongoid/mongoid.git"
|
8
|
+
gem "bson_ext", :platform => "ruby"
|
9
|
+
else
|
10
|
+
raise "Unknown model adapter: #{ENV["ADAPTER"]}"
|
11
|
+
end
|
12
|
+
|
13
|
+
group :test do
|
14
|
+
gem "rails", "~> 4.0.0.beta1"
|
15
|
+
gem "ammeter"
|
16
|
+
gem "rake"
|
17
|
+
gem "rspec"
|
18
|
+
gem "rspec-rails"
|
19
|
+
gem "fuubar"
|
20
|
+
gem "bundler"
|
21
|
+
|
22
|
+
gem "activerecord-jdbcsqlite3-adapter", :platform => "jruby"
|
23
|
+
gem "sqlite3", :platform => "ruby"
|
24
|
+
gem "activerecord", "~> 4.0.0.beta1", :require => "active_record"
|
25
|
+
gem "mongoid", :git => "git://github.com/mongoid/mongoid.git"
|
26
|
+
end
|
data/lib/rolify.rb
CHANGED
@@ -22,7 +22,7 @@ module Rolify
|
|
22
22
|
join_table = "#{self.to_s.tableize.gsub(/\//, "_")}_#{self.role_table_name}"
|
23
23
|
rolify_options = { :class_name => options[:role_cname].camelize }
|
24
24
|
rolify_options.merge!({ :join_table => join_table }) if Rolify.orm == "active_record"
|
25
|
-
rolify_options.merge!(options.reject{ |k,v| ![:before_add, :after_add, :before_remove, :after_remove].include? k.to_sym })
|
25
|
+
rolify_options.merge!(options.reject{ |k,v| ![ :before_add, :after_add, :before_remove, :after_remove ].include? k.to_sym })
|
26
26
|
|
27
27
|
has_and_belongs_to_many :roles, rolify_options
|
28
28
|
|
@@ -1,25 +1,25 @@
|
|
1
1
|
require 'rolify/adapters/base'
|
2
2
|
|
3
3
|
module Rolify
|
4
|
-
module Adapter
|
4
|
+
module Adapter
|
5
5
|
class ResourceAdapter < ResourceAdapterBase
|
6
6
|
def resources_find(roles_table, relation, role_name)
|
7
|
-
resources = relation.joins("INNER JOIN #{quote(roles_table)} ON #{quote(roles_table)}.resource_type = '#{relation.to_s}' AND
|
8
|
-
(#{quote(roles_table)}.resource_id IS NULL OR #{quote(roles_table)}.resource_id = #{quote(relation.table_name)}.
|
7
|
+
resources = relation.joins("INNER JOIN #{quote(roles_table)} ON #{quote(roles_table)}.resource_type = '#{relation.to_s}' AND
|
8
|
+
(#{quote(roles_table)}.resource_id IS NULL OR #{quote(roles_table)}.resource_id = #{quote(relation.table_name)}.#{relation.primary_key})")
|
9
9
|
resources = resources.where("#{quote(roles_table)}.name IN (?) AND #{quote(roles_table)}.resource_type = ?", Array(role_name), relation.to_s)
|
10
10
|
resources
|
11
11
|
end
|
12
12
|
|
13
13
|
def in(relation, user, role_names)
|
14
14
|
roles = user.roles.where(:name => role_names)
|
15
|
-
relation.where("#{quote(role_class.table_name)}.
|
15
|
+
relation.where("#{quote(role_class.table_name)}.#{role_class.primary_key} IN (?) AND ((resource_id = #{quote(relation.table_name)}.#{relation.primary_key}) OR (resource_id IS NULL))", roles)
|
16
16
|
end
|
17
|
-
|
17
|
+
|
18
18
|
private
|
19
|
-
|
19
|
+
|
20
20
|
def quote(column)
|
21
21
|
ActiveRecord::Base.connection.quote_column_name column
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
25
|
-
end
|
25
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'rolify/adapters/base'
|
2
2
|
|
3
3
|
module Rolify
|
4
|
-
module Adapter
|
4
|
+
module Adapter
|
5
5
|
class RoleAdapter < RoleAdapterBase
|
6
6
|
def where(relation, *args)
|
7
7
|
conditions, values = build_conditions(relation, args)
|
@@ -9,7 +9,7 @@ module Rolify
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def find_or_create_by(role_name, resource_type = nil, resource_id = nil)
|
12
|
-
role_class.
|
12
|
+
role_class.where(:name => role_name, :resource_type => resource_type, :resource_id => resource_id).first_or_create
|
13
13
|
end
|
14
14
|
|
15
15
|
def add(relation, role)
|
@@ -23,8 +23,8 @@ module Rolify
|
|
23
23
|
roles = relation.roles.where(cond)
|
24
24
|
if roles
|
25
25
|
relation.roles.delete(roles)
|
26
|
-
roles.each do |role|
|
27
|
-
role.destroy if role.send(ActiveSupport::Inflector.demodulize(user_class).tableize.to_sym).empty?
|
26
|
+
roles.each do |role|
|
27
|
+
role.destroy if role.send(ActiveSupport::Inflector.demodulize(user_class).tableize.to_sym).empty?
|
28
28
|
end
|
29
29
|
end
|
30
30
|
roles
|
@@ -33,7 +33,7 @@ module Rolify
|
|
33
33
|
def exists?(relation, column)
|
34
34
|
relation.where("#{column} IS NOT NULL")
|
35
35
|
end
|
36
|
-
|
36
|
+
|
37
37
|
def scope(relation, conditions)
|
38
38
|
query = relation.scoped
|
39
39
|
query = query.joins(:roles)
|
@@ -67,10 +67,10 @@ module Rolify
|
|
67
67
|
values = [ role ]
|
68
68
|
if resource
|
69
69
|
query.insert(0, "(")
|
70
|
-
query += " OR ((#{role_table}.name = ?) AND (#{role_table}.resource_type = ?) AND (#{role_table}.resource_id IS NULL))"
|
70
|
+
query += " OR ((#{role_table}.name = ?) AND (#{role_table}.resource_type = ?) AND (#{role_table}.resource_id IS NULL))"
|
71
71
|
values << role << (resource.is_a?(Class) ? resource.to_s : resource.class.name)
|
72
72
|
if !resource.is_a? Class
|
73
|
-
query += " OR ((#{role_table}.name = ?) AND (#{role_table}.resource_type = ?) AND (#{role_table}.resource_id = ?))"
|
73
|
+
query += " OR ((#{role_table}.name = ?) AND (#{role_table}.resource_type = ?) AND (#{role_table}.resource_id = ?))"
|
74
74
|
values << role << resource.class.name << resource.id
|
75
75
|
end
|
76
76
|
query += ")"
|
@@ -79,4 +79,4 @@ module Rolify
|
|
79
79
|
end
|
80
80
|
end
|
81
81
|
end
|
82
|
-
end
|
82
|
+
end
|
data/lib/rolify/configure.rb
CHANGED
@@ -45,7 +45,7 @@ module Rolify
|
|
45
45
|
role_cnames = [ "Role" ] if role_cnames.empty?
|
46
46
|
role_cnames.each do |role_cname|
|
47
47
|
role_class = role_cname.constantize
|
48
|
-
if role_class.superclass == ActiveRecord && !role_class.table_exists?
|
48
|
+
if role_class.superclass.to_s == "ActiveRecord" && !role_class.table_exists?
|
49
49
|
warn "[WARN] table '#{role_cname}' doesn't exist. Did you run the migration ? Ignoring rolify config."
|
50
50
|
return false
|
51
51
|
end
|
data/lib/rolify/version.rb
CHANGED
data/rolify.gemspec
CHANGED
@@ -15,23 +15,16 @@ Gem::Specification.new do |s|
|
|
15
15
|
s.rubyforge_project = s.name
|
16
16
|
|
17
17
|
s.files = `git ls-files`.split("\n")
|
18
|
-
s.test_files = `git ls-files --
|
18
|
+
s.test_files = `git ls-files -- spec/*`.split("\n")
|
19
19
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
20
|
s.require_paths = ["lib"]
|
21
21
|
|
22
|
-
if defined?(RUBY_ENGINE) && RUBY_ENGINE == "jruby"
|
23
|
-
s.add_development_dependency "activerecord-jdbcsqlite3-adapter"
|
24
|
-
else
|
25
|
-
s.add_development_dependency "sqlite3"
|
26
|
-
s.add_development_dependency "bson_ext" if RUBY_VERSION < "2.0.0"
|
27
|
-
end
|
28
|
-
s.add_development_dependency "activerecord", ">= 3.1.0"
|
29
|
-
s.add_development_dependency "mongoid", ">= 3.0"
|
30
22
|
s.add_development_dependency "ammeter"
|
31
23
|
s.add_development_dependency "rake"
|
32
24
|
s.add_development_dependency "rspec", ">= 2.0"
|
33
25
|
s.add_development_dependency "rspec-rails", ">= 2.0"
|
34
|
-
s.add_development_dependency "
|
35
|
-
s.add_development_dependency "
|
36
|
-
s.add_development_dependency "
|
26
|
+
s.add_development_dependency "bundler"
|
27
|
+
s.add_development_dependency "fuubar"
|
28
|
+
s.add_development_dependency "activerecord", ">= 3.2.0"
|
29
|
+
s.add_development_dependency "mongoid", ">= 3.1"
|
37
30
|
end
|
data/spec/README.rdoc
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
= Rolify Specs
|
2
|
+
|
3
|
+
== Running the specs
|
4
|
+
|
5
|
+
To run the specs first run the +bundle+ command to install the necessary gems and the +rake+ command to run the specs.
|
6
|
+
|
7
|
+
bundle
|
8
|
+
rake
|
9
|
+
|
10
|
+
== Model Adapters
|
11
|
+
|
12
|
+
Rolify currently supports 2 different ORMs: ActiveRecord and Mongoid. By default it will use Active Record but you can change this by setting the +ADAPTER+ environment variable before running the specs. You can run the +bundle+ command with this as well to ensure you have all the required gems.
|
13
|
+
|
14
|
+
ADAPTER=mongoid bundle
|
15
|
+
ADAPTER=mongoid rake
|
16
|
+
|
17
|
+
The different model adapters you can specify are:
|
18
|
+
|
19
|
+
* active_record (default)
|
20
|
+
* mongoid
|
21
|
+
|
22
|
+
You can also run the +spec_all+ rake task to run specs for each adapter.
|
23
|
+
|
24
|
+
rake spec_all
|
data/spec/rolify/custom_spec.rb
CHANGED
@@ -5,23 +5,16 @@ require "rolify/shared_examples/shared_examples_for_scopes"
|
|
5
5
|
require "rolify/shared_examples/shared_examples_for_callbacks"
|
6
6
|
|
7
7
|
describe "Using Rolify with custom User and Role class names" do
|
8
|
-
|
9
|
-
|
10
|
-
let(:role_class) { Privilege }
|
8
|
+
def user_class
|
9
|
+
Customer
|
11
10
|
end
|
12
11
|
|
13
|
-
|
14
|
-
|
15
|
-
let(:role_class) { Privilege }
|
16
|
-
end
|
17
|
-
|
18
|
-
it_behaves_like Rolify::Dynamic do
|
19
|
-
let(:user_class) { Customer }
|
20
|
-
let(:role_class) { Privilege }
|
21
|
-
end
|
22
|
-
|
23
|
-
it_behaves_like "Rolify.callbacks" do
|
24
|
-
let(:user_class) { Customer }
|
25
|
-
let(:role_class) { Privilege }
|
12
|
+
def role_class
|
13
|
+
Privilege
|
26
14
|
end
|
15
|
+
|
16
|
+
it_behaves_like Rolify::Role
|
17
|
+
it_behaves_like "Role.scopes"
|
18
|
+
it_behaves_like Rolify::Dynamic
|
19
|
+
it_behaves_like "Rolify.callbacks"
|
27
20
|
end
|
@@ -5,23 +5,16 @@ require "rolify/shared_examples/shared_examples_for_scopes"
|
|
5
5
|
require "rolify/shared_examples/shared_examples_for_callbacks"
|
6
6
|
|
7
7
|
describe "Rolify.namespace" do
|
8
|
-
|
9
|
-
|
10
|
-
let(:role_class) { Admin::Right }
|
8
|
+
def user_class
|
9
|
+
Admin::Moderator
|
11
10
|
end
|
12
11
|
|
13
|
-
|
14
|
-
|
15
|
-
let(:role_class) { Admin::Right }
|
16
|
-
end
|
17
|
-
|
18
|
-
it_behaves_like Rolify::Dynamic do
|
19
|
-
let(:user_class) { Admin::Moderator }
|
20
|
-
let(:role_class) { Admin::Right }
|
21
|
-
end
|
22
|
-
|
23
|
-
it_behaves_like "Rolify.callbacks" do
|
24
|
-
let(:user_class) { Admin::Moderator }
|
25
|
-
let(:role_class) { Admin::Right }
|
12
|
+
def role_class
|
13
|
+
Admin::Right
|
26
14
|
end
|
15
|
+
|
16
|
+
it_behaves_like Rolify::Role
|
17
|
+
it_behaves_like "Role.scopes"
|
18
|
+
it_behaves_like Rolify::Dynamic
|
19
|
+
it_behaves_like "Rolify.callbacks"
|
27
20
|
end
|
@@ -6,12 +6,14 @@ describe Rolify::Resource do
|
|
6
6
|
User.rolify
|
7
7
|
Forum.resourcify
|
8
8
|
Group.resourcify
|
9
|
+
Team.resourcify
|
9
10
|
Role.destroy_all
|
10
11
|
end
|
11
12
|
|
12
13
|
# Users
|
13
14
|
let(:admin) { User.first }
|
14
15
|
let(:tourist) { User.last }
|
16
|
+
let(:captain) { User.where(:login => "god").first }
|
15
17
|
|
16
18
|
# roles
|
17
19
|
let!(:forum_role) { admin.add_role(:forum, Forum.first) }
|
@@ -20,6 +22,8 @@ describe Rolify::Resource do
|
|
20
22
|
let!(:grouper_role) { admin.add_role(:grouper, Group.first) }
|
21
23
|
let!(:tourist_role) { tourist.add_role(:forum, Forum.last) }
|
22
24
|
let!(:sneaky_role) { tourist.add_role(:group, Forum.first) }
|
25
|
+
let!(:captain_role) { captain.add_role(:captain, Team.first) }
|
26
|
+
let!(:player_role) { captain.add_role(:player, Team.last) }
|
23
27
|
|
24
28
|
describe ".with_roles" do
|
25
29
|
subject { Group }
|
@@ -127,7 +131,14 @@ describe Rolify::Resource do
|
|
127
131
|
|
128
132
|
end
|
129
133
|
end
|
130
|
-
|
134
|
+
|
135
|
+
context "with a model not having ID column" do
|
136
|
+
subject { Team }
|
137
|
+
|
138
|
+
it "should find Team instance using team_code column" do
|
139
|
+
subject.with_roles([:captain, :player], captain).should =~ [ Team.first, Team.last ]
|
140
|
+
end
|
141
|
+
end
|
131
142
|
end
|
132
143
|
|
133
144
|
describe ".find_role" do
|
@@ -327,7 +338,7 @@ describe Rolify::Resource do
|
|
327
338
|
|
328
339
|
context "on a Forum instance" do
|
329
340
|
its(:roles) { should eq([ forum_role, sneaky_role ]) }
|
330
|
-
its(:roles) {
|
341
|
+
its(:roles) { should_not include(group_role, godfather_role, tourist_role) }
|
331
342
|
end
|
332
343
|
|
333
344
|
context "on a Group instance" do
|
@@ -8,7 +8,11 @@ describe "Resourcify and rolify on the same model" do
|
|
8
8
|
HumanResource.delete_all
|
9
9
|
end
|
10
10
|
|
11
|
-
let!(:user)
|
11
|
+
let!(:user) do
|
12
|
+
user = HumanResource.new login: 'Samer'
|
13
|
+
user.save
|
14
|
+
user
|
15
|
+
end
|
12
16
|
|
13
17
|
it "should add the role to the user" do
|
14
18
|
expect { user.add_role :admin }.to change { user.roles.count }.by(1)
|
data/spec/rolify/role_spec.rb
CHANGED
@@ -5,23 +5,16 @@ require "rolify/shared_examples/shared_examples_for_scopes"
|
|
5
5
|
require "rolify/shared_examples/shared_examples_for_callbacks"
|
6
6
|
|
7
7
|
describe Rolify do
|
8
|
-
|
9
|
-
|
10
|
-
let(:role_class) { Role }
|
8
|
+
def user_class
|
9
|
+
User
|
11
10
|
end
|
12
11
|
|
13
|
-
|
14
|
-
|
15
|
-
let(:role_class) { Role }
|
16
|
-
end
|
17
|
-
|
18
|
-
it_behaves_like Rolify::Dynamic do
|
19
|
-
let(:user_class) { User }
|
20
|
-
let(:role_class) { Role }
|
21
|
-
end
|
22
|
-
|
23
|
-
it_behaves_like "Rolify.callbacks" do
|
24
|
-
let(:user_class) { User }
|
25
|
-
let(:role_class) { Role }
|
12
|
+
def role_class
|
13
|
+
Role
|
26
14
|
end
|
15
|
+
|
16
|
+
it_behaves_like Rolify::Role
|
17
|
+
it_behaves_like "Role.scopes"
|
18
|
+
it_behaves_like Rolify::Dynamic
|
19
|
+
it_behaves_like "Rolify.callbacks"
|
27
20
|
end
|
@@ -1,7 +1,9 @@
|
|
1
1
|
shared_context "global role", :scope => :global do
|
2
2
|
subject { admin }
|
3
3
|
|
4
|
-
|
4
|
+
def admin
|
5
|
+
user_class.first
|
6
|
+
end
|
5
7
|
|
6
8
|
before(:all) do
|
7
9
|
load_roles
|
@@ -29,7 +31,9 @@ shared_context "class scoped role", :scope => :class do
|
|
29
31
|
create_other_roles
|
30
32
|
end
|
31
33
|
|
32
|
-
|
34
|
+
def manager
|
35
|
+
user_class.where(:login => "moderator").first
|
36
|
+
end
|
33
37
|
|
34
38
|
def load_roles
|
35
39
|
role_class.destroy_all
|
@@ -51,7 +55,9 @@ shared_context "instance scoped role", :scope => :instance do
|
|
51
55
|
create_other_roles
|
52
56
|
end
|
53
57
|
|
54
|
-
|
58
|
+
def moderator
|
59
|
+
user_class.where(:login => "god").first
|
60
|
+
end
|
55
61
|
|
56
62
|
def load_roles
|
57
63
|
role_class.destroy_all
|
@@ -50,7 +50,7 @@ shared_examples_for "#add_role_examples" do |param_name, param_method|
|
|
50
50
|
context "should not create another role" do
|
51
51
|
it "if the role was already assigned to the user" do
|
52
52
|
subject.add_role "warrior".send(param_method), Forum
|
53
|
-
expect { subject.add_role "warrior".send(param_method), Forum }.not_to change { subject.roles.
|
53
|
+
expect { subject.add_role "warrior".send(param_method), Forum }.not_to change { subject.roles.count }
|
54
54
|
end
|
55
55
|
|
56
56
|
it "if already existing in the database" do
|
@@ -62,7 +62,7 @@ shared_examples_for "#add_role_examples" do |param_name, param_method|
|
|
62
62
|
|
63
63
|
context "with an instance scoped role", :scope => :instance do
|
64
64
|
it "should add the role to the user" do
|
65
|
-
expect { subject.add_role "visitor".send(param_method), Forum.last }.to change { subject.roles.
|
65
|
+
expect { subject.add_role "visitor".send(param_method), Forum.last }.to change { subject.roles.count }.by(1)
|
66
66
|
end
|
67
67
|
|
68
68
|
it "should create a role in the roles table" do
|
@@ -1,7 +1,7 @@
|
|
1
1
|
shared_examples_for "#has_any_role?_examples" do |param_name, param_method|
|
2
2
|
context "using #{param_name} as parameter" do
|
3
3
|
context "with a global role", :scope => :global do
|
4
|
-
before
|
4
|
+
before do
|
5
5
|
subject.add_role "staff".send(param_method)
|
6
6
|
end
|
7
7
|
|
@@ -20,7 +20,7 @@ shared_examples_for "#has_any_role?_examples" do |param_name, param_method|
|
|
20
20
|
end
|
21
21
|
|
22
22
|
context "with a class scoped role", :scope => :class do
|
23
|
-
before
|
23
|
+
before do
|
24
24
|
subject.add_role "player".send(param_method), Forum
|
25
25
|
subject.add_role "superhero".send(param_method)
|
26
26
|
end
|
@@ -40,7 +40,7 @@ shared_examples_for "#has_any_role?_examples" do |param_name, param_method|
|
|
40
40
|
end
|
41
41
|
|
42
42
|
context "with a instance scoped role", :scope => :instance do
|
43
|
-
before
|
43
|
+
before do
|
44
44
|
subject.add_role "visitor".send(param_method), Forum.last
|
45
45
|
subject.add_role "leader", Group
|
46
46
|
subject.add_role "warrior"
|
@@ -36,7 +36,7 @@ shared_examples_for "#only_has_role?_examples" do |param_name, param_method|
|
|
36
36
|
end
|
37
37
|
|
38
38
|
context "with multiple roles" do
|
39
|
-
before
|
39
|
+
before { subject.add_role "multiple_global_roles".send(param_method) }
|
40
40
|
|
41
41
|
it { subject.only_has_role?("global_role".send(param_method)).should be_false }
|
42
42
|
end
|
@@ -93,7 +93,7 @@ shared_examples_for "#only_has_role?_examples" do |param_name, param_method|
|
|
93
93
|
end
|
94
94
|
|
95
95
|
context "with multiple roles" do
|
96
|
-
before
|
96
|
+
before { subject.add_role "multiple_class_roles".send(param_method) }
|
97
97
|
|
98
98
|
it { subject.only_has_role?("class_role".send(param_method), Forum).should be_false }
|
99
99
|
it { subject.only_has_role?("class_role".send(param_method), Forum.first).should be_false }
|
@@ -164,7 +164,7 @@ shared_examples_for "#only_has_role?_examples" do |param_name, param_method|
|
|
164
164
|
end
|
165
165
|
|
166
166
|
context "with multiple roles" do
|
167
|
-
before
|
167
|
+
before { subject.add_role "multiple_instance_roles".send(param_method), Forum.first }
|
168
168
|
|
169
169
|
it { subject.only_has_role?("instance_role".send(param_method), Forum.first).should be_false }
|
170
170
|
it { subject.only_has_role?("instance_role".send(param_method), :any).should be_false }
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require "rolify/shared_contexts"
|
2
2
|
|
3
|
-
shared_examples_for "Role.scopes" do
|
4
|
-
before
|
3
|
+
shared_examples_for "Role.scopes" do
|
4
|
+
before do
|
5
5
|
role_class.destroy_all
|
6
6
|
end
|
7
7
|
|
@@ -18,9 +18,9 @@ shared_examples_for "Role.scopes" do |param_name, param_method|
|
|
18
18
|
let!(:manager_role) { subject.add_role :manager, Group }
|
19
19
|
let!(:moderator_role) { subject.add_role :moderator, Forum }
|
20
20
|
|
21
|
-
it { subject.roles.class_scoped.should
|
22
|
-
it { subject.roles.class_scoped(Group).should
|
23
|
-
it { subject.roles.class_scoped(Forum).should
|
21
|
+
it { subject.roles.class_scoped.should =~ [ manager_role, moderator_role ] }
|
22
|
+
it { subject.roles.class_scoped(Group).should =~ [ manager_role ] }
|
23
|
+
it { subject.roles.class_scoped(Forum).should =~ [ moderator_role ] }
|
24
24
|
end
|
25
25
|
|
26
26
|
describe ".instance_scoped" do
|
@@ -28,11 +28,11 @@ shared_examples_for "Role.scopes" do |param_name, param_method|
|
|
28
28
|
let!(:zombie_role) { subject.add_role :visitor, Forum.last }
|
29
29
|
let!(:anonymous_role) { subject.add_role :anonymous, Group.last }
|
30
30
|
|
31
|
-
it { subject.roles.instance_scoped.all.entries.should
|
32
|
-
it { subject.roles.instance_scoped(Forum).should
|
33
|
-
it { subject.roles.instance_scoped(Forum.first).should
|
34
|
-
it { subject.roles.instance_scoped(Forum.last).should
|
35
|
-
it { subject.roles.instance_scoped(Group.last).should
|
31
|
+
it { subject.roles.instance_scoped.all.entries.should =~ [ visitor_role, zombie_role, anonymous_role ] }
|
32
|
+
it { subject.roles.instance_scoped(Forum).should =~ [ visitor_role, zombie_role ] }
|
33
|
+
it { subject.roles.instance_scoped(Forum.first).should =~ [ visitor_role ] }
|
34
|
+
it { subject.roles.instance_scoped(Forum.last).should =~ [ zombie_role ] }
|
35
|
+
it { subject.roles.instance_scoped(Group.last).should =~ [ anonymous_role ] }
|
36
36
|
it { subject.roles.instance_scoped(Group.first).should be_empty }
|
37
37
|
end
|
38
38
|
end
|
@@ -66,4 +66,11 @@ class Group < ActiveRecord::Base
|
|
66
66
|
def subgroups
|
67
67
|
Group.where(:parent_id => id)
|
68
68
|
end
|
69
|
+
end
|
70
|
+
|
71
|
+
class Team < ActiveRecord::Base
|
72
|
+
#resourcify done during specs setup to be able to use custom user classes
|
73
|
+
self.primary_key = "team_code"
|
74
|
+
|
75
|
+
default_scope order(:team_code)
|
69
76
|
end
|
@@ -2,10 +2,6 @@ require 'mongoid'
|
|
2
2
|
|
3
3
|
Mongoid.load!("spec/support/adapters/mongoid.yml", :test)
|
4
4
|
|
5
|
-
RSpec.configure do |config|
|
6
|
-
config.include Mongoid::Matchers
|
7
|
-
end
|
8
|
-
|
9
5
|
::Mongoid::Document.module_eval do
|
10
6
|
def self.included(base)
|
11
7
|
base.extend Rolify
|
@@ -137,3 +133,11 @@ class Group
|
|
137
133
|
Group.in(:parent_id => _id)
|
138
134
|
end
|
139
135
|
end
|
136
|
+
|
137
|
+
class Team
|
138
|
+
include Mongoid::Document
|
139
|
+
#resourcify done during specs setup to be able to use custom user classes
|
140
|
+
|
141
|
+
field :team_code, :type => Integer
|
142
|
+
field :name, :type => String
|
143
|
+
end
|
data/spec/support/data.rb
CHANGED
data/spec/support/schema.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rolify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.3.0.
|
4
|
+
version: 3.3.0.rc4
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,10 +9,10 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-03-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
15
|
+
name: ammeter
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
@@ -28,7 +28,7 @@ dependencies:
|
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '0'
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
|
-
name:
|
31
|
+
name: rake
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
33
33
|
none: false
|
34
34
|
requirements:
|
@@ -44,13 +44,13 @@ dependencies:
|
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: '0'
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
|
-
name:
|
47
|
+
name: rspec
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
49
49
|
none: false
|
50
50
|
requirements:
|
51
51
|
- - ! '>='
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version:
|
53
|
+
version: '2.0'
|
54
54
|
type: :development
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -58,15 +58,15 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - ! '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: '2.0'
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
|
-
name:
|
63
|
+
name: rspec-rails
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
65
65
|
none: false
|
66
66
|
requirements:
|
67
67
|
- - ! '>='
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: '
|
69
|
+
version: '2.0'
|
70
70
|
type: :development
|
71
71
|
prerelease: false
|
72
72
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -74,9 +74,9 @@ dependencies:
|
|
74
74
|
requirements:
|
75
75
|
- - ! '>='
|
76
76
|
- !ruby/object:Gem::Version
|
77
|
-
version: '
|
77
|
+
version: '2.0'
|
78
78
|
- !ruby/object:Gem::Dependency
|
79
|
-
name:
|
79
|
+
name: bundler
|
80
80
|
requirement: !ruby/object:Gem::Requirement
|
81
81
|
none: false
|
82
82
|
requirements:
|
@@ -92,7 +92,7 @@ dependencies:
|
|
92
92
|
- !ruby/object:Gem::Version
|
93
93
|
version: '0'
|
94
94
|
- !ruby/object:Gem::Dependency
|
95
|
-
name:
|
95
|
+
name: fuubar
|
96
96
|
requirement: !ruby/object:Gem::Requirement
|
97
97
|
none: false
|
98
98
|
requirements:
|
@@ -108,61 +108,13 @@ dependencies:
|
|
108
108
|
- !ruby/object:Gem::Version
|
109
109
|
version: '0'
|
110
110
|
- !ruby/object:Gem::Dependency
|
111
|
-
name:
|
112
|
-
requirement: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
|
-
requirements:
|
115
|
-
- - ! '>='
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '2.0'
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
|
-
requirements:
|
123
|
-
- - ! '>='
|
124
|
-
- !ruby/object:Gem::Version
|
125
|
-
version: '2.0'
|
126
|
-
- !ruby/object:Gem::Dependency
|
127
|
-
name: rspec-rails
|
128
|
-
requirement: !ruby/object:Gem::Requirement
|
129
|
-
none: false
|
130
|
-
requirements:
|
131
|
-
- - ! '>='
|
132
|
-
- !ruby/object:Gem::Version
|
133
|
-
version: '2.0'
|
134
|
-
type: :development
|
135
|
-
prerelease: false
|
136
|
-
version_requirements: !ruby/object:Gem::Requirement
|
137
|
-
none: false
|
138
|
-
requirements:
|
139
|
-
- - ! '>='
|
140
|
-
- !ruby/object:Gem::Version
|
141
|
-
version: '2.0'
|
142
|
-
- !ruby/object:Gem::Dependency
|
143
|
-
name: mongoid-rspec
|
144
|
-
requirement: !ruby/object:Gem::Requirement
|
145
|
-
none: false
|
146
|
-
requirements:
|
147
|
-
- - ! '>='
|
148
|
-
- !ruby/object:Gem::Version
|
149
|
-
version: '1.5'
|
150
|
-
type: :development
|
151
|
-
prerelease: false
|
152
|
-
version_requirements: !ruby/object:Gem::Requirement
|
153
|
-
none: false
|
154
|
-
requirements:
|
155
|
-
- - ! '>='
|
156
|
-
- !ruby/object:Gem::Version
|
157
|
-
version: '1.5'
|
158
|
-
- !ruby/object:Gem::Dependency
|
159
|
-
name: bundler
|
111
|
+
name: activerecord
|
160
112
|
requirement: !ruby/object:Gem::Requirement
|
161
113
|
none: false
|
162
114
|
requirements:
|
163
115
|
- - ! '>='
|
164
116
|
- !ruby/object:Gem::Version
|
165
|
-
version:
|
117
|
+
version: 3.2.0
|
166
118
|
type: :development
|
167
119
|
prerelease: false
|
168
120
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -170,15 +122,15 @@ dependencies:
|
|
170
122
|
requirements:
|
171
123
|
- - ! '>='
|
172
124
|
- !ruby/object:Gem::Version
|
173
|
-
version:
|
125
|
+
version: 3.2.0
|
174
126
|
- !ruby/object:Gem::Dependency
|
175
|
-
name:
|
127
|
+
name: mongoid
|
176
128
|
requirement: !ruby/object:Gem::Requirement
|
177
129
|
none: false
|
178
130
|
requirements:
|
179
131
|
- - ! '>='
|
180
132
|
- !ruby/object:Gem::Version
|
181
|
-
version: '
|
133
|
+
version: '3.1'
|
182
134
|
type: :development
|
183
135
|
prerelease: false
|
184
136
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -186,7 +138,7 @@ dependencies:
|
|
186
138
|
requirements:
|
187
139
|
- - ! '>='
|
188
140
|
- !ruby/object:Gem::Version
|
189
|
-
version: '
|
141
|
+
version: '3.1'
|
190
142
|
description: Very simple Roles library without any authorization enforcement supporting
|
191
143
|
scope on resource objects (instance or class). Supports ActiveRecord and Mongoid
|
192
144
|
ORMs.
|
@@ -204,6 +156,8 @@ files:
|
|
204
156
|
- README.md
|
205
157
|
- Rakefile
|
206
158
|
- UPGRADE.rdoc
|
159
|
+
- gemfiles/Gemfile.rails-3.2
|
160
|
+
- gemfiles/Gemfile.rails-4.0
|
207
161
|
- lib/generators/active_record/rolify_generator.rb
|
208
162
|
- lib/generators/active_record/templates/README
|
209
163
|
- lib/generators/active_record/templates/migration.rb
|
@@ -233,6 +187,7 @@ files:
|
|
233
187
|
- lib/rolify/utils.rb
|
234
188
|
- lib/rolify/version.rb
|
235
189
|
- rolify.gemspec
|
190
|
+
- spec/README.rdoc
|
236
191
|
- spec/generators/rolify/rolify_generator_spec.rb
|
237
192
|
- spec/generators_helper.rb
|
238
193
|
- spec/rolify/config_spec.rb
|
@@ -285,6 +240,7 @@ signing_key:
|
|
285
240
|
specification_version: 3
|
286
241
|
summary: Roles library with resource scoping
|
287
242
|
test_files:
|
243
|
+
- spec/README.rdoc
|
288
244
|
- spec/generators/rolify/rolify_generator_spec.rb
|
289
245
|
- spec/generators_helper.rb
|
290
246
|
- spec/rolify/config_spec.rb
|