cantango_editor 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.rspec +2 -0
- data/Gemfile +26 -0
- data/Gemfile.lock +177 -0
- data/MIT-LICENSE +20 -0
- data/README.md +80 -0
- data/Rakefile +54 -0
- data/VERSION +1 -0
- data/app/assets/images/cantango_editor/+.png +0 -0
- data/app/assets/images/cantango_editor/-.png +0 -0
- data/app/assets/images/cantango_editor/.gitkeep +0 -0
- data/app/assets/images/cantango_editor/bg-1.gif +0 -0
- data/app/assets/images/cantango_editor/bg-2.gif +0 -0
- data/app/assets/images/cantango_editor/bg-model.png +0 -0
- data/app/assets/images/cantango_editor/bg.gif +0 -0
- data/app/assets/images/cantango_editor/bg_action.gif +0 -0
- data/app/assets/images/cantango_editor/bg_action.png +0 -0
- data/app/assets/images/cantango_editor/bg_can.gif +0 -0
- data/app/assets/images/cantango_editor/bg_can.png +0 -0
- data/app/assets/images/cantango_editor/bg_cannot.gif +0 -0
- data/app/assets/images/cantango_editor/bg_cannot.png +0 -0
- data/app/assets/images/cantango_editor/button-top-r.png +0 -0
- data/app/assets/images/cantango_editor/button-top.png +0 -0
- data/app/assets/images/cantango_editor/cantangologo.png +0 -0
- data/app/assets/images/cantango_editor/cantangologo_big.png +0 -0
- data/app/assets/images/cantango_editor/cantangologo_big2.png +0 -0
- data/app/assets/images/cantango_editor/cantangologo_big3.png +0 -0
- data/app/assets/images/cantango_editor/ico-uc.png +0 -0
- data/app/assets/images/cantango_editor/images/ui-bg_diagonal-maze_20_6e4f1c_10x10.png +0 -0
- data/app/assets/images/cantango_editor/images/ui-bg_diagonal-maze_40_000000_10x10.png +0 -0
- data/app/assets/images/cantango_editor/images/ui-bg_fine-grain_10_eceadf_60x60.png +0 -0
- data/app/assets/images/cantango_editor/images/ui-bg_fine-grain_10_f8f7f6_60x60.png +0 -0
- data/app/assets/images/cantango_editor/images/ui-bg_fine-grain_15_eceadf_60x60.png +0 -0
- data/app/assets/images/cantango_editor/images/ui-bg_fine-grain_15_f7f3de_60x60.png +0 -0
- data/app/assets/images/cantango_editor/images/ui-bg_fine-grain_15_ffffff_60x60.png +0 -0
- data/app/assets/images/cantango_editor/images/ui-bg_fine-grain_65_654b24_60x60.png +0 -0
- data/app/assets/images/cantango_editor/images/ui-bg_fine-grain_68_b83400_60x60.png +0 -0
- data/app/assets/images/cantango_editor/images/ui-icons_222222_256x240.png +0 -0
- data/app/assets/images/cantango_editor/images/ui-icons_3572ac_256x240.png +0 -0
- data/app/assets/images/cantango_editor/images/ui-icons_8c291d_256x240.png +0 -0
- data/app/assets/images/cantango_editor/images/ui-icons_b83400_256x240.png +0 -0
- data/app/assets/images/cantango_editor/images/ui-icons_fbdb93_256x240.png +0 -0
- data/app/assets/images/cantango_editor/images/ui-icons_ffffff_256x240.png +0 -0
- data/app/assets/images/cantango_editor/line2.png +0 -0
- data/app/assets/images/cantango_editor/line3.png +0 -0
- data/app/assets/images/cantango_editor/panel-l.gif +0 -0
- data/app/assets/images/cantango_editor/panel-l.png +0 -0
- data/app/assets/images/cantango_editor/panel-r.gif +0 -0
- data/app/assets/images/cantango_editor/panel-r.png +0 -0
- data/app/assets/images/cantango_editor/panel.gif +0 -0
- data/app/assets/images/cantango_editor/panel.png +0 -0
- data/app/assets/images/cantango_editor/remember.png +0 -0
- data/app/assets/images/cantango_editor/sexy.png +0 -0
- data/app/assets/images/cantango_editor/x.png +0 -0
- data/app/assets/images/cantango_editor/xx.png +0 -0
- data/app/assets/javascripts/cantango_editor/application.js +59 -0
- data/app/assets/javascripts/cantango_editor/jquery.collapse.js +149 -0
- data/app/assets/javascripts/cantango_editor/jquery.cookie.js +96 -0
- data/app/assets/javascripts/cantango_editor/jquery.ui/jquery-ui-1.8.16.custom.js +996 -0
- data/app/assets/javascripts/cantango_editor/jquery.ui/jquery.ui.selectmenu.js +802 -0
- data/app/assets/stylesheets/cantango_editor/.main.css +157 -0
- data/app/assets/stylesheets/cantango_editor/application.css +7 -0
- data/app/assets/stylesheets/cantango_editor/areset.css +53 -0
- data/app/assets/stylesheets/cantango_editor/clearing.css +52 -0
- data/app/assets/stylesheets/cantango_editor/jquery-ui-1.8.16.custom.css +290 -0
- data/app/assets/stylesheets/cantango_editor/jquery.ui.selectmenu.css +30 -0
- data/app/assets/stylesheets/cantango_editor/main.css +294 -0
- data/app/assets/stylesheets/cantango_editor/text.css +97 -0
- data/app/controllers/cantango_editor/application_controller.rb +12 -0
- data/app/controllers/cantango_editor/permissions_controller.rb +47 -0
- data/app/helpers/cantango_editor/application_helper.rb +49 -0
- data/app/models/cantango_editor/categories.rb +52 -0
- data/app/models/cantango_editor/category.rb +21 -0
- data/app/models/cantango_editor/permissions.rb +119 -0
- data/app/views/cantango_editor/permissions/_footer.html.erb +4 -0
- data/app/views/cantango_editor/permissions/_header.html.erb +7 -0
- data/app/views/cantango_editor/permissions/_menu.html.erb +7 -0
- data/app/views/cantango_editor/permissions/_new_categories_select.html.erb +5 -0
- data/app/views/cantango_editor/permissions/_new_custom_targets.html.erb +5 -0
- data/app/views/cantango_editor/permissions/_new_targets_select.html.erb +5 -0
- data/app/views/cantango_editor/permissions/_permissions_form.html.erb +63 -0
- data/app/views/cantango_editor/permissions/index.html.erb +5 -0
- data/app/views/cantango_editor/permissions/index.js.erb +2 -0
- data/app/views/cantango_editor/permissions/new_category.js.erb +3 -0
- data/app/views/cantango_editor/permissions/new_custom_target.js.erb +2 -0
- data/app/views/cantango_editor/permissions/new_target.js.erb +4 -0
- data/app/views/cantango_editor/permissions/notes.html.erb +19 -0
- data/app/views/cantango_editor/permissions/preview_raw.html.erb +3 -0
- data/app/views/cantango_editor/permissions/temp _permissions_form.html.erb +55 -0
- data/app/views/layouts/cantango_editor/application.html.erb +14 -0
- data/cantango_editor.gemspec +258 -0
- data/config/routes.rb +15 -0
- data/lib/array.rb +11 -0
- data/lib/cantango_editor.rb +25 -0
- data/lib/cantango_editor/configuration.rb +34 -0
- data/lib/cantango_editor/engine.rb +11 -0
- data/lib/cantango_editor/version.rb +3 -0
- data/lib/permissions_hash.rb +80 -0
- data/lib/tasks/cantango-editor_tasks.rake +4 -0
- data/lib/time_precise.rb +7 -0
- data/script/rails +6 -0
- data/spec/cantango_editor/configuration/configuration_spec.rb +33 -0
- data/spec/cantango_editor/models/permissions_spec.rb +9 -0
- data/spec/cantango_editor_spec.rb +17 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/application.js +9 -0
- data/spec/dummy/app/assets/javascripts/main.js +2 -0
- data/spec/dummy/app/assets/stylesheets/application.css +7 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/controllers/main_controller.rb +5 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/helpers/main_helper.rb +2 -0
- data/spec/dummy/app/mailers/.gitkeep +0 -0
- data/spec/dummy/app/models/.gitkeep +0 -0
- data/spec/dummy/app/models/admin.rb +5 -0
- data/spec/dummy/app/models/article.rb +2 -0
- data/spec/dummy/app/models/comment.rb +2 -0
- data/spec/dummy/app/models/concerto.rb +2 -0
- data/spec/dummy/app/models/guest.rb +14 -0
- data/spec/dummy/app/models/improvisation.rb +2 -0
- data/spec/dummy/app/models/post.rb +2 -0
- data/spec/dummy/app/models/song.rb +2 -0
- data/spec/dummy/app/models/tune.rb +2 -0
- data/spec/dummy/app/models/user.rb +11 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/app/views/main/index.html.erb +3 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +53 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/categories.yml +10 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +30 -0
- data/spec/dummy/config/environments/production.rb +60 -0
- data/spec/dummy/config/environments/test.rb +39 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/cantango.rb +4 -0
- data/spec/dummy/config/initializers/cantango_editor.rb +4 -0
- data/spec/dummy/config/initializers/devise.rb +210 -0
- data/spec/dummy/config/initializers/inflections.rb +10 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/devise.en.yml +58 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/permissions.yml.save +59 -0
- data/spec/dummy/config/routes.rb +15 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/20111018203622_create_posts.rb +9 -0
- data/spec/dummy/db/migrate/20111018203648_create_articles.rb +9 -0
- data/spec/dummy/db/migrate/20111018203800_create_comments.rb +9 -0
- data/spec/dummy/db/migrate/20111018203817_create_songs.rb +9 -0
- data/spec/dummy/db/migrate/20111018203827_create_tunes.rb +9 -0
- data/spec/dummy/db/migrate/20111018203859_create_concertos.rb +9 -0
- data/spec/dummy/db/migrate/20111018203917_create_improvisations.rb +9 -0
- data/spec/dummy/db/migrate/20111019122217_devise_create_users.rb +28 -0
- data/spec/dummy/db/schema.rb +58 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/lib/assets/.gitkeep +0 -0
- data/spec/dummy/log/.gitkeep +0 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +26 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/integration/navigation_spec.rb +18 -0
- data/spec/permissions_hash_spec.rb +63 -0
- data/spec/requests/requests_spec.rb +9 -0
- data/spec/spec_helper.rb +16 -0
- metadata +416 -0
data/.rspec
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
|
3
|
+
# Declare your gem's dependencies in cantango_editor.gemspec.
|
4
|
+
# Bundler will treat runtime dependencies like base dependencies, and
|
5
|
+
# development dependencies will be added by default to the :development group.
|
6
|
+
gemspec
|
7
|
+
|
8
|
+
gem "jquery-rails"
|
9
|
+
|
10
|
+
group :development, :test do
|
11
|
+
gem "cantango"
|
12
|
+
|
13
|
+
gem 'jeweler'
|
14
|
+
# Dummy app
|
15
|
+
gem 'devise'
|
16
|
+
gem 'sqlite3'
|
17
|
+
# Debug
|
18
|
+
gem 'cutter'
|
19
|
+
|
20
|
+
# Test
|
21
|
+
gem 'rspec-rails'
|
22
|
+
gem 'capybara'
|
23
|
+
|
24
|
+
# Server
|
25
|
+
gem 'unicorn'
|
26
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,177 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
cantango_editor (0.0.2)
|
5
|
+
cantango_editor
|
6
|
+
jquery-rails
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: http://rubygems.org/
|
10
|
+
specs:
|
11
|
+
actionmailer (3.1.1)
|
12
|
+
actionpack (= 3.1.1)
|
13
|
+
mail (~> 2.3.0)
|
14
|
+
actionpack (3.1.1)
|
15
|
+
activemodel (= 3.1.1)
|
16
|
+
activesupport (= 3.1.1)
|
17
|
+
builder (~> 3.0.0)
|
18
|
+
erubis (~> 2.7.0)
|
19
|
+
i18n (~> 0.6)
|
20
|
+
rack (~> 1.3.2)
|
21
|
+
rack-cache (~> 1.1)
|
22
|
+
rack-mount (~> 0.8.2)
|
23
|
+
rack-test (~> 0.6.1)
|
24
|
+
sprockets (~> 2.0.2)
|
25
|
+
activemodel (3.1.1)
|
26
|
+
activesupport (= 3.1.1)
|
27
|
+
builder (~> 3.0.0)
|
28
|
+
i18n (~> 0.6)
|
29
|
+
activerecord (3.1.1)
|
30
|
+
activemodel (= 3.1.1)
|
31
|
+
activesupport (= 3.1.1)
|
32
|
+
arel (~> 2.2.1)
|
33
|
+
tzinfo (~> 0.3.29)
|
34
|
+
activeresource (3.1.1)
|
35
|
+
activemodel (= 3.1.1)
|
36
|
+
activesupport (= 3.1.1)
|
37
|
+
activesupport (3.1.1)
|
38
|
+
multi_json (~> 1.0)
|
39
|
+
arel (2.2.1)
|
40
|
+
bcrypt-ruby (3.0.1)
|
41
|
+
builder (3.0.0)
|
42
|
+
cancan (1.6.7)
|
43
|
+
cantango (0.9.4.2)
|
44
|
+
cancan (>= 1.4)
|
45
|
+
hashie (>= 0.4)
|
46
|
+
rails (>= 3.0.1)
|
47
|
+
sugar-high (>= 0.6.0)
|
48
|
+
sweetloader (~> 0.1.0)
|
49
|
+
capybara (1.1.1)
|
50
|
+
mime-types (>= 1.16)
|
51
|
+
nokogiri (>= 1.3.3)
|
52
|
+
rack (>= 1.0.0)
|
53
|
+
rack-test (>= 0.5.4)
|
54
|
+
selenium-webdriver (~> 2.0)
|
55
|
+
xpath (~> 0.1.4)
|
56
|
+
childprocess (0.2.2)
|
57
|
+
ffi (~> 1.0.6)
|
58
|
+
colorize (0.5.8)
|
59
|
+
cutter (0.8.2)
|
60
|
+
activesupport (>= 2.3.5)
|
61
|
+
colorize (>= 0.5)
|
62
|
+
devise (1.4.9)
|
63
|
+
bcrypt-ruby (~> 3.0)
|
64
|
+
orm_adapter (~> 0.0.3)
|
65
|
+
warden (~> 1.0.3)
|
66
|
+
diff-lcs (1.1.3)
|
67
|
+
erubis (2.7.0)
|
68
|
+
ffi (1.0.9)
|
69
|
+
git (1.2.5)
|
70
|
+
hashie (1.2.0)
|
71
|
+
hike (1.2.1)
|
72
|
+
i18n (0.6.0)
|
73
|
+
jeweler (1.6.4)
|
74
|
+
bundler (~> 1.0)
|
75
|
+
git (>= 1.2.5)
|
76
|
+
rake
|
77
|
+
jquery-rails (1.0.16)
|
78
|
+
railties (~> 3.0)
|
79
|
+
thor (~> 0.14)
|
80
|
+
json (1.6.1)
|
81
|
+
json_pure (1.6.1)
|
82
|
+
kgio (2.6.0)
|
83
|
+
mail (2.3.0)
|
84
|
+
i18n (>= 0.4.0)
|
85
|
+
mime-types (~> 1.16)
|
86
|
+
treetop (~> 1.4.8)
|
87
|
+
mime-types (1.17.2)
|
88
|
+
multi_json (1.0.3)
|
89
|
+
nokogiri (1.5.0)
|
90
|
+
orm_adapter (0.0.5)
|
91
|
+
polyglot (0.3.3)
|
92
|
+
rack (1.3.5)
|
93
|
+
rack-cache (1.1)
|
94
|
+
rack (>= 0.4)
|
95
|
+
rack-mount (0.8.3)
|
96
|
+
rack (>= 1.0.0)
|
97
|
+
rack-ssl (1.3.2)
|
98
|
+
rack
|
99
|
+
rack-test (0.6.1)
|
100
|
+
rack (>= 1.0)
|
101
|
+
rails (3.1.1)
|
102
|
+
actionmailer (= 3.1.1)
|
103
|
+
actionpack (= 3.1.1)
|
104
|
+
activerecord (= 3.1.1)
|
105
|
+
activeresource (= 3.1.1)
|
106
|
+
activesupport (= 3.1.1)
|
107
|
+
bundler (~> 1.0)
|
108
|
+
railties (= 3.1.1)
|
109
|
+
railties (3.1.1)
|
110
|
+
actionpack (= 3.1.1)
|
111
|
+
activesupport (= 3.1.1)
|
112
|
+
rack-ssl (~> 1.3.2)
|
113
|
+
rake (>= 0.8.7)
|
114
|
+
rdoc (~> 3.4)
|
115
|
+
thor (~> 0.14.6)
|
116
|
+
raindrops (0.8.0)
|
117
|
+
rake (0.9.2.2)
|
118
|
+
rdoc (3.11)
|
119
|
+
json (~> 1.4)
|
120
|
+
rspec (2.7.0)
|
121
|
+
rspec-core (~> 2.7.0)
|
122
|
+
rspec-expectations (~> 2.7.0)
|
123
|
+
rspec-mocks (~> 2.7.0)
|
124
|
+
rspec-core (2.7.1)
|
125
|
+
rspec-expectations (2.7.0)
|
126
|
+
diff-lcs (~> 1.1.2)
|
127
|
+
rspec-mocks (2.7.0)
|
128
|
+
rspec-rails (2.7.0)
|
129
|
+
actionpack (~> 3.0)
|
130
|
+
activesupport (~> 3.0)
|
131
|
+
railties (~> 3.0)
|
132
|
+
rspec (~> 2.7.0)
|
133
|
+
rubyzip (0.9.4)
|
134
|
+
selenium-webdriver (2.10.0)
|
135
|
+
childprocess (>= 0.2.1)
|
136
|
+
ffi (= 1.0.9)
|
137
|
+
json_pure
|
138
|
+
rubyzip
|
139
|
+
sprockets (2.0.3)
|
140
|
+
hike (~> 1.2)
|
141
|
+
rack (~> 1.0)
|
142
|
+
tilt (~> 1.1, != 1.3.0)
|
143
|
+
sqlite3 (1.3.4)
|
144
|
+
sugar-high (0.6.0)
|
145
|
+
activesupport (>= 3.0.1)
|
146
|
+
sweetloader (0.1.1)
|
147
|
+
activesupport (>= 3.0.1)
|
148
|
+
i18n
|
149
|
+
thor (0.14.6)
|
150
|
+
tilt (1.3.3)
|
151
|
+
treetop (1.4.10)
|
152
|
+
polyglot
|
153
|
+
polyglot (>= 0.3.1)
|
154
|
+
tzinfo (0.3.30)
|
155
|
+
unicorn (4.1.1)
|
156
|
+
kgio (~> 2.4)
|
157
|
+
rack
|
158
|
+
raindrops (~> 0.6)
|
159
|
+
warden (1.0.6)
|
160
|
+
rack (>= 1.0)
|
161
|
+
xpath (0.1.4)
|
162
|
+
nokogiri (~> 1.3)
|
163
|
+
|
164
|
+
PLATFORMS
|
165
|
+
ruby
|
166
|
+
|
167
|
+
DEPENDENCIES
|
168
|
+
cantango
|
169
|
+
cantango_editor!
|
170
|
+
capybara
|
171
|
+
cutter
|
172
|
+
devise
|
173
|
+
jeweler
|
174
|
+
jquery-rails
|
175
|
+
rspec-rails
|
176
|
+
sqlite3
|
177
|
+
unicorn
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2011 YOURNAME
|
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
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
# CantangoEditor
|
2
|
+
|
3
|
+
Cantango Editor is a Rails mountable Engine providing web-interface for editing [CanTango](https://github.com/kristianmandrup/cantango) gem's permissions for any Rails 3 app.
|
4
|
+
|
5
|
+
## What it does
|
6
|
+
|
7
|
+
It is no more than a nice-looking wrapper interface which is used for editing permissions stored in special yaml file: default is a config/permissions.yml. See "Yaml Permissions store" section on [Permissions](https://github.com/kristianmandrup/cantango/wiki/Permissions) for more details.
|
8
|
+
|
9
|
+
## Installiation
|
10
|
+
|
11
|
+
### Prerequisites
|
12
|
+
|
13
|
+
CantangoEditor assumes that you're on Rails 3.1 and using [CanTango gem](https://github.com/kristianmandrup/cantango) with [Permission engine enabled](https://github.com/kristianmandrup/cantango/wiki/Permission-engine)
|
14
|
+
|
15
|
+
### Not a Gem yet
|
16
|
+
|
17
|
+
include in Gemfile:
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
gem 'cantango_editor', :git => "git://github.com/stanislaw/cantango_editor.git"
|
21
|
+
bundle update
|
22
|
+
```
|
23
|
+
|
24
|
+
### Set up models, types, groups and actions you're gonna have in your app
|
25
|
+
|
26
|
+
To understand Cantango's permission_engine's options better please see wiki on Cantango's [Permissions](https://github.com/kristianmandrup/cantango/wiki/Permissions).
|
27
|
+
|
28
|
+
Create file cantango_editor.rb in config/initializers and write there:
|
29
|
+
|
30
|
+
```ruby
|
31
|
+
# Your_app's root/config/initializers/cantango_editor.rb
|
32
|
+
CantangoEditor.configure do |config|
|
33
|
+
|
34
|
+
# Permission types to be displayed in interface
|
35
|
+
# default: [:user_types, :account_types, :roles, :role_groups, :licenses, :users]
|
36
|
+
config.permission_types_available = [:roles, :user_types]
|
37
|
+
|
38
|
+
# If you do not enumerate all permission_types here -
|
39
|
+
# those that are unmentioned here will just appear empty, having no permission_groups.
|
40
|
+
# default: { :roles => [:admin, :user] }.
|
41
|
+
config.permission_groups_available = { :roles => [:guest, :user], :user_types => [:admin] }
|
42
|
+
|
43
|
+
# default: all Models extracted from ActiveRecord's tables list
|
44
|
+
config.models_available = config.models_default - [Admin, CustomSession]
|
45
|
+
|
46
|
+
# Cancan's actions
|
47
|
+
# default: [:create, :read, :update, :delete, :manage]
|
48
|
+
config.actions_available = config.actions_default | [:write, :assign_roles]
|
49
|
+
end
|
50
|
+
|
51
|
+
```
|
52
|
+
|
53
|
+
### And mount CantangoEditor somewhere in your app:
|
54
|
+
|
55
|
+
```ruby
|
56
|
+
# Your_app's root/config/routes.rb
|
57
|
+
|
58
|
+
mount CantangoEditor::Engine => "/cantango_editor"
|
59
|
+
```
|
60
|
+
|
61
|
+
## Important note!
|
62
|
+
|
63
|
+
Cantango is heavily based on CanCan authorization system.
|
64
|
+
If you want to have good understanding of how Cantango's permissions rules work we recommend you to read carefully these sections from CanCan's wiki:
|
65
|
+
|
66
|
+
- [Defining
|
67
|
+
abilities](https://github.com/ryanb/cancan/wiki/Defining-Abilities)
|
68
|
+
- [Abilities
|
69
|
+
Precedence](https://github.com/ryanb/cancan/wiki/Ability-Precedence)
|
70
|
+
|
71
|
+
## Todo:
|
72
|
+
|
73
|
+
- Interface for categories too
|
74
|
+
- As always more and better tests
|
75
|
+
- Remove 'dev notes' link ;)
|
76
|
+
|
77
|
+
## Credits:
|
78
|
+
|
79
|
+
- [Stanislaw Pankevich](https://github.com/stanislaw)
|
80
|
+
- [Marina Balioura](https://github.com/mettta)
|
data/Rakefile
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
begin
|
3
|
+
require 'bundler/setup'
|
4
|
+
rescue LoadError
|
5
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
6
|
+
end
|
7
|
+
begin
|
8
|
+
require 'rdoc/task'
|
9
|
+
rescue LoadError
|
10
|
+
require 'rdoc/rdoc'
|
11
|
+
require 'rake/rdoctask'
|
12
|
+
RDoc::Task = Rake::RDocTask
|
13
|
+
end
|
14
|
+
|
15
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
16
|
+
rdoc.rdoc_dir = 'rdoc'
|
17
|
+
rdoc.title = 'CantangoEditor'
|
18
|
+
rdoc.options << '--line-numbers'
|
19
|
+
rdoc.rdoc_files.include('README.rdoc')
|
20
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
21
|
+
end
|
22
|
+
|
23
|
+
APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
|
24
|
+
load 'rails/tasks/engine.rake'
|
25
|
+
|
26
|
+
|
27
|
+
Bundler::GemHelper.install_tasks
|
28
|
+
|
29
|
+
require 'rake/testtask'
|
30
|
+
|
31
|
+
Rake::TestTask.new(:test) do |t|
|
32
|
+
t.libs << 'lib'
|
33
|
+
t.libs << 'spec'
|
34
|
+
t.pattern = 'spec/**/*_spec.rb'
|
35
|
+
t.verbose = false
|
36
|
+
end
|
37
|
+
|
38
|
+
|
39
|
+
task :default => :test
|
40
|
+
|
41
|
+
|
42
|
+
require 'jeweler'
|
43
|
+
Jeweler::Tasks.new do |gem|
|
44
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
45
|
+
gem.name = "cantango_editor"
|
46
|
+
gem.homepage = "http://github.com/stanislaw/cantango_editor"
|
47
|
+
gem.license = "MIT"
|
48
|
+
gem.summary = "Rails Engine to manage permissions stored in yaml file"
|
49
|
+
gem.description = "Admin Web UI to manage permissions - Who can do What on Which objects"
|
50
|
+
gem.email = "s.pankevich@gmail.com"
|
51
|
+
gem.authors = ["stanislaw"]
|
52
|
+
# dependencies defined in Gemfile
|
53
|
+
end
|
54
|
+
Jeweler::RubygemsDotOrgTasks.new
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.2
|
Binary file
|
Binary file
|
File without changes
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|