roles_active_record 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +21 -0
- data/.rspec +1 -0
- data/Gemfile +13 -0
- data/LICENSE +20 -0
- data/README.markdown +178 -0
- data/Rakefile +28 -0
- data/VERSION +1 -0
- data/development.sqlite3 +0 -0
- data/lib/generators/active_record/roles/roles_generator.rb +46 -0
- data/lib/generators/active_record/roles_migration/roles_migration_generator.rb +54 -0
- data/lib/generators/active_record/roles_migration/templates/add_admin_flag_strategy.erb +14 -0
- data/lib/generators/active_record/roles_migration/templates/add_many_roles_strategy.erb +40 -0
- data/lib/generators/active_record/roles_migration/templates/add_one_role_strategy.erb +40 -0
- data/lib/generators/active_record/roles_migration/templates/add_role_string_strategy.erb +13 -0
- data/lib/generators/active_record/roles_migration/templates/add_roles_mask_to_users_migration.erb +13 -0
- data/lib/generators/active_record/setup/setup_generator.rb +40 -0
- data/lib/roles_active_record/base.rb +19 -0
- data/lib/roles_active_record/namespaces.rb +12 -0
- data/lib/roles_active_record/role.rb +24 -0
- data/lib/roles_active_record/strategy/multi/many_roles.rb +70 -0
- data/lib/roles_active_record/strategy/multi/roles_mask.rb +84 -0
- data/lib/roles_active_record/strategy/single/admin_flag.rb +53 -0
- data/lib/roles_active_record/strategy/single/one_role.rb +49 -0
- data/lib/roles_active_record/strategy/single/role_string.rb +51 -0
- data/lib/roles_active_record/strategy.rb +15 -0
- data/lib/roles_for_active_record.rb +13 -0
- data/lib/views/_multi_role_selector.erb.html +5 -0
- data/lib/views/_single_role_selector.erb.html +1 -0
- data/roles_active_record.gemspec +161 -0
- data/roles_for_ar.gemspec +165 -0
- data/sandbox/Rakefile +16 -0
- data/sandbox/add_role_to_users_migration.erb +13 -0
- data/sandbox/create_roles_migration.erb +12 -0
- data/sandbox/create_user_roles_migration.erb +13 -0
- data/sandbox/database.log +47 -0
- data/sandbox/database.yml +4 -0
- data/sandbox/development.sqlite3 +0 -0
- data/sandbox/migrate/201002508_create_roles.rb +11 -0
- data/sandbox/migrate/20102507_create_users.rb +11 -0
- data/sandbox/model_base.rb +46 -0
- data/sandbox/test.rb +13 -0
- data/spec/db/database.yml +4 -0
- data/spec/fixtures/many_roles_setup.rb +8 -0
- data/spec/fixtures/one_role_setup.rb +8 -0
- data/spec/migrations/admin_flag/004_add_admin_flag_to_users.rb +15 -0
- data/spec/migrations/many_roles/002_create_roles.rb +13 -0
- data/spec/migrations/many_roles/003_create_user_roles.rb +13 -0
- data/spec/migrations/one_role/002_create_roles.rb +12 -0
- data/spec/migrations/one_role/003_add_role_to_users.rb +13 -0
- data/spec/migrations/role_string/002_add_role_string_to_users.rb +13 -0
- data/spec/migrations/roles_mask/005_add_roles_mask_to_users.rb +13 -0
- data/spec/migrations/users/001_create_users.rb +11 -0
- data/spec/roles_active_record/admin_flag_spec.rb +71 -0
- data/spec/roles_active_record/generators/migration_spec_helper.rb +17 -0
- data/spec/roles_active_record/generators/roles_migration/admin_flag_spec.rb +67 -0
- data/spec/roles_active_record/generators/roles_migration/many_roles_spec.rb +57 -0
- data/spec/roles_active_record/generators/roles_migration/one_role_spec.rb +56 -0
- data/spec/roles_active_record/generators/roles_migration/role_string_spec.rb +40 -0
- data/spec/roles_active_record/generators/roles_migration/roles_mask_spec.rb +36 -0
- data/spec/roles_active_record/generators/setup_generator_spec.rb +40 -0
- data/spec/roles_active_record/many_roles_spec.rb +69 -0
- data/spec/roles_active_record/one_role_spec.rb +68 -0
- data/spec/roles_active_record/role_string_spec.rb +68 -0
- data/spec/roles_active_record/roles_mask_spec.rb +68 -0
- data/spec/spec_helper.rb +57 -0
- metadata +318 -0
@@ -0,0 +1,69 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
use_roles_strategy :many_roles
|
3
|
+
|
4
|
+
migrate('many_roles')
|
5
|
+
|
6
|
+
describe "Roles for Active Record" do
|
7
|
+
before do
|
8
|
+
migrate('many_roles')
|
9
|
+
end
|
10
|
+
|
11
|
+
context "default setup" do
|
12
|
+
|
13
|
+
before :each do
|
14
|
+
load 'fixtures/many_roles_setup.rb'
|
15
|
+
|
16
|
+
@user = User.create(:name => 'Kristian')
|
17
|
+
@user.add_roles :guest
|
18
|
+
@user.save
|
19
|
+
|
20
|
+
puts "user: #{@user.inspect}"
|
21
|
+
puts "user roles: #{UserRole.all.inspect}"
|
22
|
+
puts "roles: #{Role.all.inspect}"
|
23
|
+
|
24
|
+
@admin_user = User.create(:name => 'Admin user')
|
25
|
+
@admin_user.roles = :admin
|
26
|
+
@admin_user.save
|
27
|
+
end
|
28
|
+
|
29
|
+
describe '#in_role' do
|
30
|
+
it "should return first user matching role" do
|
31
|
+
User.in_role(:guest).first.name.should == 'Kristian'
|
32
|
+
User.in_role(:admin).first.name.should == 'Admin user'
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
describe "Role API" do
|
37
|
+
it "should have admin user role to :admin" do
|
38
|
+
@admin_user.roles_list.first.should == :admin
|
39
|
+
@admin_user.admin?.should be_true
|
40
|
+
|
41
|
+
@admin_user.has_role?(:guest).should be_false
|
42
|
+
|
43
|
+
@admin_user.has_role?(:admin).should be_true
|
44
|
+
@admin_user.is?(:admin).should be_true
|
45
|
+
@admin_user.has_roles?(:admin).should be_true
|
46
|
+
@admin_user.has?(:admin).should be_true
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should have user role to :guest" do
|
50
|
+
@user.roles_list.first.should == :guest
|
51
|
+
@user.admin?.should be_false
|
52
|
+
|
53
|
+
@user.has_role?(:guest).should be_true
|
54
|
+
@user.has_role?(:admin).should be_false
|
55
|
+
@user.is?(:admin).should be_false
|
56
|
+
|
57
|
+
@user.has_roles?(:admin).should be_false
|
58
|
+
@user.has?(:admin).should be_false
|
59
|
+
end
|
60
|
+
|
61
|
+
it "should set user role to :admin using roles=" do
|
62
|
+
@user.roles = :admin
|
63
|
+
@user.roles_list.first.should == :admin
|
64
|
+
@user.has_role?(:admin).should be_true
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
@@ -0,0 +1,68 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
use_roles_strategy :one_role
|
3
|
+
|
4
|
+
migrate('one_role')
|
5
|
+
|
6
|
+
describe "Roles for Active Record" do
|
7
|
+
before do
|
8
|
+
migrate('one_role')
|
9
|
+
end
|
10
|
+
|
11
|
+
context "default setup" do
|
12
|
+
|
13
|
+
before :each do
|
14
|
+
load 'fixtures/one_role_setup.rb'
|
15
|
+
|
16
|
+
@user = User.create(:name => 'Kristian')
|
17
|
+
@user.role = :guest
|
18
|
+
@user.save
|
19
|
+
|
20
|
+
puts "user: #{@user.one_role.inspect}"
|
21
|
+
puts "role: #{Role.first.inspect}"
|
22
|
+
|
23
|
+
@admin_user = User.create(:name => 'Admin user')
|
24
|
+
@admin_user.role = :admin
|
25
|
+
@admin_user.save
|
26
|
+
end
|
27
|
+
|
28
|
+
describe '#in_role' do
|
29
|
+
it "should return first user matching role" do
|
30
|
+
User.in_role(:guest).first.name.should == 'Kristian'
|
31
|
+
User.in_role(:admin).first.name.should == 'Admin user'
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe "Role API" do
|
36
|
+
it "should have admin user role to :admin" do
|
37
|
+
@admin_user.roles_list.first.should == :admin
|
38
|
+
@admin_user.admin?.should be_true
|
39
|
+
|
40
|
+
@admin_user.has_role?(:guest).should be_false
|
41
|
+
|
42
|
+
@admin_user.has_role?(:admin).should be_true
|
43
|
+
@admin_user.is?(:admin).should be_true
|
44
|
+
@admin_user.has_roles?(:admin).should be_true
|
45
|
+
@admin_user.has?(:admin).should be_true
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should have user role to :guest" do
|
49
|
+
@user.roles_list.first.should == :guest
|
50
|
+
@user.admin?.should be_false
|
51
|
+
|
52
|
+
@user.has_role?(:guest).should be_true
|
53
|
+
@user.has_role?(:admin).should be_false
|
54
|
+
@user.is?(:admin).should be_false
|
55
|
+
|
56
|
+
@user.has_roles?(:admin).should be_false
|
57
|
+
@user.has?(:admin).should be_false
|
58
|
+
end
|
59
|
+
|
60
|
+
it "should set user role to :admin using roles=" do
|
61
|
+
@user.roles = :admin
|
62
|
+
@user.roles_list.first.should == :admin
|
63
|
+
@user.has_role?(:admin).should be_true
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
@@ -0,0 +1,68 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
use_roles_strategy :role_string
|
3
|
+
|
4
|
+
class User < ActiveRecord::Base
|
5
|
+
include Roles::ActiveRecord
|
6
|
+
|
7
|
+
strategy :role_string, :default
|
8
|
+
valid_roles_are :admin, :guest
|
9
|
+
end
|
10
|
+
|
11
|
+
describe "Roles for Active Record" do
|
12
|
+
before do
|
13
|
+
migrate('role_string')
|
14
|
+
end
|
15
|
+
|
16
|
+
context "default setup" do
|
17
|
+
|
18
|
+
before do
|
19
|
+
@user = User.create(:name => 'Kristian')
|
20
|
+
@user.role = :guest
|
21
|
+
@user.save
|
22
|
+
|
23
|
+
@admin_user = User.create(:name => 'Admin user')
|
24
|
+
@admin_user.roles = :admin
|
25
|
+
@admin_user.save
|
26
|
+
end
|
27
|
+
|
28
|
+
describe '#in_role' do
|
29
|
+
it "should return first user matching role" do
|
30
|
+
User.in_role(:guest).first.name.should == 'Kristian'
|
31
|
+
User.in_role(:admin).first.name.should == 'Admin user'
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe "Role API" do
|
36
|
+
it "should have admin user role to :admin" do
|
37
|
+
@admin_user.roles_list.first.should == :admin
|
38
|
+
@admin_user.admin?.should be_true
|
39
|
+
|
40
|
+
@admin_user.has_role?(:guest).should be_false
|
41
|
+
|
42
|
+
@admin_user.has_role?(:admin).should be_true
|
43
|
+
@admin_user.is?(:admin).should be_true
|
44
|
+
@admin_user.has_roles?(:admin).should be_true
|
45
|
+
@admin_user.has?(:admin).should be_true
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should have user role to :guest" do
|
49
|
+
@user.roles_list.first.should == :guest
|
50
|
+
@user.admin?.should be_false
|
51
|
+
|
52
|
+
@user.has_role?(:guest).should be_true
|
53
|
+
@user.has_role?(:admin).should be_false
|
54
|
+
@user.is?(:admin).should be_false
|
55
|
+
|
56
|
+
@user.has_roles?(:admin).should be_false
|
57
|
+
@user.has?(:admin).should be_false
|
58
|
+
end
|
59
|
+
|
60
|
+
it "should set user role to :admin using roles=" do
|
61
|
+
@user.roles = :admin
|
62
|
+
@user.roles_list.first.should == :admin
|
63
|
+
@user.has_role?(:admin).should be_true
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
@@ -0,0 +1,68 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
use_roles_strategy :roles_mask
|
3
|
+
|
4
|
+
class User < ActiveRecord::Base
|
5
|
+
include Roles::ActiveRecord
|
6
|
+
|
7
|
+
strategy :roles_mask, :default
|
8
|
+
valid_roles_are :admin, :guest
|
9
|
+
end
|
10
|
+
|
11
|
+
describe "Roles for Active Record" do
|
12
|
+
before do
|
13
|
+
migrate('roles_mask')
|
14
|
+
end
|
15
|
+
|
16
|
+
context "default setup" do
|
17
|
+
|
18
|
+
before do
|
19
|
+
@user = User.create(:name => 'Kristian')
|
20
|
+
@user.role = :guest
|
21
|
+
@user.save
|
22
|
+
|
23
|
+
@admin_user = User.create(:name => 'Admin user')
|
24
|
+
@admin_user.roles = :admin
|
25
|
+
@admin_user.save
|
26
|
+
end
|
27
|
+
|
28
|
+
describe '#in_role' do
|
29
|
+
it "should return first user matching role" do
|
30
|
+
User.in_role(:guest).first.name.should == 'Kristian'
|
31
|
+
User.in_role(:admin).first.name.should == 'Admin user'
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe "Role API" do
|
36
|
+
it "should have admin user role to :admin" do
|
37
|
+
@admin_user.roles_list.first.should == :admin
|
38
|
+
@admin_user.admin?.should be_true
|
39
|
+
|
40
|
+
@admin_user.has_role?(:guest).should be_false
|
41
|
+
|
42
|
+
@admin_user.has_role?(:admin).should be_true
|
43
|
+
@admin_user.is?(:admin).should be_true
|
44
|
+
@admin_user.has_roles?(:admin).should be_true
|
45
|
+
@admin_user.has?(:admin).should be_true
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should have user role to :guest" do
|
49
|
+
@user.roles_list.first.should == :guest
|
50
|
+
@user.admin?.should be_false
|
51
|
+
|
52
|
+
@user.has_role?(:guest).should be_true
|
53
|
+
@user.has_role?(:admin).should be_false
|
54
|
+
@user.is?(:admin).should be_false
|
55
|
+
|
56
|
+
@user.has_roles?(:admin).should be_false
|
57
|
+
@user.has?(:admin).should be_false
|
58
|
+
end
|
59
|
+
|
60
|
+
it "should set user role to :admin using roles=" do
|
61
|
+
@user.roles = :admin
|
62
|
+
@user.roles_list.first.should == :admin
|
63
|
+
@user.has_role?(:admin).should be_true
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require 'rspec/autorun'
|
3
|
+
require 'rails'
|
4
|
+
require 'active_record'
|
5
|
+
require 'arel'
|
6
|
+
require 'meta_where'
|
7
|
+
require 'yaml'
|
8
|
+
require 'logger'
|
9
|
+
require 'database_cleaner'
|
10
|
+
require 'roles_for_active_record'
|
11
|
+
|
12
|
+
module Rails
|
13
|
+
def self.config_root_dir
|
14
|
+
File.dirname(__FILE__)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
path = File.dirname(__FILE__) + '/db/database.yml'
|
19
|
+
dbfile = File.open(path)
|
20
|
+
dbconfig = YAML::load(dbfile)
|
21
|
+
ActiveRecord::Base.establish_connection(dbconfig)
|
22
|
+
ActiveRecord::Base.logger = Logger.new(STDERR)
|
23
|
+
|
24
|
+
DatabaseCleaner.strategy = :truncation
|
25
|
+
|
26
|
+
# $ rake VERSION=0
|
27
|
+
|
28
|
+
def migration_folder(name)
|
29
|
+
path = File.dirname(__FILE__) + "/migrations/#{name}"
|
30
|
+
end
|
31
|
+
|
32
|
+
ORM_NAME = 'Active Record'
|
33
|
+
|
34
|
+
def migrate(name)
|
35
|
+
mig_folder = migration_folder(name)
|
36
|
+
puts "Migrating folder: #{mig_folder}"
|
37
|
+
ActiveRecord::Migrator.migrate mig_folder
|
38
|
+
end
|
39
|
+
|
40
|
+
RSpec.configure do |config|
|
41
|
+
config.before(:suite) do
|
42
|
+
DatabaseCleaner.strategy = :transaction
|
43
|
+
DatabaseCleaner.clean_with(:truncation)
|
44
|
+
# DatabaseCleaner.clean
|
45
|
+
end
|
46
|
+
|
47
|
+
config.before(:each) do
|
48
|
+
DatabaseCleaner.start
|
49
|
+
migrate('users')
|
50
|
+
end
|
51
|
+
|
52
|
+
config.after(:each) do
|
53
|
+
DatabaseCleaner.clean
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
|
metadata
ADDED
@@ -0,0 +1,318 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: roles_active_record
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
version: 0.1.0
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Kristian Mandrup
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-09-06 00:00:00 +02:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: rspec
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ~>
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
segments:
|
29
|
+
- 2
|
30
|
+
- 0
|
31
|
+
- 0
|
32
|
+
- beta
|
33
|
+
- 19
|
34
|
+
version: 2.0.0.beta.19
|
35
|
+
type: :development
|
36
|
+
version_requirements: *id001
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: database_cleaner
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
segments:
|
46
|
+
- 0
|
47
|
+
- 5
|
48
|
+
- 2
|
49
|
+
version: 0.5.2
|
50
|
+
type: :development
|
51
|
+
version_requirements: *id002
|
52
|
+
- !ruby/object:Gem::Dependency
|
53
|
+
name: generator-spec
|
54
|
+
prerelease: false
|
55
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
57
|
+
requirements:
|
58
|
+
- - ~>
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
segments:
|
61
|
+
- 0
|
62
|
+
- 4
|
63
|
+
- 5
|
64
|
+
version: 0.4.5
|
65
|
+
type: :development
|
66
|
+
version_requirements: *id003
|
67
|
+
- !ruby/object:Gem::Dependency
|
68
|
+
name: activerecord
|
69
|
+
prerelease: false
|
70
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
71
|
+
none: false
|
72
|
+
requirements:
|
73
|
+
- - ~>
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
segments:
|
76
|
+
- 3
|
77
|
+
- 0
|
78
|
+
- 0
|
79
|
+
version: 3.0.0
|
80
|
+
type: :runtime
|
81
|
+
version_requirements: *id004
|
82
|
+
- !ruby/object:Gem::Dependency
|
83
|
+
name: activesupport
|
84
|
+
prerelease: false
|
85
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
86
|
+
none: false
|
87
|
+
requirements:
|
88
|
+
- - ~>
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
segments:
|
91
|
+
- 3
|
92
|
+
- 0
|
93
|
+
- 0
|
94
|
+
version: 3.0.0
|
95
|
+
type: :runtime
|
96
|
+
version_requirements: *id005
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: arel
|
99
|
+
prerelease: false
|
100
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
101
|
+
none: false
|
102
|
+
requirements:
|
103
|
+
- - ~>
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
segments:
|
106
|
+
- 1
|
107
|
+
- 0
|
108
|
+
- 0
|
109
|
+
version: 1.0.0
|
110
|
+
type: :runtime
|
111
|
+
version_requirements: *id006
|
112
|
+
- !ruby/object:Gem::Dependency
|
113
|
+
name: meta_where
|
114
|
+
prerelease: false
|
115
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
116
|
+
none: false
|
117
|
+
requirements:
|
118
|
+
- - ">="
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
segments:
|
121
|
+
- 0
|
122
|
+
- 5
|
123
|
+
- 2
|
124
|
+
version: 0.5.2
|
125
|
+
type: :runtime
|
126
|
+
version_requirements: *id007
|
127
|
+
- !ruby/object:Gem::Dependency
|
128
|
+
name: sugar-high
|
129
|
+
prerelease: false
|
130
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
131
|
+
none: false
|
132
|
+
requirements:
|
133
|
+
- - ~>
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
segments:
|
136
|
+
- 0
|
137
|
+
- 2
|
138
|
+
- 2
|
139
|
+
version: 0.2.2
|
140
|
+
type: :runtime
|
141
|
+
version_requirements: *id008
|
142
|
+
- !ruby/object:Gem::Dependency
|
143
|
+
name: require_all
|
144
|
+
prerelease: false
|
145
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
146
|
+
none: false
|
147
|
+
requirements:
|
148
|
+
- - ~>
|
149
|
+
- !ruby/object:Gem::Version
|
150
|
+
segments:
|
151
|
+
- 1
|
152
|
+
- 1
|
153
|
+
- 0
|
154
|
+
version: 1.1.0
|
155
|
+
type: :runtime
|
156
|
+
version_requirements: *id009
|
157
|
+
- !ruby/object:Gem::Dependency
|
158
|
+
name: sugar-high
|
159
|
+
prerelease: false
|
160
|
+
requirement: &id010 !ruby/object:Gem::Requirement
|
161
|
+
none: false
|
162
|
+
requirements:
|
163
|
+
- - ~>
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
segments:
|
166
|
+
- 0
|
167
|
+
- 2
|
168
|
+
- 3
|
169
|
+
version: 0.2.3
|
170
|
+
type: :runtime
|
171
|
+
version_requirements: *id010
|
172
|
+
- !ruby/object:Gem::Dependency
|
173
|
+
name: roles_generic
|
174
|
+
prerelease: false
|
175
|
+
requirement: &id011 !ruby/object:Gem::Requirement
|
176
|
+
none: false
|
177
|
+
requirements:
|
178
|
+
- - ~>
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
segments:
|
181
|
+
- 0
|
182
|
+
- 2
|
183
|
+
- 2
|
184
|
+
version: 0.2.2
|
185
|
+
type: :runtime
|
186
|
+
version_requirements: *id011
|
187
|
+
description: Makes it easy to set a role strategy on your User model in Active Record
|
188
|
+
email: kmandrup@gmail.com
|
189
|
+
executables: []
|
190
|
+
|
191
|
+
extensions: []
|
192
|
+
|
193
|
+
extra_rdoc_files:
|
194
|
+
- LICENSE
|
195
|
+
- README.markdown
|
196
|
+
files:
|
197
|
+
- .document
|
198
|
+
- .gitignore
|
199
|
+
- .rspec
|
200
|
+
- Gemfile
|
201
|
+
- LICENSE
|
202
|
+
- README.markdown
|
203
|
+
- Rakefile
|
204
|
+
- VERSION
|
205
|
+
- development.sqlite3
|
206
|
+
- lib/generators/active_record/roles/roles_generator.rb
|
207
|
+
- lib/generators/active_record/roles_migration/roles_migration_generator.rb
|
208
|
+
- lib/generators/active_record/roles_migration/templates/add_admin_flag_strategy.erb
|
209
|
+
- lib/generators/active_record/roles_migration/templates/add_many_roles_strategy.erb
|
210
|
+
- lib/generators/active_record/roles_migration/templates/add_one_role_strategy.erb
|
211
|
+
- lib/generators/active_record/roles_migration/templates/add_role_string_strategy.erb
|
212
|
+
- lib/generators/active_record/roles_migration/templates/add_roles_mask_to_users_migration.erb
|
213
|
+
- lib/generators/active_record/setup/setup_generator.rb
|
214
|
+
- lib/roles_active_record/base.rb
|
215
|
+
- lib/roles_active_record/namespaces.rb
|
216
|
+
- lib/roles_active_record/role.rb
|
217
|
+
- lib/roles_active_record/strategy.rb
|
218
|
+
- lib/roles_active_record/strategy/multi/many_roles.rb
|
219
|
+
- lib/roles_active_record/strategy/multi/roles_mask.rb
|
220
|
+
- lib/roles_active_record/strategy/single/admin_flag.rb
|
221
|
+
- lib/roles_active_record/strategy/single/one_role.rb
|
222
|
+
- lib/roles_active_record/strategy/single/role_string.rb
|
223
|
+
- lib/roles_for_active_record.rb
|
224
|
+
- lib/views/_multi_role_selector.erb.html
|
225
|
+
- lib/views/_single_role_selector.erb.html
|
226
|
+
- roles_active_record.gemspec
|
227
|
+
- roles_for_ar.gemspec
|
228
|
+
- sandbox/Rakefile
|
229
|
+
- sandbox/add_role_to_users_migration.erb
|
230
|
+
- sandbox/create_roles_migration.erb
|
231
|
+
- sandbox/create_user_roles_migration.erb
|
232
|
+
- sandbox/database.log
|
233
|
+
- sandbox/database.yml
|
234
|
+
- sandbox/development.sqlite3
|
235
|
+
- sandbox/migrate/201002508_create_roles.rb
|
236
|
+
- sandbox/migrate/20102507_create_users.rb
|
237
|
+
- sandbox/model_base.rb
|
238
|
+
- sandbox/test.rb
|
239
|
+
- spec/db/database.yml
|
240
|
+
- spec/fixtures/many_roles_setup.rb
|
241
|
+
- spec/fixtures/one_role_setup.rb
|
242
|
+
- spec/migrations/admin_flag/004_add_admin_flag_to_users.rb
|
243
|
+
- spec/migrations/many_roles/002_create_roles.rb
|
244
|
+
- spec/migrations/many_roles/003_create_user_roles.rb
|
245
|
+
- spec/migrations/one_role/002_create_roles.rb
|
246
|
+
- spec/migrations/one_role/003_add_role_to_users.rb
|
247
|
+
- spec/migrations/role_string/002_add_role_string_to_users.rb
|
248
|
+
- spec/migrations/roles_mask/005_add_roles_mask_to_users.rb
|
249
|
+
- spec/migrations/users/001_create_users.rb
|
250
|
+
- spec/roles_active_record/admin_flag_spec.rb
|
251
|
+
- spec/roles_active_record/generators/migration_spec_helper.rb
|
252
|
+
- spec/roles_active_record/generators/roles_migration/admin_flag_spec.rb
|
253
|
+
- spec/roles_active_record/generators/roles_migration/many_roles_spec.rb
|
254
|
+
- spec/roles_active_record/generators/roles_migration/one_role_spec.rb
|
255
|
+
- spec/roles_active_record/generators/roles_migration/role_string_spec.rb
|
256
|
+
- spec/roles_active_record/generators/roles_migration/roles_mask_spec.rb
|
257
|
+
- spec/roles_active_record/generators/setup_generator_spec.rb
|
258
|
+
- spec/roles_active_record/many_roles_spec.rb
|
259
|
+
- spec/roles_active_record/one_role_spec.rb
|
260
|
+
- spec/roles_active_record/role_string_spec.rb
|
261
|
+
- spec/roles_active_record/roles_mask_spec.rb
|
262
|
+
- spec/spec_helper.rb
|
263
|
+
has_rdoc: true
|
264
|
+
homepage: http://github.com/kristianmandrup/roles_for_dm
|
265
|
+
licenses: []
|
266
|
+
|
267
|
+
post_install_message:
|
268
|
+
rdoc_options:
|
269
|
+
- --charset=UTF-8
|
270
|
+
require_paths:
|
271
|
+
- lib
|
272
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
273
|
+
none: false
|
274
|
+
requirements:
|
275
|
+
- - ">="
|
276
|
+
- !ruby/object:Gem::Version
|
277
|
+
segments:
|
278
|
+
- 0
|
279
|
+
version: "0"
|
280
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
281
|
+
none: false
|
282
|
+
requirements:
|
283
|
+
- - ">="
|
284
|
+
- !ruby/object:Gem::Version
|
285
|
+
segments:
|
286
|
+
- 0
|
287
|
+
version: "0"
|
288
|
+
requirements: []
|
289
|
+
|
290
|
+
rubyforge_project:
|
291
|
+
rubygems_version: 1.3.7
|
292
|
+
signing_key:
|
293
|
+
specification_version: 3
|
294
|
+
summary: Implementation of Roles generic API for Active Record
|
295
|
+
test_files:
|
296
|
+
- spec/fixtures/many_roles_setup.rb
|
297
|
+
- spec/fixtures/one_role_setup.rb
|
298
|
+
- spec/migrations/admin_flag/004_add_admin_flag_to_users.rb
|
299
|
+
- spec/migrations/many_roles/002_create_roles.rb
|
300
|
+
- spec/migrations/many_roles/003_create_user_roles.rb
|
301
|
+
- spec/migrations/one_role/002_create_roles.rb
|
302
|
+
- spec/migrations/one_role/003_add_role_to_users.rb
|
303
|
+
- spec/migrations/role_string/002_add_role_string_to_users.rb
|
304
|
+
- spec/migrations/roles_mask/005_add_roles_mask_to_users.rb
|
305
|
+
- spec/migrations/users/001_create_users.rb
|
306
|
+
- spec/roles_active_record/admin_flag_spec.rb
|
307
|
+
- spec/roles_active_record/generators/migration_spec_helper.rb
|
308
|
+
- spec/roles_active_record/generators/roles_migration/admin_flag_spec.rb
|
309
|
+
- spec/roles_active_record/generators/roles_migration/many_roles_spec.rb
|
310
|
+
- spec/roles_active_record/generators/roles_migration/one_role_spec.rb
|
311
|
+
- spec/roles_active_record/generators/roles_migration/role_string_spec.rb
|
312
|
+
- spec/roles_active_record/generators/roles_migration/roles_mask_spec.rb
|
313
|
+
- spec/roles_active_record/generators/setup_generator_spec.rb
|
314
|
+
- spec/roles_active_record/many_roles_spec.rb
|
315
|
+
- spec/roles_active_record/one_role_spec.rb
|
316
|
+
- spec/roles_active_record/role_string_spec.rb
|
317
|
+
- spec/roles_active_record/roles_mask_spec.rb
|
318
|
+
- spec/spec_helper.rb
|