authcan_easyroller 0.1.3 → 0.1.4
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/README.rdoc +17 -6
- data/VERSION +1 -1
- data/app/controllers/user_sessions_controller.rb +0 -0
- data/app/controllers/users_controller.rb +1 -1
- data/app/models/ability.rb +41 -0
- data/app/models/user.rb +0 -0
- data/app/models/user_session.rb +0 -0
- data/app/views/user_sessions/new.html.erb +0 -0
- data/app/views/users/_form.html.erb +0 -0
- data/app/views/users/edit.html.erb +0 -0
- data/app/views/users/index.html.erb +1 -1
- data/app/views/users/new.html.erb +0 -0
- data/app/views/users/show.html.erb +0 -0
- data/authcan_easyroller.gemspec +3 -2
- data/lib/extensions/action_controller_base.rb +1 -1
- data/lib/extensions/cancan_ability.rb +0 -0
- data/lib/helpers/authcan_easyroller.rb +0 -0
- metadata +4 -10
data/README.rdoc
CHANGED
@@ -47,18 +47,19 @@ planned enhancements so you can get a feel of where this project will go.
|
|
47
47
|
|
48
48
|
== Installation/Setup
|
49
49
|
|
50
|
-
<b>Developers Note:</b
|
50
|
+
<b>Developers Note:</b> <em>I have created an example project[http://github.com/topherfangio/authcan_easyroller-example]
|
51
51
|
if you are just looking to play with it, or if you are having trouble getting your setup to work properly. It should
|
52
52
|
have everything necessary to get up and running quickly.</em>
|
53
53
|
|
54
|
-
Assuming you already have Rails 3 installed, installation is very simple; just
|
55
|
-
|
54
|
+
Assuming you already have Rails 3 installed, installation is very simple; just add the gem to your Gemfile
|
55
|
+
and run bundle install!
|
56
56
|
|
57
|
-
|
57
|
+
# Add this to your gemfile
|
58
|
+
gem "authcan_easyroller", ">= 0.1.3"
|
58
59
|
|
59
|
-
|
60
|
+
Run
|
60
61
|
|
61
|
-
|
62
|
+
bundle install
|
62
63
|
|
63
64
|
Next, create a migration for the users:
|
64
65
|
|
@@ -105,6 +106,16 @@ Next, copy the following files to their proper locations (feel free to edit them
|
|
105
106
|
help get you started). The <tt>rails.js</tt> file at the bottom of the list is the official Rails jQuery file available
|
106
107
|
at http://github.com/rails/jquery-ujs so make sure to remove the existing <tt>rails.js</tt> file from <tt>public/javascripts</tt>.
|
107
108
|
|
109
|
+
<b>Developer's Note:</b> <em>To save time, you can use <tt>wget</tt> or <tt>curl</tt> (which is installed by default on OS X) to download these files
|
110
|
+
from the command line directly into the proper locations. Basic usage is as follows:</em>
|
111
|
+
|
112
|
+
cd my_app_directory/some/path/
|
113
|
+
wget http://github.com/topherfangio/autcan_easyroller-example/raw/master/some/path/filename.rb
|
114
|
+
|
115
|
+
or
|
116
|
+
|
117
|
+
curl http://github.com/topherfangio/autcan_easyroller-example/raw/master/some/path/filename.rb > some/path/new_filename.rb
|
118
|
+
|
108
119
|
* ability.rb[http://github.com/topherfangio/authcan_easyroller-example/raw/master/app/models/ability.rb] -> <<APPLICATION>>/app/models/ability.rb
|
109
120
|
* application.html.erb[http://github.com/topherfangio/authcan_easyroller-example/raw/master/app/views/layouts/application.html.erb] -> <<APPLICATION>>/app/view/layouts/application.html.erb
|
110
121
|
* main.css[http://github.com/topherfangio/authcan_easyroller-example/raw/master/public/stylesheets/main.css] -> <<APPLICATION>/public/stylesheets/main.css
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.4
|
File without changes
|
@@ -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
|
data/app/models/user.rb
CHANGED
File without changes
|
data/app/models/user_session.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -10,7 +10,7 @@
|
|
10
10
|
<% @users.each do |user| %>
|
11
11
|
<tr>
|
12
12
|
<td><%= link_to user.email, user %></td>
|
13
|
-
<td><%= time_ago_in_words user.last_request_at
|
13
|
+
<td><%= user.last_request_at.nil? ? 'never' : "#{time_ago_in_words user.last_request_at} ago" %></td>
|
14
14
|
|
15
15
|
<td>
|
16
16
|
<% if can? :update, user %>
|
File without changes
|
File without changes
|
data/authcan_easyroller.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{authcan_easyroller}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.4"
|
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"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-10-07}
|
13
13
|
s.description = %q{This is a basic Rails engine utilizing Authlogic, CanCan and Easy Roles to create a starting point for simple Rails-based applications that need authentication and authorization. }
|
14
14
|
s.email = %q{fangiotophia@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -24,6 +24,7 @@ Gem::Specification.new do |s|
|
|
24
24
|
"VERSION",
|
25
25
|
"app/controllers/user_sessions_controller.rb",
|
26
26
|
"app/controllers/users_controller.rb",
|
27
|
+
"app/models/ability.rb",
|
27
28
|
"app/models/user.rb",
|
28
29
|
"app/models/user_session.rb",
|
29
30
|
"app/views/user_sessions/new.html.erb",
|
@@ -54,7 +54,7 @@ ActionController::Base.class_eval {
|
|
54
54
|
end
|
55
55
|
|
56
56
|
def store_location
|
57
|
-
unless new_user_url.match(/#{request.fullpath}$/) or new_user_session_url.match(/#{request.fullpath}$/)
|
57
|
+
unless new_user_url.match(/#{request.fullpath}$/) or new_user_session_url.match(/#{request.fullpath}$/) or (user_session_url.match(/#{request.fullpath}$/) and request.post?)
|
58
58
|
session[:return_to] = request.fullpath
|
59
59
|
end
|
60
60
|
end
|
File without changes
|
File without changes
|
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: authcan_easyroller
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 29
|
5
4
|
prerelease: false
|
6
5
|
segments:
|
7
6
|
- 0
|
8
7
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
8
|
+
- 4
|
9
|
+
version: 0.1.4
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- Topher Fangio
|
@@ -15,7 +14,7 @@ autorequire:
|
|
15
14
|
bindir: bin
|
16
15
|
cert_chain: []
|
17
16
|
|
18
|
-
date: 2010-
|
17
|
+
date: 2010-10-07 00:00:00 -05:00
|
19
18
|
default_executable:
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
@@ -26,7 +25,6 @@ dependencies:
|
|
26
25
|
requirements:
|
27
26
|
- - ">="
|
28
27
|
- !ruby/object:Gem::Version
|
29
|
-
hash: 3
|
30
28
|
segments:
|
31
29
|
- 0
|
32
30
|
version: "0"
|
@@ -40,7 +38,6 @@ dependencies:
|
|
40
38
|
requirements:
|
41
39
|
- - ">="
|
42
40
|
- !ruby/object:Gem::Version
|
43
|
-
hash: 13
|
44
41
|
segments:
|
45
42
|
- 2
|
46
43
|
- 1
|
@@ -56,7 +53,6 @@ dependencies:
|
|
56
53
|
requirements:
|
57
54
|
- - ">="
|
58
55
|
- !ruby/object:Gem::Version
|
59
|
-
hash: 19
|
60
56
|
segments:
|
61
57
|
- 1
|
62
58
|
- 0
|
@@ -72,7 +68,6 @@ dependencies:
|
|
72
68
|
requirements:
|
73
69
|
- - ">="
|
74
70
|
- !ruby/object:Gem::Version
|
75
|
-
hash: 23
|
76
71
|
segments:
|
77
72
|
- 1
|
78
73
|
- 0
|
@@ -97,6 +92,7 @@ files:
|
|
97
92
|
- VERSION
|
98
93
|
- app/controllers/user_sessions_controller.rb
|
99
94
|
- app/controllers/users_controller.rb
|
95
|
+
- app/models/ability.rb
|
100
96
|
- app/models/user.rb
|
101
97
|
- app/models/user_session.rb
|
102
98
|
- app/views/user_sessions/new.html.erb
|
@@ -127,7 +123,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
127
123
|
requirements:
|
128
124
|
- - ">="
|
129
125
|
- !ruby/object:Gem::Version
|
130
|
-
hash: 3
|
131
126
|
segments:
|
132
127
|
- 0
|
133
128
|
version: "0"
|
@@ -136,7 +131,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
136
131
|
requirements:
|
137
132
|
- - ">="
|
138
133
|
- !ruby/object:Gem::Version
|
139
|
-
hash: 3
|
140
134
|
segments:
|
141
135
|
- 0
|
142
136
|
version: "0"
|