adeia 0.0.1 → 0.1.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.
Files changed (101) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +1 -23
  3. data/app/assets/javascripts/adeia/application.js +13 -0
  4. data/app/assets/stylesheets/adeia/application.css +15 -0
  5. data/app/controllers/adeia/application_controller.rb +4 -0
  6. data/app/helpers/adeia/application_helper.rb +4 -0
  7. data/app/models/adeia/action.rb +5 -0
  8. data/app/models/adeia/action_permission.rb +6 -0
  9. data/app/models/adeia/element.rb +3 -0
  10. data/app/models/adeia/group.rb +3 -0
  11. data/app/models/adeia/group_user.rb +4 -0
  12. data/app/models/adeia/permission.rb +4 -0
  13. data/app/models/adeia/token.rb +5 -0
  14. data/config/locales/en.yml +6 -0
  15. data/config/locales/fr.yml +6 -0
  16. data/config/routes.rb +2 -2
  17. data/db/migrate/20151003144041_create_adeia_elements.rb +9 -0
  18. data/db/migrate/20151003144208_create_adeia_permissions.rb +16 -0
  19. data/db/migrate/20151003144650_create_adeia_groups.rb +9 -0
  20. data/db/migrate/20151003144706_create_adeia_group_users.rb +10 -0
  21. data/db/migrate/20151003150524_create_adeia_tokens.rb +12 -0
  22. data/db/migrate/20151003150747_create_adeia_actions.rb +9 -0
  23. data/db/migrate/20151003150806_create_adeia_action_permissions.rb +10 -0
  24. data/lib/adeia/authorization.rb +48 -0
  25. data/lib/adeia/controller_methods.rb +43 -0
  26. data/lib/adeia/controller_resource.rb +84 -0
  27. data/lib/adeia/database.rb +52 -0
  28. data/lib/adeia/engine.rb +8 -0
  29. data/lib/adeia/exceptions.rb +33 -0
  30. data/lib/adeia/version.rb +1 -1
  31. data/test/dummy/app/assets/javascripts/sessions.js +2 -0
  32. data/test/dummy/app/assets/stylesheets/scaffold.css +56 -0
  33. data/test/dummy/app/assets/stylesheets/sessions.css +4 -0
  34. data/test/dummy/app/controllers/application_controller.rb +2 -0
  35. data/test/dummy/app/controllers/articles_controller.rb +55 -0
  36. data/test/dummy/app/controllers/sessions_controller.rb +22 -0
  37. data/test/dummy/app/helpers/sessions_helper.rb +32 -0
  38. data/test/dummy/app/models/article.rb +3 -0
  39. data/test/dummy/app/models/user.rb +13 -0
  40. data/test/dummy/app/views/articles/_form.html.erb +25 -0
  41. data/test/dummy/app/views/articles/edit.html.erb +6 -0
  42. data/test/dummy/app/views/articles/index.html.erb +31 -0
  43. data/test/dummy/app/views/articles/new.html.erb +5 -0
  44. data/test/dummy/app/views/articles/show.html.erb +19 -0
  45. data/test/dummy/app/views/layouts/application.html.erb +8 -0
  46. data/test/dummy/app/views/sessions/new.html.erb +19 -0
  47. data/test/dummy/config/routes.rb +6 -51
  48. data/test/dummy/db/development.sqlite3 +0 -0
  49. data/test/dummy/db/migrate/20150930161522_create_users.rb +11 -0
  50. data/test/dummy/db/migrate/20150930161532_create_articles.rb +11 -0
  51. data/test/dummy/db/migrate/20151003145900_create_adeia_elements.adeia.rb +10 -0
  52. data/test/dummy/db/migrate/20151003145901_create_adeia_permissions.adeia.rb +17 -0
  53. data/test/dummy/db/migrate/20151003145902_create_adeia_groups.adeia.rb +10 -0
  54. data/test/dummy/db/migrate/20151003145903_create_adeia_group_users.adeia.rb +11 -0
  55. data/test/dummy/db/migrate/20151003150941_create_adeia_tokens.adeia.rb +13 -0
  56. data/test/dummy/db/migrate/20151003150942_create_adeia_actions.adeia.rb +10 -0
  57. data/test/dummy/db/migrate/20151003150943_create_adeia_action_permissions.adeia.rb +11 -0
  58. data/test/dummy/db/schema.rb +100 -0
  59. data/test/dummy/lib/tasks/init.rake +8 -0
  60. data/test/dummy/log/development.log +4656 -0
  61. data/test/dummy/test/controllers/articles_controller_test.rb +49 -0
  62. data/test/dummy/test/controllers/sessions_controller_test.rb +7 -0
  63. data/test/dummy/test/controllers/users_controller_test.rb +49 -0
  64. data/test/dummy/test/fixtures/articles.yml +11 -0
  65. data/test/dummy/test/fixtures/users.yml +9 -0
  66. data/test/{integration/navigation_test.rb → dummy/test/models/article_test.rb} +1 -2
  67. data/test/dummy/test/models/user_test.rb +7 -0
  68. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/007YZnzCZDb7P0xbxiEkmAM6-xSsxmYu_W7vnrvcDOs.cache +0 -0
  69. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/1GiUoKAP-7ewZyzr_eCTMX0R8ML5Z_VN2bfQ05RAW30.cache +1 -0
  70. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/5Lly_CA8DZvPhQV2jDQx-Y6P_y3Ygra9t5jfSlGhHDA.cache +2 -0
  71. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/6n6yNyR4eQhIVjw5Anxur-SLgdDc_rzuMuZKj6Q4FqE.cache +0 -0
  72. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/80nWjD2uxLBuIN1R5NawmTsgZWCB6nln8WXf_5gHri4.cache +1 -0
  73. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/9Fw_WnCC15QnXUQZ4eYTYLOBv20at5Z5gL-WJx_QsR4.cache +1 -0
  74. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/D4VyPOMG_wXgPRZtj-mbRdONJXbdgOZKcuwSm-lNNIA.cache +2 -0
  75. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/DmmfrCpXtt74Hr6NO54lxyOCDv6klnDyBqeDFR7oDU8.cache +2 -0
  76. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/HggfmBmV-rmvrvzJjqvjmDpwB2BTEQvh6krp0CcrI0U.cache +1 -0
  77. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/OI6uxGcnsKavdWTtwDAasU3wPx8QXhzBgV0X2n1KjMQ.cache +2 -0
  78. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/P1NOTKHlk-FIwqlw0wiyLanpgNyubwQi850S1aonsbQ.cache +1 -0
  79. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/PKcbfub75wwU6UzvVnSMFn_6wsaaPUoXMtWTnyyh5jM.cache +1 -0
  80. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/S4dXPkh6wlupsMUb-GvZ2Q5PwAZmplTCkViWCnVWWw0.cache +2 -0
  81. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/UuBE6kIOXtWOmnrnywPI98bzHE-L84SteUEfzexxVtA.cache +1 -0
  82. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/Xa5LZJIrW7sSuOWWFwCAhDkDQ71pA_cHp6H5kiTZS6E.cache +0 -0
  83. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/eQqoU12FSWEA4BsL-PjwTnIUr1bZsu27SOzFHPomG4c.cache +1 -0
  84. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/f3V_hqqK4rH7Z51LFX1Wk9hrWGjYABTZmgSeYvWKgLs.cache +2 -0
  85. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/gXIpNlfbH4G7-D0grgt2EuWuwHwTymznc1rlxJ1-C0A.cache +0 -0
  86. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/hX4wt6FzyI47gW66iiVyl2C722yfwvx3KafFEYkreEY.cache +0 -0
  87. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/hZi1k6tpxxCGYxRe7zY74ItcOI8gZrREOpGuA8JSpGg.cache +2 -0
  88. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/nZCCAAO-XWnPS2Xr9yss0VhSONvnR3emOuEIc_b-1OY.cache +1 -0
  89. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/pEhaat2KBd5SrT7szC_8R1_6hK17FTpvoRFkmCRSD3M.cache +2 -0
  90. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/r5qzpye5vWgzwRnRhhSYkUslyNZ11pyYXQZqGe8o930.cache +1 -0
  91. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/t0GCJAJcd_7X2F172TjwwDZ6rfNJc2FRbDTV5-jSqY0.cache +1 -0
  92. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/t92Y0f7B0gH-r5W-iNadtkzgjm8gxyEyttnY6AWpdmw.cache +0 -0
  93. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/tYGZjTIGEDMySqV7qHf43dq0_aB7TuSEhhZtN_9xW54.cache +0 -0
  94. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/wMjI0_cDi3gmsOV5xXr-QPQOfHCB_qea8St_udeflhE.cache +2 -0
  95. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/z2mRCA3647ZviK5pXi1_qLwdxkiCaoIfZj7jHoMfLiI.cache +1 -0
  96. metadata +179 -12
  97. data/README.rdoc +0 -3
  98. data/lib/tasks/adeia_tasks.rake +0 -3
  99. data/test/adeia_test.rb +0 -7
  100. data/test/dummy/README.rdoc +0 -28
  101. data/test/test_helper.rb +0 -20
@@ -0,0 +1,22 @@
1
+ class SessionsController < ApplicationController
2
+
3
+ def new
4
+ end
5
+
6
+ def create
7
+ @user = User.find_by_name(params[:session][:name])
8
+ if @user && @user.authenticate(params[:session][:password])
9
+ sign_in(@user, permanent: params[:session][:remember_me] == "1")
10
+ redirect_to articles_path, success: "Signed in"
11
+ else
12
+ flash.now[:error] = "Incorrect user/password"
13
+ render 'new'
14
+ end
15
+ end
16
+
17
+ def destroy
18
+ sign_out
19
+ redirect_to root_path, "Signed out"
20
+ end
21
+
22
+ end
@@ -0,0 +1,32 @@
1
+ module SessionsHelper
2
+
3
+ # Sign in a user with a cookie (remove on browser close)
4
+ #
5
+ # * *Args* :
6
+ # - a user to sign in
7
+ # * *Returns* :
8
+ #
9
+ def sign_in(user, permanent: false)
10
+ cookies[:remember_token] = { value: user.remember_token, expires: (Time.now + 2592000 if permanent) }
11
+ self.current_user = user
12
+ end
13
+
14
+ def current_user=(user)
15
+ @current_user = user
16
+ end
17
+
18
+ # Provid the user currently signed in.
19
+ #
20
+ # * *Returns* :
21
+ # - the user currently signed in
22
+ def current_user
23
+ @current_user ||= User.find_by_remember_token(cookies[:remember_token])
24
+ end
25
+
26
+ # Sign out a user by removing the cookie.
27
+ def sign_out
28
+ self.current_user = nil
29
+ cookies.delete(:remember_token)
30
+ end
31
+
32
+ end
@@ -0,0 +1,3 @@
1
+ class Article < ActiveRecord::Base
2
+ belongs_to :user
3
+ end
@@ -0,0 +1,13 @@
1
+ class User < ActiveRecord::Base
2
+ has_many :articles
3
+
4
+ has_secure_password
5
+
6
+ before_save :create_remember_token
7
+
8
+ private
9
+
10
+ def create_remember_token
11
+ self.remember_token = SecureRandom.urlsafe_base64
12
+ end
13
+ end
@@ -0,0 +1,25 @@
1
+ <%= form_for(@article) do |f| %>
2
+ <% if @article.errors.any? %>
3
+ <div id="error_explanation">
4
+ <h2><%= pluralize(@article.errors.count, "error") %> prohibited this article from being saved:</h2>
5
+
6
+ <ul>
7
+ <% @article.errors.full_messages.each do |message| %>
8
+ <li><%= message %></li>
9
+ <% end %>
10
+ </ul>
11
+ </div>
12
+ <% end %>
13
+
14
+ <div class="field">
15
+ <%= f.label :title %><br>
16
+ <%= f.text_field :title %>
17
+ </div>
18
+ <div class="field">
19
+ <%= f.label :content %><br>
20
+ <%= f.text_area :content %>
21
+ </div>
22
+ <div class="actions">
23
+ <%= f.submit %>
24
+ </div>
25
+ <% end %>
@@ -0,0 +1,6 @@
1
+ <h1>Editing Article</h1>
2
+
3
+ <%= render 'form' %>
4
+
5
+ <%= link_to 'Show', @article %> |
6
+ <%= link_to 'Back', articles_path %>
@@ -0,0 +1,31 @@
1
+ <p id="notice"><%= notice %></p>
2
+
3
+ <h1>Listing Articles</h1>
4
+
5
+ <table>
6
+ <thead>
7
+ <tr>
8
+ <th>Title</th>
9
+ <th>Content</th>
10
+ <th>User</th>
11
+ <th colspan="3"></th>
12
+ </tr>
13
+ </thead>
14
+
15
+ <tbody>
16
+ <% @articles.each do |article| %>
17
+ <tr>
18
+ <td><%= article.title %></td>
19
+ <td><%= article.content %></td>
20
+ <td><%= article.user.name %></td>
21
+ <td><%= link_to 'Show', article %></td>
22
+ <td><%= link_to 'Edit', edit_article_path(article) %></td>
23
+ <td><%= link_to 'Destroy', article, method: :delete, data: { confirm: 'Are you sure?' } %></td>
24
+ </tr>
25
+ <% end %>
26
+ </tbody>
27
+ </table>
28
+
29
+ <br>
30
+
31
+ <%= link_to 'New Article', new_article_path %>
@@ -0,0 +1,5 @@
1
+ <h1>New Article</h1>
2
+
3
+ <%= render 'form' %>
4
+
5
+ <%= link_to 'Back', articles_path %>
@@ -0,0 +1,19 @@
1
+ <p id="notice"><%= notice %></p>
2
+
3
+ <p>
4
+ <strong>Title:</strong>
5
+ <%= @article.title %>
6
+ </p>
7
+
8
+ <p>
9
+ <strong>Content:</strong>
10
+ <%= @article.content %>
11
+ </p>
12
+
13
+ <p>
14
+ <strong>User:</strong>
15
+ <%= @article.user.name %>
16
+ </p>
17
+
18
+ <%= link_to 'Edit', edit_article_path(@article) %> |
19
+ <%= link_to 'Back', articles_path %>
@@ -8,6 +8,14 @@
8
8
  </head>
9
9
  <body>
10
10
 
11
+ <div>
12
+ <% if current_user.nil? %>
13
+ <%= link_to "Login", login_path %>
14
+ <% else %>
15
+ <%= current_user.name %> | <%= link_to "Logout", logout_path, method: :delete %>
16
+ <% end %>
17
+ </div>
18
+
11
19
  <%= yield %>
12
20
 
13
21
  </body>
@@ -0,0 +1,19 @@
1
+ <%= form_for :session, url: sessions_path do |f| %>
2
+ <div class="field">
3
+ <%= f.label :name %>
4
+ <%= f.text_field :name %>
5
+ </div>
6
+ <div>
7
+ <%= f.label :password %>
8
+ <%= f.password_field :password %>
9
+ </div>
10
+ <div class="field">
11
+ <%= f.label :remember_me %>
12
+ <%= f.check_box :remember_me %>
13
+ </div>
14
+
15
+ <div class="actions">
16
+ <%= f.submit "Login" %>
17
+ </div>
18
+
19
+ <% end %>
@@ -1,56 +1,11 @@
1
1
  Rails.application.routes.draw do
2
- # The priority is based upon order of creation: first created -> highest priority.
3
- # See how all your routes lay out with "rake routes".
2
+ mount Adeia::Engine => "/adeia"
4
3
 
5
- # You can have the root of your site routed with "root"
6
- # root 'welcome#index'
4
+ root "articles#index"
7
5
 
8
- # Example of regular route:
9
- # get 'products/:id' => 'catalog#view'
6
+ get 'login', to: "sessions#new"
7
+ delete 'logout', to: 'sessions#destroy'
8
+ resources :sessions, only: [:create]
10
9
 
11
- # Example of named route that can be invoked with purchase_url(id: product.id)
12
- # get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
13
-
14
- # Example resource route (maps HTTP verbs to controller actions automatically):
15
- # resources :products
16
-
17
- # Example resource route with options:
18
- # resources :products do
19
- # member do
20
- # get 'short'
21
- # post 'toggle'
22
- # end
23
- #
24
- # collection do
25
- # get 'sold'
26
- # end
27
- # end
28
-
29
- # Example resource route with sub-resources:
30
- # resources :products do
31
- # resources :comments, :sales
32
- # resource :seller
33
- # end
34
-
35
- # Example resource route with more complex sub-resources:
36
- # resources :products do
37
- # resources :comments
38
- # resources :sales do
39
- # get 'recent', on: :collection
40
- # end
41
- # end
42
-
43
- # Example resource route with concerns:
44
- # concern :toggleable do
45
- # post 'toggle'
46
- # end
47
- # resources :posts, concerns: :toggleable
48
- # resources :photos, concerns: :toggleable
49
-
50
- # Example resource route within a namespace:
51
- # namespace :admin do
52
- # # Directs /admin/products/* to Admin::ProductsController
53
- # # (app/controllers/admin/products_controller.rb)
54
- # resources :products
55
- # end
10
+ resources :articles
56
11
  end
Binary file
@@ -0,0 +1,11 @@
1
+ class CreateUsers < ActiveRecord::Migration
2
+ def change
3
+ create_table :users do |t|
4
+ t.string :name
5
+ t.string :password_digest
6
+ t.string :remember_token
7
+
8
+ t.timestamps null: false
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ class CreateArticles < ActiveRecord::Migration
2
+ def change
3
+ create_table :articles do |t|
4
+ t.string :title
5
+ t.text :content
6
+ t.references :user, index: true, foreign_key: true
7
+
8
+ t.timestamps null: false
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,10 @@
1
+ # This migration comes from adeia (originally 20151003144041)
2
+ class CreateAdeiaElements < ActiveRecord::Migration
3
+ def change
4
+ create_table :adeia_elements do |t|
5
+ t.string :name
6
+
7
+ t.timestamps null: false
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,17 @@
1
+ # This migration comes from adeia (originally 20151003144208)
2
+ class CreateAdeiaPermissions < ActiveRecord::Migration
3
+ def change
4
+ create_table :adeia_permissions do |t|
5
+ t.references :owner, polymorphic: true, index: true
6
+ t.references :element, index: true, foreign_key: true
7
+ t.integer :permission_type
8
+ t.boolean :read_right
9
+ t.boolean :create_right
10
+ t.boolean :update_right
11
+ t.boolean :destroy_right
12
+ t.integer :resource_id
13
+
14
+ t.timestamps null: false
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,10 @@
1
+ # This migration comes from adeia (originally 20151003144650)
2
+ class CreateAdeiaGroups < ActiveRecord::Migration
3
+ def change
4
+ create_table :adeia_groups do |t|
5
+ t.string :name
6
+
7
+ t.timestamps null: false
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,11 @@
1
+ # This migration comes from adeia (originally 20151003144706)
2
+ class CreateAdeiaGroupUsers < ActiveRecord::Migration
3
+ def change
4
+ create_table :adeia_group_users do |t|
5
+ t.references :group, index: true, foreign_key: true
6
+ t.references :user, index: true, foreign_key: true
7
+
8
+ t.timestamps null: false
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,13 @@
1
+ # This migration comes from adeia (originally 20151003150524)
2
+ class CreateAdeiaTokens < ActiveRecord::Migration
3
+ def change
4
+ create_table :adeia_tokens do |t|
5
+ t.string :token
6
+ t.boolean :valid
7
+ t.references :permission, index: true, foreign_key: true
8
+ t.date :exp_at
9
+
10
+ t.timestamps null: false
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,10 @@
1
+ # This migration comes from adeia (originally 20151003150747)
2
+ class CreateAdeiaActions < ActiveRecord::Migration
3
+ def change
4
+ create_table :adeia_actions do |t|
5
+ t.string :name
6
+
7
+ t.timestamps null: false
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,11 @@
1
+ # This migration comes from adeia (originally 20151003150806)
2
+ class CreateAdeiaActionPermissions < ActiveRecord::Migration
3
+ def change
4
+ create_table :adeia_action_permissions do |t|
5
+ t.references :action, index: true, foreign_key: true
6
+ t.references :permission, index: true, foreign_key: true
7
+
8
+ t.timestamps null: false
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,100 @@
1
+ # encoding: UTF-8
2
+ # This file is auto-generated from the current state of the database. Instead
3
+ # of editing this file, please use the migrations feature of Active Record to
4
+ # incrementally modify your database, and then regenerate this schema definition.
5
+ #
6
+ # Note that this schema.rb definition is the authoritative source for your
7
+ # database schema. If you need to create the application database on another
8
+ # system, you should be using db:schema:load, not running all the migrations
9
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
11
+ #
12
+ # It's strongly recommended that you check this file into your version control system.
13
+
14
+ ActiveRecord::Schema.define(version: 20151003150943) do
15
+
16
+ create_table "adeia_action_permissions", force: :cascade do |t|
17
+ t.integer "action_id"
18
+ t.integer "permission_id"
19
+ t.datetime "created_at", null: false
20
+ t.datetime "updated_at", null: false
21
+ end
22
+
23
+ add_index "adeia_action_permissions", ["action_id"], name: "index_adeia_action_permissions_on_action_id"
24
+ add_index "adeia_action_permissions", ["permission_id"], name: "index_adeia_action_permissions_on_permission_id"
25
+
26
+ create_table "adeia_actions", force: :cascade do |t|
27
+ t.string "name"
28
+ t.datetime "created_at", null: false
29
+ t.datetime "updated_at", null: false
30
+ end
31
+
32
+ create_table "adeia_elements", force: :cascade do |t|
33
+ t.string "name"
34
+ t.datetime "created_at", null: false
35
+ t.datetime "updated_at", null: false
36
+ end
37
+
38
+ create_table "adeia_group_users", force: :cascade do |t|
39
+ t.integer "group_id"
40
+ t.integer "user_id"
41
+ t.datetime "created_at", null: false
42
+ t.datetime "updated_at", null: false
43
+ end
44
+
45
+ add_index "adeia_group_users", ["group_id"], name: "index_adeia_group_users_on_group_id"
46
+ add_index "adeia_group_users", ["user_id"], name: "index_adeia_group_users_on_user_id"
47
+
48
+ create_table "adeia_groups", force: :cascade do |t|
49
+ t.string "name"
50
+ t.datetime "created_at", null: false
51
+ t.datetime "updated_at", null: false
52
+ end
53
+
54
+ create_table "adeia_permissions", force: :cascade do |t|
55
+ t.integer "owner_id"
56
+ t.string "owner_type"
57
+ t.integer "element_id"
58
+ t.integer "permission_type"
59
+ t.boolean "read_right"
60
+ t.boolean "create_right"
61
+ t.boolean "update_right"
62
+ t.boolean "destroy_right"
63
+ t.integer "resource_id"
64
+ t.datetime "created_at", null: false
65
+ t.datetime "updated_at", null: false
66
+ end
67
+
68
+ add_index "adeia_permissions", ["element_id"], name: "index_adeia_permissions_on_element_id"
69
+ add_index "adeia_permissions", ["owner_type", "owner_id"], name: "index_adeia_permissions_on_owner_type_and_owner_id"
70
+
71
+ create_table "adeia_tokens", force: :cascade do |t|
72
+ t.string "token"
73
+ t.boolean "valid"
74
+ t.integer "permission_id"
75
+ t.date "exp_at"
76
+ t.datetime "created_at", null: false
77
+ t.datetime "updated_at", null: false
78
+ end
79
+
80
+ add_index "adeia_tokens", ["permission_id"], name: "index_adeia_tokens_on_permission_id"
81
+
82
+ create_table "articles", force: :cascade do |t|
83
+ t.string "title"
84
+ t.text "content"
85
+ t.integer "user_id"
86
+ t.datetime "created_at", null: false
87
+ t.datetime "updated_at", null: false
88
+ end
89
+
90
+ add_index "articles", ["user_id"], name: "index_articles_on_user_id"
91
+
92
+ create_table "users", force: :cascade do |t|
93
+ t.string "name"
94
+ t.string "password_digest"
95
+ t.string "remember_token"
96
+ t.datetime "created_at", null: false
97
+ t.datetime "updated_at", null: false
98
+ end
99
+
100
+ end
@@ -0,0 +1,8 @@
1
+ namespace :init do
2
+
3
+ desc "Create a user"
4
+ task user: :environment do
5
+ User.create!(name: "admin", password: "12341", password_confirmation: "12341")
6
+ end
7
+
8
+ end