admission 0.2.8 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/Gemfile +2 -1
- data/README.md +24 -2
- data/examples/rails5_feudalism/.gitignore +19 -0
- data/examples/rails5_feudalism/.ruby-version +1 -0
- data/examples/rails5_feudalism/Gemfile +52 -0
- data/examples/rails5_feudalism/README.md +17 -0
- data/examples/rails5_feudalism/Rakefile +6 -0
- data/examples/rails5_feudalism/app/assets/config/manifest.js +3 -0
- data/examples/rails5_feudalism/app/assets/images/.keep +0 -0
- data/examples/rails5_feudalism/app/assets/javascripts/application.js +15 -0
- data/examples/rails5_feudalism/app/assets/stylesheets/application.css +15 -0
- data/examples/rails5_feudalism/app/assets/stylesheets/scaffolds.scss +84 -0
- data/examples/rails5_feudalism/app/controllers/application_controller.rb +13 -0
- data/examples/rails5_feudalism/app/controllers/concerns/.keep +0 -0
- data/examples/rails5_feudalism/app/controllers/users_controller.rb +75 -0
- data/examples/rails5_feudalism/app/helpers/application_helper.rb +2 -0
- data/examples/rails5_feudalism/app/jobs/application_job.rb +2 -0
- data/examples/rails5_feudalism/app/models/application_record.rb +3 -0
- data/examples/rails5_feudalism/app/models/concerns/.keep +0 -0
- data/examples/rails5_feudalism/app/models/person.rb +11 -0
- data/examples/rails5_feudalism/app/models/possession.rb +7 -0
- data/examples/rails5_feudalism/app/models/trait.rb +7 -0
- data/examples/rails5_feudalism/app/models/user.rb +17 -0
- data/examples/rails5_feudalism/app/models/user_status.rb +140 -0
- data/examples/rails5_feudalism/app/views/admission/forbidden.html.erb +14 -0
- data/examples/rails5_feudalism/app/views/layouts/application.html.erb +15 -0
- data/examples/rails5_feudalism/app/views/users/_form.html.erb +19 -0
- data/examples/rails5_feudalism/app/views/users/_privilege_row.html.erb +24 -0
- data/examples/rails5_feudalism/app/views/users/_privileges_list.html.erb +51 -0
- data/examples/rails5_feudalism/app/views/users/edit.html.erb +6 -0
- data/examples/rails5_feudalism/app/views/users/index.html.erb +25 -0
- data/examples/rails5_feudalism/app/views/users/new.html.erb +5 -0
- data/examples/rails5_feudalism/app/views/users/show.html.erb +4 -0
- data/examples/rails5_feudalism/bin/bundle +3 -0
- data/examples/rails5_feudalism/bin/rails +9 -0
- data/examples/rails5_feudalism/bin/rake +9 -0
- data/examples/rails5_feudalism/bin/setup +38 -0
- data/examples/rails5_feudalism/bin/spring +17 -0
- data/examples/rails5_feudalism/bin/update +29 -0
- data/examples/rails5_feudalism/bin/yarn +11 -0
- data/examples/rails5_feudalism/config.ru +5 -0
- data/examples/rails5_feudalism/config/application.rb +28 -0
- data/examples/rails5_feudalism/config/boot.rb +3 -0
- data/examples/rails5_feudalism/config/database.yml +85 -0
- data/examples/rails5_feudalism/config/environment.rb +5 -0
- data/examples/rails5_feudalism/config/environments/development.rb +49 -0
- data/examples/rails5_feudalism/config/environments/production.rb +82 -0
- data/examples/rails5_feudalism/config/environments/test.rb +36 -0
- data/examples/rails5_feudalism/config/initializers/application_controller_renderer.rb +8 -0
- data/examples/rails5_feudalism/config/initializers/assets.rb +14 -0
- data/examples/rails5_feudalism/config/initializers/backtrace_silencers.rb +7 -0
- data/examples/rails5_feudalism/config/initializers/cookies_serializer.rb +5 -0
- data/examples/rails5_feudalism/config/initializers/filter_parameter_logging.rb +4 -0
- data/examples/rails5_feudalism/config/initializers/inflections.rb +16 -0
- data/examples/rails5_feudalism/config/initializers/mime_types.rb +4 -0
- data/examples/rails5_feudalism/config/initializers/wrap_parameters.rb +14 -0
- data/examples/rails5_feudalism/config/locales/en.yml +33 -0
- data/examples/rails5_feudalism/config/puma.rb +56 -0
- data/examples/rails5_feudalism/config/routes.rb +8 -0
- data/examples/rails5_feudalism/config/secrets.yml +32 -0
- data/examples/rails5_feudalism/config/spring.rb +6 -0
- data/examples/rails5_feudalism/db/migrate/20171018085629_create_users.rb +9 -0
- data/examples/rails5_feudalism/db/migrate/20171019082044_create_people.rb +9 -0
- data/examples/rails5_feudalism/db/migrate/20171019082055_create_possessions.rb +9 -0
- data/examples/rails5_feudalism/db/migrate/20171019082059_create_traits.rb +9 -0
- data/examples/rails5_feudalism/db/schema.rb +49 -0
- data/examples/rails5_feudalism/db/seeds.rb +7 -0
- data/examples/rails5_feudalism/lib/assets/.keep +0 -0
- data/examples/rails5_feudalism/lib/tasks/.keep +0 -0
- data/examples/rails5_feudalism/log/.keep +0 -0
- data/examples/rails5_feudalism/package.json +7 -0
- data/examples/rails5_feudalism/public/404.html +67 -0
- data/examples/rails5_feudalism/public/422.html +67 -0
- data/examples/rails5_feudalism/public/500.html +66 -0
- data/examples/rails5_feudalism/public/apple-touch-icon-precomposed.png +0 -0
- data/examples/rails5_feudalism/public/apple-touch-icon.png +0 -0
- data/examples/rails5_feudalism/public/favicon.ico +0 -0
- data/examples/rails5_feudalism/public/robots.txt +1 -0
- data/examples/rails5_feudalism/test/application_system_test_case.rb +5 -0
- data/examples/rails5_feudalism/test/controllers/.keep +0 -0
- data/examples/rails5_feudalism/test/fixtures/.keep +0 -0
- data/examples/rails5_feudalism/test/fixtures/files/.keep +0 -0
- data/examples/rails5_feudalism/test/fixtures/people.yml +36 -0
- data/examples/rails5_feudalism/test/fixtures/possessions.yml +0 -0
- data/examples/rails5_feudalism/test/fixtures/traits.yml +0 -0
- data/examples/rails5_feudalism/test/fixtures/users.yml +0 -0
- data/examples/rails5_feudalism/test/helpers/.keep +0 -0
- data/examples/rails5_feudalism/test/models/.keep +0 -0
- data/examples/rails5_feudalism/test/models/user_status/rules_test.rb +152 -0
- data/examples/rails5_feudalism/test/models/user_status/user_status_test.rb +50 -0
- data/examples/rails5_feudalism/test/system/.keep +0 -0
- data/examples/rails5_feudalism/test/test_helper.rb +9 -0
- data/examples/rails5_feudalism/tmp/.keep +0 -0
- data/examples/rails5_feudalism/vendor/.keep +0 -0
- data/examples/rails5_feudalism/yarn.lock +7 -0
- data/lib/admission.rb +2 -0
- data/lib/admission/admission.rb +8 -2
- data/lib/admission/arbitration.rb +5 -0
- data/lib/admission/denied.rb +4 -5
- data/lib/admission/index.rb +59 -0
- data/lib/admission/minitest.rb +41 -0
- data/lib/admission/privilege.rb +13 -3
- data/lib/admission/rails.rb +8 -94
- data/lib/admission/rails/action_admission.rb +73 -0
- data/lib/admission/rails/controller_addon.rb +40 -0
- data/lib/admission/rails/scope_not_defined.rb +21 -0
- data/lib/admission/rails/scope_resolver.rb +46 -0
- data/lib/admission/resource_arbitration.rb +14 -9
- data/lib/admission/status.rb +11 -2
- data/lib/admission/tests.rb +59 -0
- data/lib/admission/version.rb +1 -1
- data/spec/integration/action_arbitrating_spec.rb +1 -1
- data/spec/integration/resource_arbitrating_spec.rb +1 -1
- data/spec/rspec_config.rb +13 -13
- data/spec/spec_helper.rb +10 -2
- data/spec/test_context/index.rb +0 -2
- data/spec/unit/arbitration_spec.rb +33 -0
- data/spec/unit/index_spec.rb +144 -0
- data/spec/unit/privilege/order_definer_spec.rb +1 -1
- data/spec/unit/privilege_spec.rb +22 -5
- data/spec/unit/rails/action_admission_spec.rb +188 -0
- data/spec/unit/rails/controller_addon_spec.rb +68 -0
- data/spec/unit/rails/scope_resolver_spec.rb +72 -0
- data/spec/unit/resource_arbitration_spec.rb +36 -1
- data/spec/unit/status_spec.rb +1 -1
- metadata +108 -5
- data/spec/integration/_helper.rb +0 -2
- data/spec/unit/_helper.rb +0 -1
@@ -0,0 +1,32 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Your secret key is used for verifying the integrity of signed cookies.
|
4
|
+
# If you change this key, all old signed cookies will become invalid!
|
5
|
+
|
6
|
+
# Make sure the secret is at least 30 characters and all random,
|
7
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
8
|
+
# You can use `rails secret` to generate a secure secret key.
|
9
|
+
|
10
|
+
# Make sure the secrets in this file are kept private
|
11
|
+
# if you're sharing your code publicly.
|
12
|
+
|
13
|
+
# Shared secrets are available across all environments.
|
14
|
+
|
15
|
+
# shared:
|
16
|
+
# api_key: a1B2c3D4e5F6
|
17
|
+
|
18
|
+
# Environmental secrets are only available for that specific environment.
|
19
|
+
|
20
|
+
development:
|
21
|
+
secret_key_base: f53458c4ced664cb12c8a2e4a3122306cae942889441ee2ddeb4489114bff00383845913d51a6ab420a045521accaa47b16564777608223407aa389bf052d88d
|
22
|
+
|
23
|
+
test:
|
24
|
+
secret_key_base: 93a915ecd05ac5a8d7ee48bb03212410f5287df04d33f293f1a40d11804875edbd42fdc17d93e111371cde7ac9301271188785ff0f40eab8656fbfbc93f33347
|
25
|
+
|
26
|
+
# Do not keep production secrets in the unencrypted secrets file.
|
27
|
+
# Instead, either read values from the environment.
|
28
|
+
# Or, use `bin/rails secrets:setup` to configure encrypted secrets
|
29
|
+
# and move the `production:` environment over there.
|
30
|
+
|
31
|
+
production:
|
32
|
+
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# This file is auto-generated from the current state of the database. Instead
|
2
|
+
# of editing this file, please use the migrations feature of Active Record to
|
3
|
+
# incrementally modify your database, and then regenerate this schema definition.
|
4
|
+
#
|
5
|
+
# Note that this schema.rb definition is the authoritative source for your
|
6
|
+
# database schema. If you need to create the application database on another
|
7
|
+
# system, you should be using db:schema:load, not running all the migrations
|
8
|
+
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
9
|
+
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
10
|
+
#
|
11
|
+
# It's strongly recommended that you check this file into your version control system.
|
12
|
+
|
13
|
+
ActiveRecord::Schema.define(version: 20171019082059) do
|
14
|
+
|
15
|
+
# These are extensions that must be enabled in order to support this database
|
16
|
+
enable_extension "plpgsql"
|
17
|
+
|
18
|
+
create_table "people", force: :cascade do |t|
|
19
|
+
t.string "name", null: false
|
20
|
+
t.string "country", null: false
|
21
|
+
t.datetime "created_at", null: false
|
22
|
+
t.datetime "updated_at", null: false
|
23
|
+
end
|
24
|
+
|
25
|
+
create_table "possessions", force: :cascade do |t|
|
26
|
+
t.string "name", null: false
|
27
|
+
t.bigint "person_id", null: false
|
28
|
+
t.datetime "created_at", null: false
|
29
|
+
t.datetime "updated_at", null: false
|
30
|
+
t.index ["person_id"], name: "index_possessions_on_person_id"
|
31
|
+
end
|
32
|
+
|
33
|
+
create_table "traits", force: :cascade do |t|
|
34
|
+
t.string "name", null: false
|
35
|
+
t.bigint "person_id", null: false
|
36
|
+
t.datetime "created_at", null: false
|
37
|
+
t.datetime "updated_at", null: false
|
38
|
+
t.index ["person_id"], name: "index_traits_on_person_id"
|
39
|
+
end
|
40
|
+
|
41
|
+
create_table "users", force: :cascade do |t|
|
42
|
+
t.bigint "person_id", null: false
|
43
|
+
t.jsonb "privileges"
|
44
|
+
t.datetime "created_at", null: false
|
45
|
+
t.datetime "updated_at", null: false
|
46
|
+
t.index ["person_id"], name: "index_users_on_person_id"
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# This file should contain all the record creation needed to seed the database with its default values.
|
2
|
+
# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
|
3
|
+
#
|
4
|
+
# Examples:
|
5
|
+
#
|
6
|
+
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
|
7
|
+
# Character.create(name: 'Luke', movie: movies.first)
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,67 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The page you were looking for doesn't exist (404)</title>
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
+
<style>
|
7
|
+
.rails-default-error-page {
|
8
|
+
background-color: #EFEFEF;
|
9
|
+
color: #2E2F30;
|
10
|
+
text-align: center;
|
11
|
+
font-family: arial, sans-serif;
|
12
|
+
margin: 0;
|
13
|
+
}
|
14
|
+
|
15
|
+
.rails-default-error-page div.dialog {
|
16
|
+
width: 95%;
|
17
|
+
max-width: 33em;
|
18
|
+
margin: 4em auto 0;
|
19
|
+
}
|
20
|
+
|
21
|
+
.rails-default-error-page div.dialog > div {
|
22
|
+
border: 1px solid #CCC;
|
23
|
+
border-right-color: #999;
|
24
|
+
border-left-color: #999;
|
25
|
+
border-bottom-color: #BBB;
|
26
|
+
border-top: #B00100 solid 4px;
|
27
|
+
border-top-left-radius: 9px;
|
28
|
+
border-top-right-radius: 9px;
|
29
|
+
background-color: white;
|
30
|
+
padding: 7px 12% 0;
|
31
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
|
+
}
|
33
|
+
|
34
|
+
.rails-default-error-page h1 {
|
35
|
+
font-size: 100%;
|
36
|
+
color: #730E15;
|
37
|
+
line-height: 1.5em;
|
38
|
+
}
|
39
|
+
|
40
|
+
.rails-default-error-page div.dialog > p {
|
41
|
+
margin: 0 0 1em;
|
42
|
+
padding: 1em;
|
43
|
+
background-color: #F7F7F7;
|
44
|
+
border: 1px solid #CCC;
|
45
|
+
border-right-color: #999;
|
46
|
+
border-left-color: #999;
|
47
|
+
border-bottom-color: #999;
|
48
|
+
border-bottom-left-radius: 4px;
|
49
|
+
border-bottom-right-radius: 4px;
|
50
|
+
border-top-color: #DADADA;
|
51
|
+
color: #666;
|
52
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
53
|
+
}
|
54
|
+
</style>
|
55
|
+
</head>
|
56
|
+
|
57
|
+
<body class="rails-default-error-page">
|
58
|
+
<!-- This file lives in public/404.html -->
|
59
|
+
<div class="dialog">
|
60
|
+
<div>
|
61
|
+
<h1>The page you were looking for doesn't exist.</h1>
|
62
|
+
<p>You may have mistyped the address or the page may have moved.</p>
|
63
|
+
</div>
|
64
|
+
<p>If you are the application owner check the logs for more information.</p>
|
65
|
+
</div>
|
66
|
+
</body>
|
67
|
+
</html>
|
@@ -0,0 +1,67 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The change you wanted was rejected (422)</title>
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
+
<style>
|
7
|
+
.rails-default-error-page {
|
8
|
+
background-color: #EFEFEF;
|
9
|
+
color: #2E2F30;
|
10
|
+
text-align: center;
|
11
|
+
font-family: arial, sans-serif;
|
12
|
+
margin: 0;
|
13
|
+
}
|
14
|
+
|
15
|
+
.rails-default-error-page div.dialog {
|
16
|
+
width: 95%;
|
17
|
+
max-width: 33em;
|
18
|
+
margin: 4em auto 0;
|
19
|
+
}
|
20
|
+
|
21
|
+
.rails-default-error-page div.dialog > div {
|
22
|
+
border: 1px solid #CCC;
|
23
|
+
border-right-color: #999;
|
24
|
+
border-left-color: #999;
|
25
|
+
border-bottom-color: #BBB;
|
26
|
+
border-top: #B00100 solid 4px;
|
27
|
+
border-top-left-radius: 9px;
|
28
|
+
border-top-right-radius: 9px;
|
29
|
+
background-color: white;
|
30
|
+
padding: 7px 12% 0;
|
31
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
|
+
}
|
33
|
+
|
34
|
+
.rails-default-error-page h1 {
|
35
|
+
font-size: 100%;
|
36
|
+
color: #730E15;
|
37
|
+
line-height: 1.5em;
|
38
|
+
}
|
39
|
+
|
40
|
+
.rails-default-error-page div.dialog > p {
|
41
|
+
margin: 0 0 1em;
|
42
|
+
padding: 1em;
|
43
|
+
background-color: #F7F7F7;
|
44
|
+
border: 1px solid #CCC;
|
45
|
+
border-right-color: #999;
|
46
|
+
border-left-color: #999;
|
47
|
+
border-bottom-color: #999;
|
48
|
+
border-bottom-left-radius: 4px;
|
49
|
+
border-bottom-right-radius: 4px;
|
50
|
+
border-top-color: #DADADA;
|
51
|
+
color: #666;
|
52
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
53
|
+
}
|
54
|
+
</style>
|
55
|
+
</head>
|
56
|
+
|
57
|
+
<body class="rails-default-error-page">
|
58
|
+
<!-- This file lives in public/422.html -->
|
59
|
+
<div class="dialog">
|
60
|
+
<div>
|
61
|
+
<h1>The change you wanted was rejected.</h1>
|
62
|
+
<p>Maybe you tried to change something you didn't have access to.</p>
|
63
|
+
</div>
|
64
|
+
<p>If you are the application owner check the logs for more information.</p>
|
65
|
+
</div>
|
66
|
+
</body>
|
67
|
+
</html>
|
@@ -0,0 +1,66 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>We're sorry, but something went wrong (500)</title>
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
+
<style>
|
7
|
+
.rails-default-error-page {
|
8
|
+
background-color: #EFEFEF;
|
9
|
+
color: #2E2F30;
|
10
|
+
text-align: center;
|
11
|
+
font-family: arial, sans-serif;
|
12
|
+
margin: 0;
|
13
|
+
}
|
14
|
+
|
15
|
+
.rails-default-error-page div.dialog {
|
16
|
+
width: 95%;
|
17
|
+
max-width: 33em;
|
18
|
+
margin: 4em auto 0;
|
19
|
+
}
|
20
|
+
|
21
|
+
.rails-default-error-page div.dialog > div {
|
22
|
+
border: 1px solid #CCC;
|
23
|
+
border-right-color: #999;
|
24
|
+
border-left-color: #999;
|
25
|
+
border-bottom-color: #BBB;
|
26
|
+
border-top: #B00100 solid 4px;
|
27
|
+
border-top-left-radius: 9px;
|
28
|
+
border-top-right-radius: 9px;
|
29
|
+
background-color: white;
|
30
|
+
padding: 7px 12% 0;
|
31
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
|
+
}
|
33
|
+
|
34
|
+
.rails-default-error-page h1 {
|
35
|
+
font-size: 100%;
|
36
|
+
color: #730E15;
|
37
|
+
line-height: 1.5em;
|
38
|
+
}
|
39
|
+
|
40
|
+
.rails-default-error-page div.dialog > p {
|
41
|
+
margin: 0 0 1em;
|
42
|
+
padding: 1em;
|
43
|
+
background-color: #F7F7F7;
|
44
|
+
border: 1px solid #CCC;
|
45
|
+
border-right-color: #999;
|
46
|
+
border-left-color: #999;
|
47
|
+
border-bottom-color: #999;
|
48
|
+
border-bottom-left-radius: 4px;
|
49
|
+
border-bottom-right-radius: 4px;
|
50
|
+
border-top-color: #DADADA;
|
51
|
+
color: #666;
|
52
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
53
|
+
}
|
54
|
+
</style>
|
55
|
+
</head>
|
56
|
+
|
57
|
+
<body class="rails-default-error-page">
|
58
|
+
<!-- This file lives in public/500.html -->
|
59
|
+
<div class="dialog">
|
60
|
+
<div>
|
61
|
+
<h1>We're sorry, but something went wrong.</h1>
|
62
|
+
</div>
|
63
|
+
<p>If you are the application owner check the logs for more information.</p>
|
64
|
+
</div>
|
65
|
+
</body>
|
66
|
+
</html>
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
# See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,36 @@
|
|
1
|
+
|
2
|
+
jozka_mr:
|
3
|
+
name: Jozka
|
4
|
+
country: Moravia
|
5
|
+
|
6
|
+
klarka_mr:
|
7
|
+
name: Klarka
|
8
|
+
country: Moravia
|
9
|
+
|
10
|
+
ze_sovince_mr:
|
11
|
+
name: Pan ze Sovince
|
12
|
+
country: Moravia
|
13
|
+
|
14
|
+
pepik_bh:
|
15
|
+
name: Pepik
|
16
|
+
country: Bohemia
|
17
|
+
|
18
|
+
marenka_bh:
|
19
|
+
name: Marenka
|
20
|
+
country: Bohemia
|
21
|
+
|
22
|
+
zly_rodic_bh:
|
23
|
+
name: father of marenka & pepik
|
24
|
+
country: Bohemia
|
25
|
+
|
26
|
+
z_lipe_bh:
|
27
|
+
name: Pan z Lipe
|
28
|
+
country: Bohemia
|
29
|
+
|
30
|
+
z_lichnova_sl:
|
31
|
+
name: Pan z Lichnova
|
32
|
+
country: Silesia
|
33
|
+
|
34
|
+
premysl_otakar_II:
|
35
|
+
name: knize Premysl Otakar II
|
36
|
+
country: Bohemia
|
File without changes
|
File without changes
|
File without changes
|