cch1 / authorize

A mature Rails Plugin for role-based authorization (polymorphic on subject and trustee, DSL for auth expressions, model- and controller-level expressions)

This URL has Read+Write access

authorize / test / schema.rb
100644 24 lines (24 sloc) 0.837 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
ActiveRecord::Schema.define(:version => 0) do
  create_table :users, :force => true do |t|
    t.string :login, :limit => 80
    t.timestamps
  end
  create_table :degenerate_users, :force => true do |t|
    t.string :login, :limit => 80
  end
  create_table :widgets, :force => true do |t|
    t.string :name, :limit => 20
    t.timestamps
  end
  create_table :authorizations, :force => true do |t|
      t.string :role, :limit => 20
      t.integer :trustee_id
      t.string :trustee_type, :limit => 25
      t.integer :subject_id
      t.string :subject_type, :limit => 25
      t.integer :parent_id
      t.timestamps
  end
  add_index :authorizations, [:role, :trustee_id, :trustee_type, :subject_id, :subject_type], :unique
  add_index :authorizations, [:trustee_id, :trustee_type, :subject_id, :subject_type, :role], :unique
end