the_role 2.1.1 → 2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +27 -3
- data/.ruby-gemset.example +1 -0
- data/.ruby-version.example +1 -0
- data/.rvmrc.example +1 -1
- data/.travis.yml +2 -2
- data/README.md +46 -47
- data/app/assets/javascripts/the_role_editinplace.js.coffee +32 -0
- data/app/controllers/admin/role_sections_controller.rb +2 -2
- data/app/controllers/admin/roles_controller.rb +2 -2
- data/app/controllers/concerns/controller.rb +23 -0
- data/{lib/generators/the_role/templates → app/models/_templates_}/role.rb +1 -1
- data/app/models/concerns/base.rb +37 -0
- data/app/models/concerns/role.rb +134 -0
- data/app/models/concerns/user.rb +57 -0
- data/app/views/admin/roles/_role.html.haml +90 -69
- data/app/views/admin/roles/_sidebar.html.haml +16 -9
- data/app/views/admin/roles/new.html.haml +11 -10
- data/config/locales/en.yml +1 -0
- data/config/locales/es.yml +28 -28
- data/config/locales/ru.yml +1 -1
- data/db/migrate/20111025025129_create_roles.rb +7 -1
- data/docs/2.1.1.png +0 -0
- data/lib/generators/the_role/USAGE +1 -1
- data/lib/generators/the_role/templates/the_role.rb +7 -2
- data/lib/generators/the_role/the_role_generator.rb +8 -5
- data/lib/tasks/roles.rake +1 -1
- data/lib/the_role/activerecord.rb +11 -0
- data/lib/the_role/config.rb +7 -0
- data/lib/the_role/version.rb +1 -1
- data/lib/the_role.rb +19 -5
- data/spec/dummy_app/.gitignore +18 -0
- data/spec/dummy_app/.rspec +1 -0
- data/spec/dummy_app/Gemfile +32 -0
- data/spec/dummy_app/README.md +39 -0
- data/spec/dummy_app/Rakefile +6 -0
- data/spec/dummy_app/app/assets/images/.keep +0 -0
- data/spec/dummy_app/app/assets/javascripts/application.js +17 -0
- data/spec/dummy_app/app/assets/stylesheets/app/style.css.scss +23 -0
- data/spec/dummy_app/app/assets/stylesheets/application.css +3 -0
- data/spec/dummy_app/app/controllers/application_controller.rb +38 -0
- data/spec/dummy_app/app/controllers/concerns/.keep +0 -0
- data/spec/dummy_app/app/controllers/pages_controller.rb +75 -0
- data/spec/dummy_app/app/controllers/users_controller.rb +32 -0
- data/spec/dummy_app/app/controllers/welcome_controller.rb +13 -0
- data/spec/dummy_app/app/helpers/application_helper.rb +2 -0
- data/spec/dummy_app/app/mailers/.keep +0 -0
- data/spec/dummy_app/app/models/.keep +0 -0
- data/spec/dummy_app/app/models/concerns/.keep +0 -0
- data/spec/dummy_app/app/models/page.rb +24 -0
- data/spec/dummy_app/app/models/role.rb +4 -0
- data/spec/dummy_app/app/models/user.rb +21 -0
- data/spec/dummy_app/app/views/layouts/_current_user_info.html.haml +17 -0
- data/spec/dummy_app/app/views/layouts/application.html.haml +68 -0
- data/spec/dummy_app/app/views/pages/_form.html.haml +19 -0
- data/spec/dummy_app/app/views/pages/edit.html.haml +7 -0
- data/spec/dummy_app/app/views/pages/index.html.haml +27 -0
- data/spec/dummy_app/app/views/pages/manage.html.haml +23 -0
- data/spec/dummy_app/app/views/pages/my.html.haml +10 -0
- data/spec/dummy_app/app/views/pages/new.html.haml +5 -0
- data/spec/dummy_app/app/views/pages/show.html.haml +15 -0
- data/spec/dummy_app/app/views/users/edit.html.haml +34 -0
- data/spec/dummy_app/app/views/welcome/index.html.haml +38 -0
- data/spec/dummy_app/app/views/welcome/profile.html.haml +2 -0
- data/spec/dummy_app/bin/bundle +3 -0
- data/spec/dummy_app/bin/rails +4 -0
- data/spec/dummy_app/bin/rake +4 -0
- data/spec/dummy_app/config/application.rb +23 -0
- data/spec/dummy_app/config/boot.rb +4 -0
- data/spec/dummy_app/config/database.yml +17 -0
- data/spec/dummy_app/config/environment.rb +5 -0
- data/spec/dummy_app/config/environments/development.rb +29 -0
- data/spec/dummy_app/config/environments/production.rb +80 -0
- data/spec/dummy_app/config/environments/test.rb +36 -0
- data/spec/dummy_app/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy_app/config/initializers/devise.rb +227 -0
- data/spec/dummy_app/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy_app/config/initializers/inflections.rb +16 -0
- data/spec/dummy_app/config/initializers/mime_types.rb +5 -0
- data/spec/dummy_app/config/initializers/secret_token.rb +12 -0
- data/spec/dummy_app/config/initializers/session_store.rb +3 -0
- data/spec/dummy_app/config/initializers/the_role.rb +6 -0
- data/spec/dummy_app/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy_app/config/locales/devise.en.yml +57 -0
- data/spec/dummy_app/config/locales/en.yml +7 -0
- data/spec/dummy_app/config/locales/ru.yml +4 -0
- data/spec/dummy_app/config/routes.rb +20 -0
- data/spec/dummy_app/config.ru +4 -0
- data/spec/dummy_app/db/migrate/20120212061952_devise_create_users.rb +63 -0
- data/spec/dummy_app/db/migrate/20120212063249_create_roles.rb +18 -0
- data/spec/dummy_app/db/migrate/20120314061307_create_pages.rb +14 -0
- data/spec/dummy_app/db/schema.rb +59 -0
- data/spec/dummy_app/db/seeds.rb +85 -0
- data/spec/dummy_app/lib/assets/.keep +0 -0
- data/spec/dummy_app/lib/tasks/.keep +0 -0
- data/spec/dummy_app/lib/tasks/assets.rake +15 -0
- data/spec/dummy_app/lib/tasks/db_bootstrap.rake +16 -0
- data/spec/dummy_app/log/.keep +0 -0
- data/spec/dummy_app/public/404.html +58 -0
- data/spec/dummy_app/public/422.html +58 -0
- data/spec/dummy_app/public/500.html +57 -0
- data/spec/dummy_app/public/favicon.ico +0 -0
- data/spec/dummy_app/public/robots.txt +5 -0
- data/spec/dummy_app/spec/controllers/admin_roles_controller_spec.rb +52 -0
- data/spec/dummy_app/spec/controllers/pages_controller_spec.rb +141 -0
- data/spec/dummy_app/spec/controllers/welcome_controller_spec.rb +66 -0
- data/spec/dummy_app/spec/factories/page.rb +6 -0
- data/spec/dummy_app/spec/factories/role.rb +55 -0
- data/spec/dummy_app/spec/factories/user.rb +11 -0
- data/spec/dummy_app/spec/models/hash_spec.rb +272 -0
- data/spec/dummy_app/spec/models/param_process_spec.rb +44 -0
- data/spec/dummy_app/spec/models/role_spec.rb +218 -0
- data/spec/dummy_app/spec/models/user_spec.rb +164 -0
- data/spec/dummy_app/spec/routing/admin_roles_routing_spec.rb +41 -0
- data/spec/dummy_app/spec/routing/pages_routing_spec.rb +35 -0
- data/spec/dummy_app/spec/spec_helper.rb +68 -0
- data/spec/dummy_app/vendor/assets/javascripts/.keep +0 -0
- data/spec/dummy_app/vendor/assets/stylesheets/.keep +0 -0
- data/the_role.gemspec +2 -1
- data/the_role.yml.teamocil.example +11 -0
- metadata +213 -16
- data/app/assets/javascripts/the_role.js.coffee +0 -31
- data/app/assets/stylesheets/the_role/bootstrap_sass.css.scss +0 -20
- data/app/assets/stylesheets/the_role.css.scss +0 -47
- data/app/controllers/the_role_controller.rb +0 -18
- data/app/models/concerns/role_model.rb +0 -125
- data/app/models/concerns/the_role_base.rb +0 -35
- data/app/models/concerns/the_role_user_model.rb +0 -54
@@ -0,0 +1,41 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Admin::RolesController do
|
4
|
+
describe "routing" do
|
5
|
+
describe "collection block" do
|
6
|
+
|
7
|
+
describe "get" do
|
8
|
+
it "admin_roles_path routes to #index" do
|
9
|
+
get(admin_roles_path).should route_to("admin/roles#index")
|
10
|
+
end
|
11
|
+
|
12
|
+
it "new_admin_role_path routes to #new" do
|
13
|
+
get(new_admin_role_path).should route_to("admin/roles#new")
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe "member block" do
|
19
|
+
before(:all) do
|
20
|
+
@role = FactoryGirl.create(:role_user)
|
21
|
+
end
|
22
|
+
|
23
|
+
after(:all) do
|
24
|
+
Role.destroy_all
|
25
|
+
end
|
26
|
+
|
27
|
+
describe "post" do
|
28
|
+
it "CREATE SECTION PATH" do
|
29
|
+
be_routed = route_to(:controller => "admin/role_sections", :action => 'create', :role_id => @role.to_param)
|
30
|
+
post(admin_role_sections_path(@role)).should be_routed
|
31
|
+
end
|
32
|
+
|
33
|
+
it "CREATE RULE PATH" do
|
34
|
+
be_routed = route_to(:controller => "admin/role_sections", :action => 'create_rule', :role_id => @role.to_param)
|
35
|
+
post(create_rule_admin_role_sections_path(@role)).should be_routed
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe PagesController do
|
4
|
+
describe "routing" do
|
5
|
+
|
6
|
+
it "routes to #index" do
|
7
|
+
get("/pages").should route_to("pages#index")
|
8
|
+
end
|
9
|
+
|
10
|
+
it "routes to #new" do
|
11
|
+
get("/pages/new").should route_to("pages#new")
|
12
|
+
end
|
13
|
+
|
14
|
+
it "routes to #show" do
|
15
|
+
get("/pages/1").should route_to("pages#show", :id => "1")
|
16
|
+
end
|
17
|
+
|
18
|
+
it "routes to #edit" do
|
19
|
+
get("/pages/1/edit").should route_to("pages#edit", :id => "1")
|
20
|
+
end
|
21
|
+
|
22
|
+
it "routes to #create" do
|
23
|
+
post("/pages").should route_to("pages#create")
|
24
|
+
end
|
25
|
+
|
26
|
+
it "routes to #update" do
|
27
|
+
put("/pages/1").should route_to("pages#update", :id => "1")
|
28
|
+
end
|
29
|
+
|
30
|
+
it "routes to #destroy" do
|
31
|
+
delete("/pages/1").should route_to("pages#destroy", :id => "1")
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
2
|
+
ENV["RAILS_ENV"] ||= 'test'
|
3
|
+
require File.expand_path("../../config/environment", __FILE__)
|
4
|
+
|
5
|
+
require 'rspec/rails'
|
6
|
+
require 'rspec/autorun'
|
7
|
+
|
8
|
+
# Requires supporting ruby files with custom matchers and macros, etc,
|
9
|
+
# in spec/support/ and its subdirectories.
|
10
|
+
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
|
11
|
+
|
12
|
+
# Checks for pending migrations before tests are run.
|
13
|
+
# If you are not using ActiveRecord, you can remove this line.
|
14
|
+
ActiveRecord::Migration.check_pending! if defined?(ActiveRecord::Migration)
|
15
|
+
|
16
|
+
# Return default text on "Access Denied" page
|
17
|
+
def access_denied_match
|
18
|
+
"redirected"
|
19
|
+
end
|
20
|
+
|
21
|
+
RSpec.configure do |config|
|
22
|
+
# Devise Addons for Testing
|
23
|
+
config.include Devise::TestHelpers, type: :controller
|
24
|
+
|
25
|
+
# If true, the base class of anonymous controllers will be inferred automatically.
|
26
|
+
# This will be the default behavior in future versions of rspec-rails.
|
27
|
+
config.infer_base_class_for_anonymous_controllers = false
|
28
|
+
|
29
|
+
# DatabaseCleaner
|
30
|
+
config.before(:suite) do
|
31
|
+
DatabaseCleaner.strategy = :truncation
|
32
|
+
end
|
33
|
+
|
34
|
+
config.before(:each) do
|
35
|
+
DatabaseCleaner.start
|
36
|
+
end
|
37
|
+
|
38
|
+
config.after(:each) do
|
39
|
+
DatabaseCleaner.clean
|
40
|
+
end
|
41
|
+
|
42
|
+
# Run specs in random order to surface order dependencies. If you find an
|
43
|
+
# order dependency and want to debug it, you can fix the order by providing
|
44
|
+
# the seed, which is printed after each run.
|
45
|
+
# --seed 1234
|
46
|
+
config.order = "random"
|
47
|
+
|
48
|
+
# ## Mock Framework
|
49
|
+
#
|
50
|
+
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
51
|
+
#
|
52
|
+
# config.mock_with :mocha
|
53
|
+
# config.mock_with :flexmock
|
54
|
+
# config.mock_with :rr
|
55
|
+
|
56
|
+
# Exclusion Filter
|
57
|
+
# config.exclusion_filter = { :ruby => lambda {|version|
|
58
|
+
# !(RUBY_VERSION.to_s =~ /^#{version.to_s}/)
|
59
|
+
# }}
|
60
|
+
|
61
|
+
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
62
|
+
# config.fixture_path = "#{::Rails.root}/spec/factories"
|
63
|
+
|
64
|
+
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
65
|
+
# examples within a transaction, remove the following line or assign false
|
66
|
+
# instead of true.
|
67
|
+
# config.use_transactional_fixtures = true
|
68
|
+
end
|
File without changes
|
File without changes
|
data/the_role.gemspec
CHANGED
@@ -17,6 +17,7 @@ Gem::Specification.new do |s|
|
|
17
17
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
18
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
19
|
s.require_paths = ["lib"]
|
20
|
-
|
20
|
+
|
21
|
+
s.add_runtime_dependency 'rails', ['>= 3', '< 5']
|
21
22
|
s.add_dependency 'haml'
|
22
23
|
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
windows:
|
2
|
+
- name: "TheRole"
|
3
|
+
root: "~/rails/opensource/the_role"
|
4
|
+
filters:
|
5
|
+
before: "rvm use ruby-2.0.0-p353; rvm gemset use the_role"
|
6
|
+
layout: tiled
|
7
|
+
panes:
|
8
|
+
- cmd: "clear;"
|
9
|
+
- cmd: "clear;"
|
10
|
+
- cmd: "cd spec/dummy_app; clear"
|
11
|
+
- cmd: "cd spec/dummy_app; clear; rake db:bootstrap RAILS_ENV=test; rspec"
|
metadata
CHANGED
@@ -1,27 +1,47 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: the_role
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: '2.3'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ilya N. Zykin [the-teacher]
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-12-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3'
|
20
|
+
- - <
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '5'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '3'
|
30
|
+
- - <
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '5'
|
13
33
|
- !ruby/object:Gem::Dependency
|
14
34
|
name: haml
|
15
35
|
requirement: !ruby/object:Gem::Requirement
|
16
36
|
requirements:
|
17
|
-
- -
|
37
|
+
- - '>='
|
18
38
|
- !ruby/object:Gem::Version
|
19
39
|
version: '0'
|
20
40
|
type: :runtime
|
21
41
|
prerelease: false
|
22
42
|
version_requirements: !ruby/object:Gem::Requirement
|
23
43
|
requirements:
|
24
|
-
- -
|
44
|
+
- - '>='
|
25
45
|
- !ruby/object:Gem::Version
|
26
46
|
version: '0'
|
27
47
|
description: Authorization for Rails 4 with Web Interface
|
@@ -32,6 +52,8 @@ extensions: []
|
|
32
52
|
extra_rdoc_files: []
|
33
53
|
files:
|
34
54
|
- .gitignore
|
55
|
+
- .ruby-gemset.example
|
56
|
+
- .ruby-version.example
|
35
57
|
- .rvmrc.example
|
36
58
|
- .travis.yml
|
37
59
|
- Bye_bye_CanCan_I_got_the_Role.png
|
@@ -39,15 +61,14 @@ files:
|
|
39
61
|
- README.md
|
40
62
|
- Rakefile
|
41
63
|
- app/assets/javascripts/.keep
|
42
|
-
- app/assets/javascripts/
|
43
|
-
- app/assets/stylesheets/the_role.css.scss
|
44
|
-
- app/assets/stylesheets/the_role/bootstrap_sass.css.scss
|
64
|
+
- app/assets/javascripts/the_role_editinplace.js.coffee
|
45
65
|
- app/controllers/admin/role_sections_controller.rb
|
46
66
|
- app/controllers/admin/roles_controller.rb
|
47
|
-
- app/controllers/
|
48
|
-
- app/models/
|
49
|
-
- app/models/concerns/
|
50
|
-
- app/models/concerns/
|
67
|
+
- app/controllers/concerns/controller.rb
|
68
|
+
- app/models/_templates_/role.rb
|
69
|
+
- app/models/concerns/base.rb
|
70
|
+
- app/models/concerns/role.rb
|
71
|
+
- app/models/concerns/user.rb
|
51
72
|
- app/views/admin/roles/_role.html.haml
|
52
73
|
- app/views/admin/roles/_sidebar.html.haml
|
53
74
|
- app/views/admin/roles/edit.html.haml
|
@@ -60,12 +81,13 @@ files:
|
|
60
81
|
- config/locales/zh_CN.yml
|
61
82
|
- config/routes.rb
|
62
83
|
- db/migrate/20111025025129_create_roles.rb
|
84
|
+
- docs/2.1.1.png
|
63
85
|
- lib/generators/the_role/USAGE
|
64
|
-
- lib/generators/the_role/templates/role.rb
|
65
86
|
- lib/generators/the_role/templates/the_role.rb
|
66
87
|
- lib/generators/the_role/the_role_generator.rb
|
67
88
|
- lib/tasks/roles.rake
|
68
89
|
- lib/the_role.rb
|
90
|
+
- lib/the_role/activerecord.rb
|
69
91
|
- lib/the_role/config.rb
|
70
92
|
- lib/the_role/hash.rb
|
71
93
|
- lib/the_role/param_helper.rb
|
@@ -73,6 +95,94 @@ files:
|
|
73
95
|
- lib/the_role/version.rb
|
74
96
|
- pic.png
|
75
97
|
- the_role.gemspec
|
98
|
+
- the_role.yml.teamocil.example
|
99
|
+
- spec/dummy_app/.gitignore
|
100
|
+
- spec/dummy_app/.rspec
|
101
|
+
- spec/dummy_app/Gemfile
|
102
|
+
- spec/dummy_app/README.md
|
103
|
+
- spec/dummy_app/Rakefile
|
104
|
+
- spec/dummy_app/app/assets/images/.keep
|
105
|
+
- spec/dummy_app/app/assets/javascripts/application.js
|
106
|
+
- spec/dummy_app/app/assets/stylesheets/app/style.css.scss
|
107
|
+
- spec/dummy_app/app/assets/stylesheets/application.css
|
108
|
+
- spec/dummy_app/app/controllers/application_controller.rb
|
109
|
+
- spec/dummy_app/app/controllers/concerns/.keep
|
110
|
+
- spec/dummy_app/app/controllers/pages_controller.rb
|
111
|
+
- spec/dummy_app/app/controllers/users_controller.rb
|
112
|
+
- spec/dummy_app/app/controllers/welcome_controller.rb
|
113
|
+
- spec/dummy_app/app/helpers/application_helper.rb
|
114
|
+
- spec/dummy_app/app/mailers/.keep
|
115
|
+
- spec/dummy_app/app/models/.keep
|
116
|
+
- spec/dummy_app/app/models/concerns/.keep
|
117
|
+
- spec/dummy_app/app/models/page.rb
|
118
|
+
- spec/dummy_app/app/models/role.rb
|
119
|
+
- spec/dummy_app/app/models/user.rb
|
120
|
+
- spec/dummy_app/app/views/layouts/_current_user_info.html.haml
|
121
|
+
- spec/dummy_app/app/views/layouts/application.html.haml
|
122
|
+
- spec/dummy_app/app/views/pages/_form.html.haml
|
123
|
+
- spec/dummy_app/app/views/pages/edit.html.haml
|
124
|
+
- spec/dummy_app/app/views/pages/index.html.haml
|
125
|
+
- spec/dummy_app/app/views/pages/manage.html.haml
|
126
|
+
- spec/dummy_app/app/views/pages/my.html.haml
|
127
|
+
- spec/dummy_app/app/views/pages/new.html.haml
|
128
|
+
- spec/dummy_app/app/views/pages/show.html.haml
|
129
|
+
- spec/dummy_app/app/views/users/edit.html.haml
|
130
|
+
- spec/dummy_app/app/views/welcome/index.html.haml
|
131
|
+
- spec/dummy_app/app/views/welcome/profile.html.haml
|
132
|
+
- spec/dummy_app/bin/bundle
|
133
|
+
- spec/dummy_app/bin/rails
|
134
|
+
- spec/dummy_app/bin/rake
|
135
|
+
- spec/dummy_app/config.ru
|
136
|
+
- spec/dummy_app/config/application.rb
|
137
|
+
- spec/dummy_app/config/boot.rb
|
138
|
+
- spec/dummy_app/config/database.yml
|
139
|
+
- spec/dummy_app/config/environment.rb
|
140
|
+
- spec/dummy_app/config/environments/development.rb
|
141
|
+
- spec/dummy_app/config/environments/production.rb
|
142
|
+
- spec/dummy_app/config/environments/test.rb
|
143
|
+
- spec/dummy_app/config/initializers/backtrace_silencers.rb
|
144
|
+
- spec/dummy_app/config/initializers/devise.rb
|
145
|
+
- spec/dummy_app/config/initializers/filter_parameter_logging.rb
|
146
|
+
- spec/dummy_app/config/initializers/inflections.rb
|
147
|
+
- spec/dummy_app/config/initializers/mime_types.rb
|
148
|
+
- spec/dummy_app/config/initializers/secret_token.rb
|
149
|
+
- spec/dummy_app/config/initializers/session_store.rb
|
150
|
+
- spec/dummy_app/config/initializers/the_role.rb
|
151
|
+
- spec/dummy_app/config/initializers/wrap_parameters.rb
|
152
|
+
- spec/dummy_app/config/locales/devise.en.yml
|
153
|
+
- spec/dummy_app/config/locales/en.yml
|
154
|
+
- spec/dummy_app/config/locales/ru.yml
|
155
|
+
- spec/dummy_app/config/routes.rb
|
156
|
+
- spec/dummy_app/db/migrate/20120212061952_devise_create_users.rb
|
157
|
+
- spec/dummy_app/db/migrate/20120212063249_create_roles.rb
|
158
|
+
- spec/dummy_app/db/migrate/20120314061307_create_pages.rb
|
159
|
+
- spec/dummy_app/db/schema.rb
|
160
|
+
- spec/dummy_app/db/seeds.rb
|
161
|
+
- spec/dummy_app/lib/assets/.keep
|
162
|
+
- spec/dummy_app/lib/tasks/.keep
|
163
|
+
- spec/dummy_app/lib/tasks/assets.rake
|
164
|
+
- spec/dummy_app/lib/tasks/db_bootstrap.rake
|
165
|
+
- spec/dummy_app/log/.keep
|
166
|
+
- spec/dummy_app/public/404.html
|
167
|
+
- spec/dummy_app/public/422.html
|
168
|
+
- spec/dummy_app/public/500.html
|
169
|
+
- spec/dummy_app/public/favicon.ico
|
170
|
+
- spec/dummy_app/public/robots.txt
|
171
|
+
- spec/dummy_app/spec/controllers/admin_roles_controller_spec.rb
|
172
|
+
- spec/dummy_app/spec/controllers/pages_controller_spec.rb
|
173
|
+
- spec/dummy_app/spec/controllers/welcome_controller_spec.rb
|
174
|
+
- spec/dummy_app/spec/factories/page.rb
|
175
|
+
- spec/dummy_app/spec/factories/role.rb
|
176
|
+
- spec/dummy_app/spec/factories/user.rb
|
177
|
+
- spec/dummy_app/spec/models/hash_spec.rb
|
178
|
+
- spec/dummy_app/spec/models/param_process_spec.rb
|
179
|
+
- spec/dummy_app/spec/models/role_spec.rb
|
180
|
+
- spec/dummy_app/spec/models/user_spec.rb
|
181
|
+
- spec/dummy_app/spec/routing/admin_roles_routing_spec.rb
|
182
|
+
- spec/dummy_app/spec/routing/pages_routing_spec.rb
|
183
|
+
- spec/dummy_app/spec/spec_helper.rb
|
184
|
+
- spec/dummy_app/vendor/assets/javascripts/.keep
|
185
|
+
- spec/dummy_app/vendor/assets/stylesheets/.keep
|
76
186
|
homepage: https://github.com/the-teacher/the_role
|
77
187
|
licenses: []
|
78
188
|
metadata: {}
|
@@ -82,18 +192,105 @@ require_paths:
|
|
82
192
|
- lib
|
83
193
|
required_ruby_version: !ruby/object:Gem::Requirement
|
84
194
|
requirements:
|
85
|
-
- -
|
195
|
+
- - '>='
|
86
196
|
- !ruby/object:Gem::Version
|
87
197
|
version: '0'
|
88
198
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
199
|
requirements:
|
90
|
-
- -
|
200
|
+
- - '>='
|
91
201
|
- !ruby/object:Gem::Version
|
92
202
|
version: '0'
|
93
203
|
requirements: []
|
94
204
|
rubyforge_project: the_role
|
95
|
-
rubygems_version: 2.
|
205
|
+
rubygems_version: 2.1.11
|
96
206
|
signing_key:
|
97
207
|
specification_version: 4
|
98
208
|
summary: Authorization for Rails 4
|
99
|
-
test_files:
|
209
|
+
test_files:
|
210
|
+
- spec/dummy_app/.gitignore
|
211
|
+
- spec/dummy_app/.rspec
|
212
|
+
- spec/dummy_app/Gemfile
|
213
|
+
- spec/dummy_app/README.md
|
214
|
+
- spec/dummy_app/Rakefile
|
215
|
+
- spec/dummy_app/app/assets/images/.keep
|
216
|
+
- spec/dummy_app/app/assets/javascripts/application.js
|
217
|
+
- spec/dummy_app/app/assets/stylesheets/app/style.css.scss
|
218
|
+
- spec/dummy_app/app/assets/stylesheets/application.css
|
219
|
+
- spec/dummy_app/app/controllers/application_controller.rb
|
220
|
+
- spec/dummy_app/app/controllers/concerns/.keep
|
221
|
+
- spec/dummy_app/app/controllers/pages_controller.rb
|
222
|
+
- spec/dummy_app/app/controllers/users_controller.rb
|
223
|
+
- spec/dummy_app/app/controllers/welcome_controller.rb
|
224
|
+
- spec/dummy_app/app/helpers/application_helper.rb
|
225
|
+
- spec/dummy_app/app/mailers/.keep
|
226
|
+
- spec/dummy_app/app/models/.keep
|
227
|
+
- spec/dummy_app/app/models/concerns/.keep
|
228
|
+
- spec/dummy_app/app/models/page.rb
|
229
|
+
- spec/dummy_app/app/models/role.rb
|
230
|
+
- spec/dummy_app/app/models/user.rb
|
231
|
+
- spec/dummy_app/app/views/layouts/_current_user_info.html.haml
|
232
|
+
- spec/dummy_app/app/views/layouts/application.html.haml
|
233
|
+
- spec/dummy_app/app/views/pages/_form.html.haml
|
234
|
+
- spec/dummy_app/app/views/pages/edit.html.haml
|
235
|
+
- spec/dummy_app/app/views/pages/index.html.haml
|
236
|
+
- spec/dummy_app/app/views/pages/manage.html.haml
|
237
|
+
- spec/dummy_app/app/views/pages/my.html.haml
|
238
|
+
- spec/dummy_app/app/views/pages/new.html.haml
|
239
|
+
- spec/dummy_app/app/views/pages/show.html.haml
|
240
|
+
- spec/dummy_app/app/views/users/edit.html.haml
|
241
|
+
- spec/dummy_app/app/views/welcome/index.html.haml
|
242
|
+
- spec/dummy_app/app/views/welcome/profile.html.haml
|
243
|
+
- spec/dummy_app/bin/bundle
|
244
|
+
- spec/dummy_app/bin/rails
|
245
|
+
- spec/dummy_app/bin/rake
|
246
|
+
- spec/dummy_app/config.ru
|
247
|
+
- spec/dummy_app/config/application.rb
|
248
|
+
- spec/dummy_app/config/boot.rb
|
249
|
+
- spec/dummy_app/config/database.yml
|
250
|
+
- spec/dummy_app/config/environment.rb
|
251
|
+
- spec/dummy_app/config/environments/development.rb
|
252
|
+
- spec/dummy_app/config/environments/production.rb
|
253
|
+
- spec/dummy_app/config/environments/test.rb
|
254
|
+
- spec/dummy_app/config/initializers/backtrace_silencers.rb
|
255
|
+
- spec/dummy_app/config/initializers/devise.rb
|
256
|
+
- spec/dummy_app/config/initializers/filter_parameter_logging.rb
|
257
|
+
- spec/dummy_app/config/initializers/inflections.rb
|
258
|
+
- spec/dummy_app/config/initializers/mime_types.rb
|
259
|
+
- spec/dummy_app/config/initializers/secret_token.rb
|
260
|
+
- spec/dummy_app/config/initializers/session_store.rb
|
261
|
+
- spec/dummy_app/config/initializers/the_role.rb
|
262
|
+
- spec/dummy_app/config/initializers/wrap_parameters.rb
|
263
|
+
- spec/dummy_app/config/locales/devise.en.yml
|
264
|
+
- spec/dummy_app/config/locales/en.yml
|
265
|
+
- spec/dummy_app/config/locales/ru.yml
|
266
|
+
- spec/dummy_app/config/routes.rb
|
267
|
+
- spec/dummy_app/db/migrate/20120212061952_devise_create_users.rb
|
268
|
+
- spec/dummy_app/db/migrate/20120212063249_create_roles.rb
|
269
|
+
- spec/dummy_app/db/migrate/20120314061307_create_pages.rb
|
270
|
+
- spec/dummy_app/db/schema.rb
|
271
|
+
- spec/dummy_app/db/seeds.rb
|
272
|
+
- spec/dummy_app/lib/assets/.keep
|
273
|
+
- spec/dummy_app/lib/tasks/.keep
|
274
|
+
- spec/dummy_app/lib/tasks/assets.rake
|
275
|
+
- spec/dummy_app/lib/tasks/db_bootstrap.rake
|
276
|
+
- spec/dummy_app/log/.keep
|
277
|
+
- spec/dummy_app/public/404.html
|
278
|
+
- spec/dummy_app/public/422.html
|
279
|
+
- spec/dummy_app/public/500.html
|
280
|
+
- spec/dummy_app/public/favicon.ico
|
281
|
+
- spec/dummy_app/public/robots.txt
|
282
|
+
- spec/dummy_app/spec/controllers/admin_roles_controller_spec.rb
|
283
|
+
- spec/dummy_app/spec/controllers/pages_controller_spec.rb
|
284
|
+
- spec/dummy_app/spec/controllers/welcome_controller_spec.rb
|
285
|
+
- spec/dummy_app/spec/factories/page.rb
|
286
|
+
- spec/dummy_app/spec/factories/role.rb
|
287
|
+
- spec/dummy_app/spec/factories/user.rb
|
288
|
+
- spec/dummy_app/spec/models/hash_spec.rb
|
289
|
+
- spec/dummy_app/spec/models/param_process_spec.rb
|
290
|
+
- spec/dummy_app/spec/models/role_spec.rb
|
291
|
+
- spec/dummy_app/spec/models/user_spec.rb
|
292
|
+
- spec/dummy_app/spec/routing/admin_roles_routing_spec.rb
|
293
|
+
- spec/dummy_app/spec/routing/pages_routing_spec.rb
|
294
|
+
- spec/dummy_app/spec/spec_helper.rb
|
295
|
+
- spec/dummy_app/vendor/assets/javascripts/.keep
|
296
|
+
- spec/dummy_app/vendor/assets/stylesheets/.keep
|
@@ -1,31 +0,0 @@
|
|
1
|
-
showForm = (event) ->
|
2
|
-
item = $ event
|
3
|
-
|
4
|
-
a_item = item.children('span.a')
|
5
|
-
b_item = item.children('span.b')
|
6
|
-
|
7
|
-
a_item.hide().off 'click'
|
8
|
-
b_item.css('visibility', 'visible')
|
9
|
-
|
10
|
-
item.find('.btn-warning').click ->
|
11
|
-
hideForm(event)
|
12
|
-
event.parentNode.reset()
|
13
|
-
|
14
|
-
item.find('.btn-success').click -> event.parentNode.submit()
|
15
|
-
|
16
|
-
b_item.find('input').keypress (e) ->
|
17
|
-
ENTER = 13
|
18
|
-
event.parentNode.submit() if e.which is ENTER
|
19
|
-
|
20
|
-
hideForm = (event) ->
|
21
|
-
item = $ event
|
22
|
-
a_item = item.children('span.a')
|
23
|
-
b_item = item.children('span.b')
|
24
|
-
|
25
|
-
a_item.show()
|
26
|
-
b_item.css('visibility', 'hidden')
|
27
|
-
item.find('.btn').off('click')
|
28
|
-
a_item.click -> showForm(event)
|
29
|
-
|
30
|
-
$ ->
|
31
|
-
$('span.a', '.title, .name, .description').click -> showForm @parentNode
|
@@ -1,20 +0,0 @@
|
|
1
|
-
@import "bootstrap/variables";
|
2
|
-
@import "bootstrap/mixins";
|
3
|
-
@import "bootstrap/reset";
|
4
|
-
|
5
|
-
@import "bootstrap/scaffolding";
|
6
|
-
@import "bootstrap/grid";
|
7
|
-
@import "bootstrap/layouts";
|
8
|
-
|
9
|
-
@import "bootstrap/navs";
|
10
|
-
@import "bootstrap/wells";
|
11
|
-
@import "bootstrap/forms";
|
12
|
-
@import "bootstrap/close";
|
13
|
-
@import "bootstrap/tables";
|
14
|
-
@import "bootstrap/navbar";
|
15
|
-
@import "bootstrap/dropdowns";
|
16
|
-
|
17
|
-
@import "bootstrap/alerts";
|
18
|
-
@import "bootstrap/buttons";
|
19
|
-
@import "bootstrap/button-groups";
|
20
|
-
|
@@ -1,47 +0,0 @@
|
|
1
|
-
.dropdown-menu{
|
2
|
-
min-width: 130px;
|
3
|
-
left: -35px;
|
4
|
-
}
|
5
|
-
|
6
|
-
.section{
|
7
|
-
position: relative;
|
8
|
-
margin-bottom: 15px;
|
9
|
-
padding-bottom: 15px;
|
10
|
-
border-bottom: 1px solid Gray;
|
11
|
-
|
12
|
-
h3 {
|
13
|
-
color: #222222;
|
14
|
-
padding: 10px;
|
15
|
-
border-radius: 3px;
|
16
|
-
background: #a7dded;
|
17
|
-
}
|
18
|
-
.delete {
|
19
|
-
position: absolute;
|
20
|
-
top: 8px;
|
21
|
-
right: 5px;
|
22
|
-
}
|
23
|
-
.rule {
|
24
|
-
background: red;
|
25
|
-
position: relative;
|
26
|
-
padding: 7px;
|
27
|
-
border-radius: 3px;
|
28
|
-
margin-bottom: 10px;
|
29
|
-
background: #f9f9f9;
|
30
|
-
|
31
|
-
&:hover {
|
32
|
-
cursor: pointer;
|
33
|
-
background: #efefef;
|
34
|
-
}
|
35
|
-
|
36
|
-
h4 {
|
37
|
-
margin: 0;
|
38
|
-
padding: 0;
|
39
|
-
}
|
40
|
-
|
41
|
-
.controls {
|
42
|
-
position: absolute;
|
43
|
-
top: 2px;
|
44
|
-
right: 0px;
|
45
|
-
}
|
46
|
-
}
|
47
|
-
}
|
@@ -1,18 +0,0 @@
|
|
1
|
-
module TheRoleController
|
2
|
-
private
|
3
|
-
|
4
|
-
def role_access_denied
|
5
|
-
flash[:error] = t('the_role.access_denied')
|
6
|
-
redirect_to '/'
|
7
|
-
end
|
8
|
-
|
9
|
-
def role_required
|
10
|
-
role_access_denied unless current_user.has_role?(controller_path, action_name)
|
11
|
-
end
|
12
|
-
|
13
|
-
def owner_required
|
14
|
-
# TheRole: You should define OWNER CHECK OBJECT
|
15
|
-
# When editable object was found
|
16
|
-
role_access_denied unless current_user.owner?(@owner_check_object)
|
17
|
-
end
|
18
|
-
end
|