adeia 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +3 -0
- data/Rakefile +1 -1
- data/app/models/adeia/action.rb +4 -1
- data/app/models/adeia/element.rb +2 -0
- data/app/models/adeia/group.rb +4 -1
- data/app/models/adeia/permission.rb +27 -1
- data/app/models/adeia/token.rb +12 -0
- data/config/locales/en.yml +4 -1
- data/config/locales/fr.yml +4 -1
- data/db/migrate/20151003150524_create_adeia_tokens.rb +1 -1
- data/lib/adeia/authorization.rb +19 -8
- data/lib/adeia/controller_methods.rb +2 -2
- data/lib/adeia/controller_resource.rb +8 -5
- data/lib/adeia/database.rb +19 -8
- data/lib/adeia/engine.rb +7 -0
- data/lib/adeia/version.rb +1 -1
- data/spec/authorization_spec.rb +162 -0
- data/spec/controllers/articles_controller_spec.rb +123 -0
- data/spec/factories.rb +53 -0
- data/spec/rails_helper.rb +19 -0
- data/spec/spec_helper.rb +19 -0
- data/spec/support/spec_login_helper.rb +18 -0
- data/{test/dummy → spec/test_app}/Rakefile +0 -0
- data/{test/dummy → spec/test_app}/app/assets/javascripts/application.js +0 -0
- data/{test/dummy → spec/test_app}/app/assets/javascripts/sessions.js +0 -0
- data/{test/dummy → spec/test_app}/app/assets/stylesheets/application.css +0 -0
- data/{test/dummy → spec/test_app}/app/assets/stylesheets/scaffold.css +0 -0
- data/{test/dummy → spec/test_app}/app/assets/stylesheets/sessions.css +0 -0
- data/{test/dummy → spec/test_app}/app/controllers/application_controller.rb +0 -0
- data/{test/dummy → spec/test_app}/app/controllers/articles_controller.rb +4 -11
- data/{test/dummy → spec/test_app}/app/controllers/sessions_controller.rb +1 -1
- data/{test/dummy → spec/test_app}/app/helpers/application_helper.rb +0 -0
- data/{test/dummy → spec/test_app}/app/helpers/sessions_helper.rb +0 -0
- data/{test/dummy → spec/test_app}/app/models/article.rb +0 -0
- data/{test/dummy → spec/test_app}/app/models/user.rb +0 -0
- data/{test/dummy → spec/test_app}/app/views/articles/_form.html.erb +0 -0
- data/{test/dummy → spec/test_app}/app/views/articles/edit.html.erb +0 -0
- data/{test/dummy → spec/test_app}/app/views/articles/index.html.erb +0 -0
- data/{test/dummy → spec/test_app}/app/views/articles/new.html.erb +0 -0
- data/{test/dummy → spec/test_app}/app/views/articles/show.html.erb +0 -0
- data/{test/dummy → spec/test_app}/app/views/layouts/application.html.erb +1 -1
- data/{test/dummy → spec/test_app}/app/views/sessions/new.html.erb +0 -0
- data/{test/dummy → spec/test_app}/bin/bundle +0 -0
- data/{test/dummy → spec/test_app}/bin/rails +0 -0
- data/{test/dummy → spec/test_app}/bin/rake +0 -0
- data/{test/dummy → spec/test_app}/bin/setup +0 -0
- data/{test/dummy → spec/test_app}/config.ru +0 -0
- data/{test/dummy → spec/test_app}/config/application.rb +0 -0
- data/{test/dummy → spec/test_app}/config/boot.rb +0 -0
- data/{test/dummy → spec/test_app}/config/database.yml +0 -0
- data/{test/dummy → spec/test_app}/config/environment.rb +0 -0
- data/{test/dummy → spec/test_app}/config/environments/development.rb +0 -0
- data/{test/dummy → spec/test_app}/config/environments/production.rb +0 -0
- data/{test/dummy → spec/test_app}/config/environments/test.rb +0 -0
- data/{test/dummy → spec/test_app}/config/initializers/assets.rb +0 -0
- data/{test/dummy → spec/test_app}/config/initializers/backtrace_silencers.rb +0 -0
- data/{test/dummy → spec/test_app}/config/initializers/cookies_serializer.rb +0 -0
- data/{test/dummy → spec/test_app}/config/initializers/filter_parameter_logging.rb +0 -0
- data/{test/dummy → spec/test_app}/config/initializers/inflections.rb +0 -0
- data/{test/dummy → spec/test_app}/config/initializers/mime_types.rb +0 -0
- data/{test/dummy → spec/test_app}/config/initializers/session_store.rb +0 -0
- data/{test/dummy → spec/test_app}/config/initializers/wrap_parameters.rb +0 -0
- data/{test/dummy → spec/test_app}/config/locales/en.yml +0 -0
- data/{test/dummy → spec/test_app}/config/routes.rb +1 -1
- data/{test/dummy → spec/test_app}/config/secrets.yml +0 -0
- data/{test/dummy → spec/test_app}/db/development.sqlite3 +0 -0
- data/{test/dummy/db/migrate/20150930161522_create_users.rb → spec/test_app/db/migrate/20151012185720_create_users.rb} +1 -1
- data/{test/dummy/db/migrate/20150930161532_create_articles.rb → spec/test_app/db/migrate/20151012185726_create_articles.rb} +1 -1
- data/{test/dummy → spec/test_app}/db/schema.rb +2 -2
- data/spec/test_app/db/test.sqlite3 +0 -0
- data/{test/dummy → spec/test_app}/lib/tasks/init.rake +0 -0
- data/{test/dummy → spec/test_app}/log/development.log +1314 -0
- data/spec/test_app/log/test.log +24709 -0
- data/{test/dummy → spec/test_app}/public/404.html +0 -0
- data/{test/dummy → spec/test_app}/public/422.html +0 -0
- data/{test/dummy → spec/test_app}/public/500.html +0 -0
- data/{test/dummy → spec/test_app}/public/favicon.ico +0 -0
- data/{test/dummy → spec/test_app}/tmp/cache/assets/development/sprockets/v3.0/007YZnzCZDb7P0xbxiEkmAM6-xSsxmYu_W7vnrvcDOs.cache +0 -0
- data/{test/dummy → spec/test_app}/tmp/cache/assets/development/sprockets/v3.0/1GiUoKAP-7ewZyzr_eCTMX0R8ML5Z_VN2bfQ05RAW30.cache +0 -0
- data/{test/dummy → spec/test_app}/tmp/cache/assets/development/sprockets/v3.0/5Lly_CA8DZvPhQV2jDQx-Y6P_y3Ygra9t5jfSlGhHDA.cache +0 -0
- data/{test/dummy → spec/test_app}/tmp/cache/assets/development/sprockets/v3.0/6n6yNyR4eQhIVjw5Anxur-SLgdDc_rzuMuZKj6Q4FqE.cache +0 -0
- data/{test/dummy → spec/test_app}/tmp/cache/assets/development/sprockets/v3.0/80nWjD2uxLBuIN1R5NawmTsgZWCB6nln8WXf_5gHri4.cache +0 -0
- data/{test/dummy → spec/test_app}/tmp/cache/assets/development/sprockets/v3.0/9Fw_WnCC15QnXUQZ4eYTYLOBv20at5Z5gL-WJx_QsR4.cache +0 -0
- data/{test/dummy → spec/test_app}/tmp/cache/assets/development/sprockets/v3.0/D4VyPOMG_wXgPRZtj-mbRdONJXbdgOZKcuwSm-lNNIA.cache +0 -0
- data/{test/dummy → spec/test_app}/tmp/cache/assets/development/sprockets/v3.0/DmmfrCpXtt74Hr6NO54lxyOCDv6klnDyBqeDFR7oDU8.cache +0 -0
- data/{test/dummy → spec/test_app}/tmp/cache/assets/development/sprockets/v3.0/HggfmBmV-rmvrvzJjqvjmDpwB2BTEQvh6krp0CcrI0U.cache +0 -0
- data/{test/dummy → spec/test_app}/tmp/cache/assets/development/sprockets/v3.0/OI6uxGcnsKavdWTtwDAasU3wPx8QXhzBgV0X2n1KjMQ.cache +0 -0
- data/{test/dummy → spec/test_app}/tmp/cache/assets/development/sprockets/v3.0/P1NOTKHlk-FIwqlw0wiyLanpgNyubwQi850S1aonsbQ.cache +0 -0
- data/{test/dummy → spec/test_app}/tmp/cache/assets/development/sprockets/v3.0/PKcbfub75wwU6UzvVnSMFn_6wsaaPUoXMtWTnyyh5jM.cache +0 -0
- data/{test/dummy → spec/test_app}/tmp/cache/assets/development/sprockets/v3.0/S4dXPkh6wlupsMUb-GvZ2Q5PwAZmplTCkViWCnVWWw0.cache +0 -0
- data/{test/dummy → spec/test_app}/tmp/cache/assets/development/sprockets/v3.0/UuBE6kIOXtWOmnrnywPI98bzHE-L84SteUEfzexxVtA.cache +0 -0
- data/{test/dummy → spec/test_app}/tmp/cache/assets/development/sprockets/v3.0/Xa5LZJIrW7sSuOWWFwCAhDkDQ71pA_cHp6H5kiTZS6E.cache +0 -0
- data/{test/dummy → spec/test_app}/tmp/cache/assets/development/sprockets/v3.0/eQqoU12FSWEA4BsL-PjwTnIUr1bZsu27SOzFHPomG4c.cache +0 -0
- data/{test/dummy → spec/test_app}/tmp/cache/assets/development/sprockets/v3.0/f3V_hqqK4rH7Z51LFX1Wk9hrWGjYABTZmgSeYvWKgLs.cache +0 -0
- data/{test/dummy → spec/test_app}/tmp/cache/assets/development/sprockets/v3.0/gXIpNlfbH4G7-D0grgt2EuWuwHwTymznc1rlxJ1-C0A.cache +0 -0
- data/{test/dummy → spec/test_app}/tmp/cache/assets/development/sprockets/v3.0/hX4wt6FzyI47gW66iiVyl2C722yfwvx3KafFEYkreEY.cache +0 -0
- data/{test/dummy → spec/test_app}/tmp/cache/assets/development/sprockets/v3.0/hZi1k6tpxxCGYxRe7zY74ItcOI8gZrREOpGuA8JSpGg.cache +0 -0
- data/spec/test_app/tmp/cache/assets/development/sprockets/v3.0/m36EDdApBppvyoX6m8cNCOm1eyt7pipkfASRya0sKqM.cache +1 -0
- data/{test/dummy → spec/test_app}/tmp/cache/assets/development/sprockets/v3.0/nZCCAAO-XWnPS2Xr9yss0VhSONvnR3emOuEIc_b-1OY.cache +0 -0
- data/{test/dummy → spec/test_app}/tmp/cache/assets/development/sprockets/v3.0/pEhaat2KBd5SrT7szC_8R1_6hK17FTpvoRFkmCRSD3M.cache +0 -0
- data/{test/dummy → spec/test_app}/tmp/cache/assets/development/sprockets/v3.0/r5qzpye5vWgzwRnRhhSYkUslyNZ11pyYXQZqGe8o930.cache +0 -0
- data/{test/dummy → spec/test_app}/tmp/cache/assets/development/sprockets/v3.0/t0GCJAJcd_7X2F172TjwwDZ6rfNJc2FRbDTV5-jSqY0.cache +0 -0
- data/{test/dummy → spec/test_app}/tmp/cache/assets/development/sprockets/v3.0/t92Y0f7B0gH-r5W-iNadtkzgjm8gxyEyttnY6AWpdmw.cache +0 -0
- data/{test/dummy → spec/test_app}/tmp/cache/assets/development/sprockets/v3.0/tYGZjTIGEDMySqV7qHf43dq0_aB7TuSEhhZtN_9xW54.cache +0 -0
- data/{test/dummy → spec/test_app}/tmp/cache/assets/development/sprockets/v3.0/wMjI0_cDi3gmsOV5xXr-QPQOfHCB_qea8St_udeflhE.cache +0 -0
- data/{test/dummy → spec/test_app}/tmp/cache/assets/development/sprockets/v3.0/z2mRCA3647ZviK5pXi1_qLwdxkiCaoIfZj7jHoMfLiI.cache +0 -0
- data/spec/test_app/tmp/pids/server.pid +1 -0
- data/spec/validations_spec.rb +37 -0
- metadata +219 -194
- data/test/dummy/db/migrate/20151003145900_create_adeia_elements.adeia.rb +0 -10
- data/test/dummy/db/migrate/20151003145901_create_adeia_permissions.adeia.rb +0 -17
- data/test/dummy/db/migrate/20151003145902_create_adeia_groups.adeia.rb +0 -10
- data/test/dummy/db/migrate/20151003145903_create_adeia_group_users.adeia.rb +0 -11
- data/test/dummy/db/migrate/20151003150941_create_adeia_tokens.adeia.rb +0 -13
- data/test/dummy/db/migrate/20151003150942_create_adeia_actions.adeia.rb +0 -10
- data/test/dummy/db/migrate/20151003150943_create_adeia_action_permissions.adeia.rb +0 -11
- data/test/dummy/test/controllers/articles_controller_test.rb +0 -49
- data/test/dummy/test/controllers/sessions_controller_test.rb +0 -7
- data/test/dummy/test/controllers/users_controller_test.rb +0 -49
- data/test/dummy/test/fixtures/articles.yml +0 -11
- data/test/dummy/test/fixtures/users.yml +0 -9
- data/test/dummy/test/models/article_test.rb +0 -7
- data/test/dummy/test/models/user_test.rb +0 -7
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
require "rails_helper"
|
|
2
|
+
|
|
3
|
+
describe ArticlesController, :type => :controller do
|
|
4
|
+
before(:each) do
|
|
5
|
+
@user = User.create!(name: "admin", password: "12341", password_confirmation: "12341")
|
|
6
|
+
sign_in @user
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
describe "GET #index" do
|
|
10
|
+
|
|
11
|
+
describe "response" do
|
|
12
|
+
before(:each) { create(:permission, element_name: "articles", read_right: true, owner: @user) }
|
|
13
|
+
|
|
14
|
+
it "responds successfully" do
|
|
15
|
+
get :index
|
|
16
|
+
expect(response).to be_success
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
it "loads the records" do
|
|
20
|
+
get :index
|
|
21
|
+
expect(assigns(:articles)).not_to be_nil
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
describe "records loading" do
|
|
27
|
+
|
|
28
|
+
context "with an 'all_entries' permission" do
|
|
29
|
+
|
|
30
|
+
it "loads all the entries" do
|
|
31
|
+
create(:permission, element_name: "articles", read_right: true, owner: @user)
|
|
32
|
+
create_list(:article, 5)
|
|
33
|
+
get :index
|
|
34
|
+
expect(assigns(:articles)).to eq Article.all
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
context "with an 'on_ownerships' permission" do
|
|
40
|
+
before(:each) do
|
|
41
|
+
create(:permission, element_name: "articles", type_name: "on_ownerships", read_right: true, owner: @user)
|
|
42
|
+
@own_articles = create_list(:article, 5, user: @user)
|
|
43
|
+
create_list(:article, 5)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
it "loads the owned articles" do
|
|
47
|
+
get :index
|
|
48
|
+
expect(assigns(:articles)).to eq @own_articles
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
it "loads the owned articles and also the specific ones" do
|
|
52
|
+
specific_article = create(:article)
|
|
53
|
+
create(:permission, element_name: "articles", type_name: "on_entry", resource_id: specific_article.id, read_right: true, owner: @user)
|
|
54
|
+
get :index
|
|
55
|
+
expect(assigns(:articles)).to match_array(@own_articles << specific_article)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
context "with an 'on_entry' permission" do
|
|
61
|
+
|
|
62
|
+
it "loads the specific articles" do
|
|
63
|
+
first_article = create(:article)
|
|
64
|
+
second_article = create(:article)
|
|
65
|
+
create_list(:article, 5)
|
|
66
|
+
create(:permission, element_name: "articles", type_name: "on_entry", resource_id: first_article.id, read_right: true, owner: @user)
|
|
67
|
+
create(:permission, element_name: "articles", type_name: "on_entry", resource_id: second_article.id, read_right: true, owner: @user)
|
|
68
|
+
get :index
|
|
69
|
+
expect(assigns(:articles)).to match_array [first_article, second_article]
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
describe "GET #show" do
|
|
77
|
+
before(:each) do
|
|
78
|
+
create(:permission, element_name: "articles", read_right: true, owner: @user)
|
|
79
|
+
@article = create(:article)
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
it "responds successfully" do
|
|
83
|
+
get :show, id: @article.id
|
|
84
|
+
expect(response).to be_success
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
it "loads the record" do
|
|
88
|
+
get :show, id: @article.id
|
|
89
|
+
expect(assigns(:article)).to eq @article
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
describe "GET #new" do
|
|
95
|
+
before(:each) { create(:permission, element_name: "articles", create_right: true, owner: @user) }
|
|
96
|
+
|
|
97
|
+
it "responds successfully" do
|
|
98
|
+
get :new
|
|
99
|
+
expect(response).to be_success
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
describe "GET #edit" do
|
|
105
|
+
before(:each) do
|
|
106
|
+
create(:permission, element_name: "articles", update_right: true, owner: @user)
|
|
107
|
+
@article = create(:article)
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
it "responds successfully" do
|
|
111
|
+
get :edit, id: @article.id
|
|
112
|
+
expect(response).to be_success
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
it "loads the record" do
|
|
116
|
+
get :edit, id: @article.id
|
|
117
|
+
expect(assigns(:article)).to eq @article
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
end
|
|
123
|
+
end
|
data/spec/factories.rb
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
FactoryGirl.define do
|
|
2
|
+
|
|
3
|
+
factory :token, class: "Adeia::Token" do
|
|
4
|
+
token { SecureRandom.urlsafe_base64 }
|
|
5
|
+
is_valid true
|
|
6
|
+
permission { create(:permission) }
|
|
7
|
+
exp_at { 1.month.from_now }
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
factory :permission, class: "Adeia::Permission" do
|
|
11
|
+
transient do
|
|
12
|
+
element_name 'admin/articles'
|
|
13
|
+
group_name "admin"
|
|
14
|
+
type_name 'all_entries'
|
|
15
|
+
action 'share'
|
|
16
|
+
end
|
|
17
|
+
element { Adeia::Element.find_or_create_by(name: element_name) }
|
|
18
|
+
owner { Adeia::Group.find_by_name(group_name) || create(:group, name: group_name) }
|
|
19
|
+
|
|
20
|
+
permission_type { Adeia::Permission.permission_types[type_name] }
|
|
21
|
+
|
|
22
|
+
resource_id nil
|
|
23
|
+
read_right false
|
|
24
|
+
create_right false
|
|
25
|
+
update_right false
|
|
26
|
+
destroy_right false
|
|
27
|
+
actions {[ Adeia::Action.find_or_create_by(name: action) ]}
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
factory :group, class: "Adeia::Group" do
|
|
31
|
+
name "admin"
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
factory :user_group, class: "Adeia::GroupUser" do
|
|
35
|
+
group { Adeia::Group.find_by_name("admin") || create(:group) }
|
|
36
|
+
user { nil }
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
### Test App factories
|
|
40
|
+
|
|
41
|
+
factory :user do
|
|
42
|
+
name "admin"
|
|
43
|
+
password "12341"
|
|
44
|
+
password_confirmation "12341"
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
factory :article do
|
|
48
|
+
title "Des ours meurt chaque année"
|
|
49
|
+
content "Chaque année, plus de 1000 ourse blancs meurt"
|
|
50
|
+
user { User.find_by_name("editor") || create(:user, name: "editor") }
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
|
2
|
+
ENV['RAILS_ENV'] ||= 'test'
|
|
3
|
+
require File.expand_path("../../spec/test_app/config/environment.rb", __FILE__)
|
|
4
|
+
# Prevent database truncation if the environment is production
|
|
5
|
+
abort("The Rails environment is running in production mode!") if Rails.env.production?
|
|
6
|
+
require 'spec_helper'
|
|
7
|
+
require 'rspec/rails'
|
|
8
|
+
|
|
9
|
+
#Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
|
|
10
|
+
Dir[File.join(File.dirname(__FILE__), 'support/**/*.rb')].each { |f| require f }
|
|
11
|
+
|
|
12
|
+
ActiveRecord::Migration.maintain_test_schema!
|
|
13
|
+
|
|
14
|
+
RSpec.configure do |config|
|
|
15
|
+
|
|
16
|
+
config.use_transactional_fixtures = true
|
|
17
|
+
|
|
18
|
+
config.infer_spec_type_from_file_location!
|
|
19
|
+
end
|
data/spec/spec_helper.rb
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
require 'factory_girl_rails'
|
|
2
|
+
require 'rspec/active_model/mocks'
|
|
3
|
+
|
|
4
|
+
FactoryGirl.definition_file_paths = [ File.join(File.dirname(__FILE__), '../spec/factories') ]
|
|
5
|
+
FactoryGirl.find_definitions
|
|
6
|
+
|
|
7
|
+
RSpec.configure do |config|
|
|
8
|
+
|
|
9
|
+
config.expect_with :rspec do |expectations|
|
|
10
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
config.mock_with :rspec do |mocks|
|
|
14
|
+
mocks.verify_partial_doubles = true
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
config.include FactoryGirl::Syntax::Methods
|
|
18
|
+
|
|
19
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module SpecLoginHelper
|
|
2
|
+
def sign_in(user)
|
|
3
|
+
request.cookies[:remember_token] = user.remember_token
|
|
4
|
+
self.current_user = user
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
def current_user
|
|
8
|
+
@current_user ||= User.users.find_by_remember_token(request.cookies[:remember_token])
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def current_user=(user)
|
|
12
|
+
@current_user = user
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
RSpec.configure do |config|
|
|
17
|
+
config.include SpecLoginHelper
|
|
18
|
+
end
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,23 +1,20 @@
|
|
|
1
1
|
class ArticlesController < ApplicationController
|
|
2
|
-
|
|
3
|
-
load_and_authorize
|
|
2
|
+
load_and_authorize only: [:edit]
|
|
4
3
|
|
|
5
4
|
def index
|
|
6
|
-
|
|
7
|
-
#authorize_and_load_records!
|
|
5
|
+
authorize_and_load_records!
|
|
8
6
|
end
|
|
9
7
|
|
|
10
8
|
def show
|
|
11
|
-
|
|
9
|
+
load_and_authorize!
|
|
12
10
|
end
|
|
13
11
|
|
|
14
12
|
def new
|
|
15
|
-
|
|
13
|
+
authorize!
|
|
16
14
|
@article = Article.new
|
|
17
15
|
end
|
|
18
16
|
|
|
19
17
|
def edit
|
|
20
|
-
#load_and_authorize!
|
|
21
18
|
end
|
|
22
19
|
|
|
23
20
|
def create
|
|
@@ -45,10 +42,6 @@ class ArticlesController < ApplicationController
|
|
|
45
42
|
|
|
46
43
|
private
|
|
47
44
|
|
|
48
|
-
def set_article
|
|
49
|
-
@article = Article.find(params[:id])
|
|
50
|
-
end
|
|
51
|
-
|
|
52
45
|
def article_params
|
|
53
46
|
params.require(:article).permit(:title, :content)
|
|
54
47
|
end
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
Binary file
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
#
|
|
12
12
|
# It's strongly recommended that you check this file into your version control system.
|
|
13
13
|
|
|
14
|
-
ActiveRecord::Schema.define(version:
|
|
14
|
+
ActiveRecord::Schema.define(version: 20151012185726) do
|
|
15
15
|
|
|
16
16
|
create_table "adeia_action_permissions", force: :cascade do |t|
|
|
17
17
|
t.integer "action_id"
|
|
@@ -70,7 +70,7 @@ ActiveRecord::Schema.define(version: 20151003150943) do
|
|
|
70
70
|
|
|
71
71
|
create_table "adeia_tokens", force: :cascade do |t|
|
|
72
72
|
t.string "token"
|
|
73
|
-
t.boolean "
|
|
73
|
+
t.boolean "is_valid"
|
|
74
74
|
t.integer "permission_id"
|
|
75
75
|
t.date "exp_at"
|
|
76
76
|
t.datetime "created_at", null: false
|
|
Binary file
|
|
File without changes
|