authcan_easyroller 0.1.0 → 0.1.1

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.
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2009 Topher Fangio
1
+ Copyright (c) 2009-2010 Topher Fangio
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.rdoc CHANGED
@@ -60,9 +60,18 @@ planned enhancements so you can get a feel of where this project will go.
60
60
 
61
61
  == Installation/Setup
62
62
 
63
- Now that the code is a Rails 3 engine, installation is very simple; just install the gem and it's dependencies!
63
+ Assuming you already have Rails 3 installed, installation is very simple; just install the gem and
64
+ it's dependencies!
64
65
 
65
- gem install rails authlogic cancan easy_roles authcan_easyroller
66
+ gem install authlogic cancan easy_roles authcan_easyroller
67
+
68
+ Next, add the dependencies to your <tt>Gemfile</tt>:
69
+
70
+
71
+ gem "authlogic"
72
+ gem "cancan"
73
+ gem "easy_roles"
74
+ gem "authcan_easyroller"
66
75
 
67
76
  Next, create a migration for the users:
68
77
 
@@ -70,36 +79,36 @@ Next, create a migration for the users:
70
79
 
71
80
  Then, copy the following contents into that file making any changes you see fit:
72
81
 
73
- class CreateUsers < ActiveRecord::Migration
74
- def self.up
75
- create_table :users do |t|
76
- # Necessary Columns - These are required for AuthcanEasyroller to function properly
77
- t.string :email, :null => false
78
- t.string :crypted_password, :null => false
79
- t.string :password_salt, :null => false
80
- t.string :persistence_token, :null => false
81
- t.string :single_access_token, :null => false
82
- t.string :perishable_token, :null => false
83
- t.integer :roles_mask, :null => false, :default => 0
82
+ class CreateUsers < ActiveRecord::Migration
83
+ def self.up
84
+ create_table :users do |t|
85
+ # Necessary Columns - These are required for AuthcanEasyroller to function properly
86
+ t.string :email, :null => false
87
+ t.string :crypted_password, :null => false
88
+ t.string :password_salt, :null => false
89
+ t.string :persistence_token, :null => false
90
+ t.string :single_access_token, :null => false
91
+ t.string :perishable_token, :null => false
92
+ t.integer :roles_mask, :null => false, :default => 0
84
93
 
85
- # Magic Columns - You may leave any of the following out if you wish
86
- t.integer :login_count, :null => false, :default => 0
87
- t.integer :failed_login_count, :null => false, :default => 0
88
- t.datetime :last_request_at
89
- t.datetime :current_login_at
90
- t.datetime :last_login_at
91
- t.string :current_login_ip
92
- t.string :last_login_ip
94
+ # Magic Columns - You may leave any of the following out if you wish
95
+ t.integer :login_count, :null => false, :default => 0
96
+ t.integer :failed_login_count, :null => false, :default => 0
97
+ t.datetime :last_request_at
98
+ t.datetime :current_login_at
99
+ t.datetime :last_login_at
100
+ t.string :current_login_ip
101
+ t.string :last_login_ip
93
102
 
94
- # Timestamp Columns - You should have these on every database table you create
95
- t.timestamps
96
- end
97
- end
98
-
99
- def self.down
100
- drop_table :users
101
- end
102
- end
103
+ # Timestamp Columns - You should have these on every database table you create
104
+ t.timestamps
105
+ end
106
+ end
107
+
108
+ def self.down
109
+ drop_table :users
110
+ end
111
+ end
103
112
 
104
113
  Once saved, migrate your database by running
105
114
 
@@ -214,4 +223,4 @@ I would like to thank the creators of Authlogic, CanCan and Easy Roles for the e
214
223
  into these plugins. Adding them together was relatively straightforward and easy and I hope that they
215
224
  realize how much time this saves other developers!
216
225
 
217
- Copyright (c) 2010 Topher Fangio, released under the MIT license.
226
+ Copyright (c) 2009-2010 Topher Fangio
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{authcan_easyroller}
8
- s.version = "0.1.0"
8
+ s.version = "0.1.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Topher Fangio"]
@@ -37,9 +37,9 @@ Gem::Specification.new do |s|
37
37
  "app/views/users/show.html.erb",
38
38
  "authcan_easyroller.gemspec",
39
39
  "config/routes.rb",
40
- "example/ability.rb",
41
- "example/application.html.erb",
42
- "example/main.css",
40
+ "examples/ability.rb",
41
+ "examples/application.html.erb",
42
+ "examples/main.css",
43
43
  "lib/authcan_easyroller.rb",
44
44
  "test/helper.rb",
45
45
  "test/test_authcan_easyroller.rb"
@@ -51,7 +51,8 @@ Gem::Specification.new do |s|
51
51
  s.summary = %q{Rails 3 engine for user authentication/authorization utilizing Authlogic, CanCan and EasyRoles}
52
52
  s.test_files = [
53
53
  "test/helper.rb",
54
- "test/test_authcan_easyroller.rb"
54
+ "test/test_authcan_easyroller.rb",
55
+ "examples/ability.rb"
55
56
  ]
56
57
 
57
58
  if s.respond_to? :specification_version then
@@ -0,0 +1,41 @@
1
+ class Ability
2
+ include CanCan::Ability
3
+
4
+ def initialize(current_user)
5
+ can :read, :all
6
+ can :manage, UserSession
7
+
8
+ if current_user
9
+ # Abilities for someone with an account (does not necessarily have a "user" role)
10
+ can [:update, :destroy], User do |user|
11
+ user == current_user
12
+ end
13
+
14
+
15
+ # User role abilities
16
+ if current_user.is_user?
17
+ end
18
+
19
+
20
+ # Moderator role abilities
21
+ if current_user.is_moderator?
22
+ end
23
+
24
+
25
+ # Admin role abilities
26
+ if current_user.is_admin?
27
+ can :manage, :all
28
+ end
29
+
30
+
31
+ # Developer role abilities
32
+ if current_user.is_developer?
33
+ can :manage, :all
34
+ end
35
+ else
36
+ can :create, User
37
+ end
38
+
39
+ end
40
+
41
+ end
@@ -0,0 +1,40 @@
1
+ <html>
2
+ <head>
3
+ <script src="http://www.google.com/jsapi"></script>
4
+ <script>google.load("jquery", "1.4");</script>
5
+
6
+ <%= stylesheet_link_tag 'main' %>
7
+ </head>
8
+
9
+ <body>
10
+ <div id='navigation'>
11
+ <%= link_to "Users", users_path %>
12
+ </div>
13
+
14
+ <div id='userland'>
15
+ <% if current_user %>
16
+ Welcome <%= current_user.email %>!
17
+
18
+ <%= link_to "My Account", user_path(current_user) %>
19
+ <%= link_separator %>
20
+ <%= link_to "Logout", '/user_sessions/destroy' %>
21
+ <% else %>
22
+ You are not currently
23
+ <%= link_to "logged in", new_user_session_path %>.
24
+ <% end %>
25
+ </div>
26
+
27
+ <div id='flashes'>
28
+ <%= raw "<h5 class='flash error'>#{flash[:error]}</h5>" unless flash[:error].blank? %>
29
+ <%= raw "<h5 class='flash notice'>#{flash[:notice]}</h5>" unless flash[:notice].blank? %>
30
+ </div>
31
+
32
+ <div id='content'>
33
+ <%= yield %>
34
+ </div>
35
+
36
+ <div id='copyright'>
37
+ Copyright &copy; 2010, MyCompany. All rights reserved.
38
+ </div>
39
+ </body>
40
+ </html>
data/examples/main.css ADDED
@@ -0,0 +1,41 @@
1
+ #navigation {
2
+ float: left;
3
+ margin-bottom: 10px;
4
+ }
5
+
6
+ #userland {
7
+ float: right;
8
+ margin-bottom: 10px;
9
+ }
10
+
11
+ #flashes {
12
+ clear: both;
13
+ }
14
+
15
+ #content {
16
+ margin: 10px;
17
+ }
18
+
19
+ #copyright {
20
+ text-align: center;
21
+ }
22
+
23
+ .flash {
24
+ border: 1px solid #000000;
25
+ padding: 10px;
26
+ }
27
+
28
+ .flash.error {
29
+ }
30
+
31
+ .flash.notice {
32
+ }
33
+
34
+ label {
35
+ font-weight: bold;
36
+ }
37
+
38
+ input[type=text],input[type=password],select,textarea {
39
+ clear: both;
40
+ display: block;
41
+ }
@@ -13,8 +13,8 @@ module AuthcanEasyroller
13
13
  #
14
14
  # Bug here: https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/3928
15
15
  #
16
- app.config.filter_parameters << :password
17
- app.config.filter_parameters << :password_confirmation
16
+ # app.config.filter_parameters << :password
17
+ # app.config.filter_parameters << :password_confirmation
18
18
  end
19
19
  end
20
20
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 0
9
- version: 0.1.0
8
+ - 1
9
+ version: 0.1.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Topher Fangio
@@ -59,9 +59,9 @@ files:
59
59
  - app/views/users/show.html.erb
60
60
  - authcan_easyroller.gemspec
61
61
  - config/routes.rb
62
- - example/ability.rb
63
- - example/application.html.erb
64
- - example/main.css
62
+ - examples/ability.rb
63
+ - examples/application.html.erb
64
+ - examples/main.css
65
65
  - lib/authcan_easyroller.rb
66
66
  - test/helper.rb
67
67
  - test/test_authcan_easyroller.rb
@@ -98,3 +98,4 @@ summary: Rails 3 engine for user authentication/authorization utilizing Authlogi
98
98
  test_files:
99
99
  - test/helper.rb
100
100
  - test/test_authcan_easyroller.rb
101
+ - examples/ability.rb
data/example/ability.rb DELETED
@@ -1,41 +0,0 @@
1
- class Ability
2
- include CanCan::Ability
3
-
4
- def initialize(current_user)
5
- can :read, :all
6
- can :manage, UserSession
7
-
8
- if current_user
9
- # Abilities for someone with an account (does not necessarily have a "user" role)
10
- can [:update, :destroy], User do |user|
11
- user == current_user
12
- end
13
-
14
-
15
- # User role abilities
16
- if current_user.is_user?
17
- end
18
-
19
-
20
- # Moderator role abilities
21
- if current_user.is_moderator?
22
- end
23
-
24
-
25
- # Admin role abilities
26
- if current_user.is_admin?
27
- can :manage, :all
28
- end
29
-
30
-
31
- # Developer role abilities
32
- if current_user.is_developer?
33
- can :manage, :all
34
- end
35
- else
36
- can :create, User
37
- end
38
-
39
- end
40
-
41
- end
@@ -1,40 +0,0 @@
1
- <html>
2
- <head>
3
- <script src="http://www.google.com/jsapi"></script>
4
- <script>google.load("jquery", "1.4");</script>
5
-
6
- <%= stylesheet_link_tag 'main' %>
7
- </head>
8
-
9
- <body>
10
- <div id='navigation'>
11
- <%= link_to "Users", users_path %>
12
- </div>
13
-
14
- <div id='userland'>
15
- <% if current_user %>
16
- Welcome <%= current_user.email %>!
17
-
18
- <%= link_to "My Account", user_path(current_user) %>
19
- <%= link_separator %>
20
- <%= link_to "Logout", '/user_sessions/destroy' %>
21
- <% else %>
22
- You are not currently
23
- <%= link_to "logged in", new_user_session_path %>.
24
- <% end %>
25
- </div>
26
-
27
- <div id='flashes'>
28
- <%= raw "<h5 class='flash error'>#{flash[:error]}</h5>" unless flash[:error].blank? %>
29
- <%= raw "<h5 class='flash notice'>#{flash[:notice]}</h5>" unless flash[:notice].blank? %>
30
- </div>
31
-
32
- <div id='content'>
33
- <%= yield %>
34
- </div>
35
-
36
- <div id='copyright'>
37
- Copyright &copy; 2010, MyCompany. All rights reserved.
38
- </div>
39
- </body>
40
- </html>
data/example/main.css DELETED
@@ -1,41 +0,0 @@
1
- #navigation {
2
- float: left;
3
- margin-bottom: 10px;
4
- }
5
-
6
- #userland {
7
- float: right;
8
- margin-bottom: 10px;
9
- }
10
-
11
- #flashes {
12
- clear: both;
13
- }
14
-
15
- #content {
16
- margin: 10px;
17
- }
18
-
19
- #copyright {
20
- text-align: center;
21
- }
22
-
23
- .flash {
24
- border: 1px solid #000000;
25
- padding: 10px;
26
- }
27
-
28
- .flash.error {
29
- }
30
-
31
- .flash.notice {
32
- }
33
-
34
- label {
35
- font-weight: bold;
36
- }
37
-
38
- input[type=text],input[type=password],select,textarea {
39
- clear: both;
40
- display: block;
41
- }