creature_feature 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
@@ -1,11 +1,11 @@
|
|
1
1
|
module Admin
|
2
2
|
class RolesController < ApplicationController
|
3
3
|
def index
|
4
|
-
@roles = Role.
|
4
|
+
@roles = Role.visible
|
5
5
|
end
|
6
6
|
|
7
7
|
def show
|
8
|
-
|
8
|
+
get_and_verify_role
|
9
9
|
end
|
10
10
|
|
11
11
|
def new
|
@@ -14,7 +14,7 @@ module Admin
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def edit
|
17
|
-
|
17
|
+
get_and_verify_role
|
18
18
|
@features = Feature.all
|
19
19
|
end
|
20
20
|
|
@@ -49,13 +49,14 @@ module Admin
|
|
49
49
|
end
|
50
50
|
|
51
51
|
def update
|
52
|
+
return unless get_and_verify_role
|
53
|
+
|
52
54
|
if params[:role]
|
53
55
|
fp_params = params[:role].delete(:feature_permissions) || []
|
54
56
|
else
|
55
57
|
fp_params = []
|
56
58
|
end
|
57
59
|
|
58
|
-
@role = Role.find(params[:id])
|
59
60
|
@features = Feature.all
|
60
61
|
|
61
62
|
success = false
|
@@ -79,12 +80,22 @@ module Admin
|
|
79
80
|
end
|
80
81
|
|
81
82
|
def destroy
|
82
|
-
|
83
|
+
return unless get_and_verify_role
|
83
84
|
@role.destroy
|
84
85
|
|
85
86
|
notice = 'Role was successfully deleted.'
|
86
87
|
|
87
88
|
redirect_to(admin_roles_url, :notice => notice)
|
88
89
|
end
|
90
|
+
|
91
|
+
private
|
92
|
+
|
93
|
+
def get_and_verify_role
|
94
|
+
@role = Role.visible.find(params[:id]) rescue nil
|
95
|
+
|
96
|
+
redirect_to(admin_roles_url, :alert => 'Invalid Role') and return false if @role.nil?
|
97
|
+
|
98
|
+
return true
|
99
|
+
end
|
89
100
|
end
|
90
101
|
end
|
data/app/models/role.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: creature_feature
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,12 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-
|
13
|
-
default_executable:
|
12
|
+
date: 2011-12-20 00:00:00.000000000Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: rails
|
17
|
-
requirement: &
|
16
|
+
requirement: &14151420 !ruby/object:Gem::Requirement
|
18
17
|
none: false
|
19
18
|
requirements:
|
20
19
|
- - ~>
|
@@ -22,10 +21,10 @@ dependencies:
|
|
22
21
|
version: 3.1.1
|
23
22
|
type: :runtime
|
24
23
|
prerelease: false
|
25
|
-
version_requirements: *
|
24
|
+
version_requirements: *14151420
|
26
25
|
- !ruby/object:Gem::Dependency
|
27
26
|
name: haml-rails
|
28
|
-
requirement: &
|
27
|
+
requirement: &14150280 !ruby/object:Gem::Requirement
|
29
28
|
none: false
|
30
29
|
requirements:
|
31
30
|
- - ! '>='
|
@@ -33,10 +32,10 @@ dependencies:
|
|
33
32
|
version: '0'
|
34
33
|
type: :runtime
|
35
34
|
prerelease: false
|
36
|
-
version_requirements: *
|
35
|
+
version_requirements: *14150280
|
37
36
|
- !ruby/object:Gem::Dependency
|
38
37
|
name: sqlite3
|
39
|
-
requirement: &
|
38
|
+
requirement: &14148380 !ruby/object:Gem::Requirement
|
40
39
|
none: false
|
41
40
|
requirements:
|
42
41
|
- - ! '>='
|
@@ -44,10 +43,10 @@ dependencies:
|
|
44
43
|
version: '0'
|
45
44
|
type: :development
|
46
45
|
prerelease: false
|
47
|
-
version_requirements: *
|
46
|
+
version_requirements: *14148380
|
48
47
|
- !ruby/object:Gem::Dependency
|
49
48
|
name: factory_girl_rails
|
50
|
-
requirement: &
|
49
|
+
requirement: &14147680 !ruby/object:Gem::Requirement
|
51
50
|
none: false
|
52
51
|
requirements:
|
53
52
|
- - ! '>='
|
@@ -55,10 +54,10 @@ dependencies:
|
|
55
54
|
version: '0'
|
56
55
|
type: :development
|
57
56
|
prerelease: false
|
58
|
-
version_requirements: *
|
57
|
+
version_requirements: *14147680
|
59
58
|
- !ruby/object:Gem::Dependency
|
60
59
|
name: rspec-rails
|
61
|
-
requirement: &
|
60
|
+
requirement: &14146860 !ruby/object:Gem::Requirement
|
62
61
|
none: false
|
63
62
|
requirements:
|
64
63
|
- - ! '>='
|
@@ -66,10 +65,10 @@ dependencies:
|
|
66
65
|
version: '0'
|
67
66
|
type: :development
|
68
67
|
prerelease: false
|
69
|
-
version_requirements: *
|
68
|
+
version_requirements: *14146860
|
70
69
|
- !ruby/object:Gem::Dependency
|
71
70
|
name: cucumber-rails
|
72
|
-
requirement: &
|
71
|
+
requirement: &14145860 !ruby/object:Gem::Requirement
|
73
72
|
none: false
|
74
73
|
requirements:
|
75
74
|
- - ! '>='
|
@@ -77,10 +76,10 @@ dependencies:
|
|
77
76
|
version: '0'
|
78
77
|
type: :development
|
79
78
|
prerelease: false
|
80
|
-
version_requirements: *
|
79
|
+
version_requirements: *14145860
|
81
80
|
- !ruby/object:Gem::Dependency
|
82
81
|
name: database_cleaner
|
83
|
-
requirement: &
|
82
|
+
requirement: &14143000 !ruby/object:Gem::Requirement
|
84
83
|
none: false
|
85
84
|
requirements:
|
86
85
|
- - ! '>='
|
@@ -88,10 +87,10 @@ dependencies:
|
|
88
87
|
version: '0'
|
89
88
|
type: :development
|
90
89
|
prerelease: false
|
91
|
-
version_requirements: *
|
90
|
+
version_requirements: *14143000
|
92
91
|
- !ruby/object:Gem::Dependency
|
93
92
|
name: launchy
|
94
|
-
requirement: &
|
93
|
+
requirement: &14142220 !ruby/object:Gem::Requirement
|
95
94
|
none: false
|
96
95
|
requirements:
|
97
96
|
- - ! '>='
|
@@ -99,10 +98,10 @@ dependencies:
|
|
99
98
|
version: '0'
|
100
99
|
type: :development
|
101
100
|
prerelease: false
|
102
|
-
version_requirements: *
|
101
|
+
version_requirements: *14142220
|
103
102
|
- !ruby/object:Gem::Dependency
|
104
103
|
name: guard
|
105
|
-
requirement: &
|
104
|
+
requirement: &14141100 !ruby/object:Gem::Requirement
|
106
105
|
none: false
|
107
106
|
requirements:
|
108
107
|
- - ! '>='
|
@@ -110,10 +109,10 @@ dependencies:
|
|
110
109
|
version: '0'
|
111
110
|
type: :development
|
112
111
|
prerelease: false
|
113
|
-
version_requirements: *
|
112
|
+
version_requirements: *14141100
|
114
113
|
- !ruby/object:Gem::Dependency
|
115
114
|
name: guard-rspec
|
116
|
-
requirement: &
|
115
|
+
requirement: &14140460 !ruby/object:Gem::Requirement
|
117
116
|
none: false
|
118
117
|
requirements:
|
119
118
|
- - ! '>='
|
@@ -121,10 +120,10 @@ dependencies:
|
|
121
120
|
version: '0'
|
122
121
|
type: :development
|
123
122
|
prerelease: false
|
124
|
-
version_requirements: *
|
123
|
+
version_requirements: *14140460
|
125
124
|
- !ruby/object:Gem::Dependency
|
126
125
|
name: guard-cucumber
|
127
|
-
requirement: &
|
126
|
+
requirement: &14139560 !ruby/object:Gem::Requirement
|
128
127
|
none: false
|
129
128
|
requirements:
|
130
129
|
- - ! '>='
|
@@ -132,7 +131,7 @@ dependencies:
|
|
132
131
|
version: '0'
|
133
132
|
type: :development
|
134
133
|
prerelease: false
|
135
|
-
version_requirements: *
|
134
|
+
version_requirements: *14139560
|
136
135
|
description: Rails 3.1 engine which adds the ability to build roles from features
|
137
136
|
you create.
|
138
137
|
email:
|
@@ -141,30 +140,30 @@ executables: []
|
|
141
140
|
extensions: []
|
142
141
|
extra_rdoc_files: []
|
143
142
|
files:
|
144
|
-
- app/models/role.rb
|
145
|
-
- app/models/feature.rb
|
146
|
-
- app/models/feature_permission.rb
|
147
|
-
- app/helpers/admin/roles_helper.rb
|
148
|
-
- app/helpers/admin/features_helper.rb
|
149
143
|
- app/views/admin/features/index.html.haml
|
144
|
+
- app/views/admin/roles/show.html.haml
|
150
145
|
- app/views/admin/roles/new.html.haml
|
151
146
|
- app/views/admin/roles/_form.html.haml
|
152
147
|
- app/views/admin/roles/edit.html.haml
|
153
|
-
- app/views/admin/roles/show.html.haml
|
154
148
|
- app/views/admin/roles/index.html.haml
|
155
|
-
- app/
|
149
|
+
- app/helpers/admin/features_helper.rb
|
150
|
+
- app/helpers/admin/roles_helper.rb
|
156
151
|
- app/controllers/admin/features_controller.rb
|
157
|
-
- app/
|
152
|
+
- app/controllers/admin/roles_controller.rb
|
158
153
|
- app/assets/stylesheets/admin/features.css
|
154
|
+
- app/assets/stylesheets/admin/roles.css
|
159
155
|
- app/assets/javascripts/admin/roles.js
|
160
156
|
- app/assets/javascripts/admin/features.js
|
161
|
-
-
|
157
|
+
- app/models/feature.rb
|
158
|
+
- app/models/feature_permission.rb
|
159
|
+
- app/models/role.rb
|
162
160
|
- config/cucumber.yml
|
161
|
+
- config/routes.rb
|
162
|
+
- db/migrate/20111116174017_create_feature_permissions.rb
|
163
163
|
- db/migrate/20111116151332_create_roles.rb
|
164
164
|
- db/migrate/20111115210509_create_features.rb
|
165
|
-
- db/migrate/20111116174017_create_feature_permissions.rb
|
166
|
-
- lib/tasks/cucumber.rake
|
167
165
|
- lib/tasks/guard.rake
|
166
|
+
- lib/tasks/cucumber.rake
|
168
167
|
- lib/tasks/creature_feature_tasks.rake
|
169
168
|
- lib/creature_feature.rb
|
170
169
|
- lib/creature_feature/version.rb
|
@@ -172,7 +171,6 @@ files:
|
|
172
171
|
- MIT-LICENSE
|
173
172
|
- Rakefile
|
174
173
|
- README.rdoc
|
175
|
-
has_rdoc: true
|
176
174
|
homepage: ''
|
177
175
|
licenses: []
|
178
176
|
post_install_message:
|
@@ -187,7 +185,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
187
185
|
version: '0'
|
188
186
|
segments:
|
189
187
|
- 0
|
190
|
-
hash:
|
188
|
+
hash: 3954090576861834810
|
191
189
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
192
190
|
none: false
|
193
191
|
requirements:
|
@@ -196,10 +194,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
196
194
|
version: '0'
|
197
195
|
segments:
|
198
196
|
- 0
|
199
|
-
hash:
|
197
|
+
hash: 3954090576861834810
|
200
198
|
requirements: []
|
201
199
|
rubyforge_project:
|
202
|
-
rubygems_version: 1.
|
200
|
+
rubygems_version: 1.8.10
|
203
201
|
signing_key:
|
204
202
|
specification_version: 3
|
205
203
|
summary: Role/Feature engine for Rails 3.1.
|