authentasaurus 0.7.3 → 0.8.3
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/TODO +3 -0
- data/app/controllers/areas_controller.rb +1 -1
- data/app/controllers/groups_controller.rb +1 -1
- data/app/controllers/permissions_controller.rb +1 -1
- data/app/controllers/recoveries_controller.rb +1 -1
- data/app/controllers/registrations_controller.rb +1 -1
- data/app/controllers/sessions_controller.rb +1 -1
- data/app/controllers/user_invitations_controller.rb +1 -1
- data/app/controllers/users_controller.rb +1 -1
- data/app/controllers/validations_controller.rb +1 -1
- data/app/models/area.rb +1 -1
- data/app/models/group.rb +1 -1
- data/app/models/permission.rb +1 -1
- data/app/models/recovery.rb +1 -1
- data/app/models/session.rb +1 -1
- data/app/models/user_invitation.rb +1 -1
- data/app/models/validation.rb +1 -1
- data/lib/authentasaurus.rb +22 -36
- data/lib/authentasaurus/ac/acts_as_overrider.rb +47 -0
- data/lib/authentasaurus/ac/controllers/areas_controller.rb +80 -0
- data/lib/authentasaurus/ac/controllers/groups_controller.rb +81 -0
- data/lib/authentasaurus/ac/controllers/permissions_controller.rb +81 -0
- data/lib/authentasaurus/ac/controllers/recoveries_controller.rb +72 -0
- data/lib/authentasaurus/ac/controllers/registrations_controller.rb +45 -0
- data/lib/authentasaurus/ac/controllers/sessions_controller.rb +58 -0
- data/lib/authentasaurus/ac/controllers/user_invitations_controller.rb +50 -0
- data/lib/authentasaurus/ac/controllers/users_controller.rb +80 -0
- data/lib/authentasaurus/ac/controllers/validations_controller.rb +53 -0
- data/lib/authentasaurus/ac/routing.rb +90 -0
- data/lib/authentasaurus/ar/acts_as_authenticatable.rb +113 -0
- data/lib/authentasaurus/ar/acts_as_authenticatable_validatable.rb +38 -0
- data/lib/authentasaurus/ar/acts_as_overrider.rb +51 -0
- data/lib/authentasaurus/ar/authenticatable.rb +66 -0
- data/lib/authentasaurus/ar/migrations.rb +173 -0
- data/lib/authentasaurus/{models → ar/models}/recovery.rb +3 -3
- data/lib/authentasaurus/{models → ar/models}/session.rb +1 -1
- data/lib/authentasaurus/{models → ar/models}/user_invitation.rb +1 -1
- data/lib/authentasaurus/{models → ar/models}/validation.rb +1 -1
- data/lib/authentasaurus/arel/acts_as_authenticatable.rb +72 -0
- data/lib/authentasaurus/arel/authenticatable.rb +25 -0
- data/lib/authentasaurus/authorization.rb +341 -0
- data/lib/authentasaurus/railtie.rb +4 -4
- data/lib/generators/authentasaurus/install/templates/initializer.rb +1 -1
- data/rdoc/apple-touch-icon.png +0 -0
- data/rdoc/classes/Authentasaurus.html +65 -0
- data/rdoc/classes/Authentasaurus/Ac.html +72 -0
- data/rdoc/classes/Authentasaurus/Ac/ActsAsOverrider.html +104 -0
- data/rdoc/classes/Authentasaurus/Ac/ActsAsOverrider/ClassMethods.html +397 -0
- data/rdoc/classes/Authentasaurus/Ac/Routing.html +61 -0
- data/rdoc/classes/Authentasaurus/Ac/Routing/InstanceMethods.html +390 -0
- data/rdoc/classes/Authentasaurus/Ar.html +77 -0
- data/rdoc/classes/Authentasaurus/Ar/ActsAsAuthenticatable.html +107 -0
- data/rdoc/classes/Authentasaurus/Ar/ActsAsAuthenticatable/ClassMethods.html +168 -0
- data/rdoc/classes/Authentasaurus/Ar/ActsAsAuthenticatable/InstanceMethods.html +357 -0
- data/rdoc/classes/Authentasaurus/Ar/ActsAsAuthenticatableValidatable.html +109 -0
- data/rdoc/classes/Authentasaurus/Ar/ActsAsAuthenticatableValidatable/ClassMethods.html +113 -0
- data/rdoc/classes/Authentasaurus/Ar/ActsAsAuthenticatableValidatable/InstanceMethods.html +54 -0
- data/rdoc/classes/Authentasaurus/Ar/ActsAsOverrider.html +104 -0
- data/rdoc/classes/Authentasaurus/Ar/ActsAsOverrider/ClassMethods.html +320 -0
- data/rdoc/classes/Authentasaurus/Ar/Authenticatable.html +104 -0
- data/rdoc/classes/Authentasaurus/Ar/Authenticatable/ClassMethods.html +182 -0
- data/rdoc/classes/Authentasaurus/Ar/Migrations.html +63 -0
- data/rdoc/classes/Authentasaurus/Ar/Migrations/Columns.html +68 -0
- data/rdoc/classes/Authentasaurus/Ar/Migrations/Columns/InstanceMethods.html +106 -0
- data/rdoc/classes/Authentasaurus/Ar/Migrations/Tables.html +68 -0
- data/rdoc/classes/Authentasaurus/Ar/Migrations/Tables/InstanceMethods.html +703 -0
- data/rdoc/classes/Authentasaurus/Arel.html +65 -0
- data/rdoc/classes/Authentasaurus/Arel/ActsAsAuthenticatable.html +107 -0
- data/rdoc/classes/Authentasaurus/Arel/ActsAsAuthenticatable/ClassMethods.html +139 -0
- data/rdoc/classes/Authentasaurus/Arel/ActsAsAuthenticatable/InstanceMethods.html +113 -0
- data/rdoc/classes/Authentasaurus/Arel/Authenticatable.html +105 -0
- data/rdoc/classes/Authentasaurus/Arel/Authenticatable/ClassMethods.html +119 -0
- data/rdoc/classes/Authentasaurus/Authorization.html +230 -0
- data/rdoc/classes/Authentasaurus/Authorization/ActionController.html +63 -0
- data/rdoc/classes/Authentasaurus/Authorization/ActionController/ClassMethods.html +263 -0
- data/rdoc/classes/Authentasaurus/Authorization/ActionController/InstanceMethods.html +54 -0
- data/rdoc/classes/Authentasaurus/Authorization/ActionView.html +54 -0
- data/rdoc/classes/Authentasaurus/Authorization/CommonInstanceMethods.html +240 -0
- data/rdoc/created.rid +1 -0
- data/rdoc/css/main.css +278 -0
- data/rdoc/css/panel.css +383 -0
- data/rdoc/css/reset.css +53 -0
- data/rdoc/favicon.ico +0 -0
- data/rdoc/files/README_rdoc.html +366 -0
- data/rdoc/files/TODO.html +64 -0
- data/rdoc/files/lib/authentasaurus/ac/acts_as_overrider_rb.html +52 -0
- data/rdoc/files/lib/authentasaurus/ac/routing_rb.html +60 -0
- data/rdoc/files/lib/authentasaurus/ar/acts_as_authenticatable_rb.html +52 -0
- data/rdoc/files/lib/authentasaurus/ar/acts_as_authenticatable_validatable_rb.html +52 -0
- data/rdoc/files/lib/authentasaurus/ar/acts_as_overrider_rb.html +52 -0
- data/rdoc/files/lib/authentasaurus/ar/authenticatable_rb.html +52 -0
- data/rdoc/files/lib/authentasaurus/ar/migrations_rb.html +52 -0
- data/rdoc/files/lib/authentasaurus/arel/acts_as_authenticatable_rb.html +52 -0
- data/rdoc/files/lib/authentasaurus/arel/authenticatable_rb.html +72 -0
- data/rdoc/files/lib/authentasaurus/authorization_rb.html +208 -0
- data/rdoc/i/arrows.png +0 -0
- data/rdoc/i/results_bg.png +0 -0
- data/rdoc/i/tree_bg.png +0 -0
- data/rdoc/index.html +15 -0
- data/rdoc/js/jquery-1.3.2.min.js +19 -0
- data/rdoc/js/jquery-effect.js +593 -0
- data/rdoc/js/main.js +22 -0
- data/rdoc/js/searchdoc.js +628 -0
- data/rdoc/panel/index.html +71 -0
- data/rdoc/panel/search_index.js +1 -0
- data/rdoc/panel/tree.js +1 -0
- metadata +92 -44
- data/lib/action_controller/authorization.rb +0 -215
- data/lib/action_view/authorization.rb +0 -52
- data/lib/active_record/acts_as_authenticatable.rb +0 -111
- data/lib/active_record/acts_as_authenticatable_validatable.rb +0 -36
- data/lib/active_record/authenticatable.rb +0 -64
- data/lib/active_resource/acts_as_authenticatable.rb +0 -70
- data/lib/active_resource/authenticatable.rb +0 -24
- data/lib/authentasaurus/areas_controller.rb +0 -78
- data/lib/authentasaurus/groups_controller.rb +0 -79
- data/lib/authentasaurus/models/area.rb +0 -21
- data/lib/authentasaurus/models/group.rb +0 -19
- data/lib/authentasaurus/models/permission.rb +0 -24
- data/lib/authentasaurus/permissions_controller.rb +0 -79
- data/lib/authentasaurus/recoveries_controller.rb +0 -70
- data/lib/authentasaurus/registrations_controller.rb +0 -43
- data/lib/authentasaurus/sessions_controller.rb +0 -56
- data/lib/authentasaurus/user_invitations_controller.rb +0 -48
- data/lib/authentasaurus/users_controller.rb +0 -78
- data/lib/authentasaurus/validations_controller.rb +0 -51
- data/lib/helpers/migrations.rb +0 -171
- data/lib/helpers/routing.rb +0 -87
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
3
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
5
|
+
<head>
|
|
6
|
+
<title>Authentasaurus::Authorization::ActionController::InstanceMethods</title>
|
|
7
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
8
|
+
<link rel="stylesheet" href="../../../../css/reset.css" type="text/css" media="screen" />
|
|
9
|
+
<link rel="stylesheet" href="../../../../css/main.css" type="text/css" media="screen" />
|
|
10
|
+
<script src="../../../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
|
|
11
|
+
<script src="../../../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
|
|
12
|
+
<script src="../../../../js/main.js" type="text/javascript" charset="utf-8"></script>
|
|
13
|
+
</head>
|
|
14
|
+
|
|
15
|
+
<body>
|
|
16
|
+
<div class="banner">
|
|
17
|
+
<h1>
|
|
18
|
+
<span class="type">Module</span>
|
|
19
|
+
Authentasaurus::Authorization::ActionController::InstanceMethods
|
|
20
|
+
|
|
21
|
+
</h1>
|
|
22
|
+
<ul class="files">
|
|
23
|
+
|
|
24
|
+
<li><a href="../../../../files/lib/authentasaurus/authorization_rb.html">lib/authentasaurus/authorization.rb</a></li>
|
|
25
|
+
|
|
26
|
+
</ul>
|
|
27
|
+
</div>
|
|
28
|
+
<div id="bodyContent">
|
|
29
|
+
<div id="content">
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
</body>
|
|
54
|
+
</html>
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
3
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
5
|
+
<head>
|
|
6
|
+
<title>Authentasaurus::Authorization::ActionView</title>
|
|
7
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
8
|
+
<link rel="stylesheet" href="../../../css/reset.css" type="text/css" media="screen" />
|
|
9
|
+
<link rel="stylesheet" href="../../../css/main.css" type="text/css" media="screen" />
|
|
10
|
+
<script src="../../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
|
|
11
|
+
<script src="../../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
|
|
12
|
+
<script src="../../../js/main.js" type="text/javascript" charset="utf-8"></script>
|
|
13
|
+
</head>
|
|
14
|
+
|
|
15
|
+
<body>
|
|
16
|
+
<div class="banner">
|
|
17
|
+
<h1>
|
|
18
|
+
<span class="type">Module</span>
|
|
19
|
+
Authentasaurus::Authorization::ActionView
|
|
20
|
+
|
|
21
|
+
</h1>
|
|
22
|
+
<ul class="files">
|
|
23
|
+
|
|
24
|
+
<li><a href="../../../files/lib/authentasaurus/authorization_rb.html">lib/authentasaurus/authorization.rb</a></li>
|
|
25
|
+
|
|
26
|
+
</ul>
|
|
27
|
+
</div>
|
|
28
|
+
<div id="bodyContent">
|
|
29
|
+
<div id="content">
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
</body>
|
|
54
|
+
</html>
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
3
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
5
|
+
<head>
|
|
6
|
+
<title>Authentasaurus::Authorization::CommonInstanceMethods</title>
|
|
7
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
8
|
+
<link rel="stylesheet" href="../../../css/reset.css" type="text/css" media="screen" />
|
|
9
|
+
<link rel="stylesheet" href="../../../css/main.css" type="text/css" media="screen" />
|
|
10
|
+
<script src="../../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
|
|
11
|
+
<script src="../../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
|
|
12
|
+
<script src="../../../js/main.js" type="text/javascript" charset="utf-8"></script>
|
|
13
|
+
</head>
|
|
14
|
+
|
|
15
|
+
<body>
|
|
16
|
+
<div class="banner">
|
|
17
|
+
<h1>
|
|
18
|
+
<span class="type">Module</span>
|
|
19
|
+
Authentasaurus::Authorization::CommonInstanceMethods
|
|
20
|
+
|
|
21
|
+
</h1>
|
|
22
|
+
<ul class="files">
|
|
23
|
+
|
|
24
|
+
<li><a href="../../../files/lib/authentasaurus/authorization_rb.html">lib/authentasaurus/authorization.rb</a></li>
|
|
25
|
+
|
|
26
|
+
</ul>
|
|
27
|
+
</div>
|
|
28
|
+
<div id="bodyContent">
|
|
29
|
+
<div id="content">
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
<div class="sectiontitle">Methods</div>
|
|
40
|
+
<dl class="methods">
|
|
41
|
+
|
|
42
|
+
<dt>C</dt>
|
|
43
|
+
<dd>
|
|
44
|
+
<ul>
|
|
45
|
+
|
|
46
|
+
<li><a href="#M000005">current_user</a></li>
|
|
47
|
+
|
|
48
|
+
</ul>
|
|
49
|
+
</dd>
|
|
50
|
+
|
|
51
|
+
<dt>H</dt>
|
|
52
|
+
<dd>
|
|
53
|
+
<ul>
|
|
54
|
+
|
|
55
|
+
<li><a href="#M000006">has?</a></li>
|
|
56
|
+
|
|
57
|
+
</ul>
|
|
58
|
+
</dd>
|
|
59
|
+
|
|
60
|
+
<dt>I</dt>
|
|
61
|
+
<dd>
|
|
62
|
+
<ul>
|
|
63
|
+
|
|
64
|
+
<li><a href="#M000009">is_logged_in?</a></li>
|
|
65
|
+
|
|
66
|
+
</ul>
|
|
67
|
+
</dd>
|
|
68
|
+
|
|
69
|
+
</dl>
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
<div class="sectiontitle">Instance Public methods</div>
|
|
84
|
+
|
|
85
|
+
<div class="method">
|
|
86
|
+
<div class="title" id="M000005">
|
|
87
|
+
|
|
88
|
+
<a name="M000005"></a><b>current_user</b>(user_model = nil)
|
|
89
|
+
|
|
90
|
+
</div>
|
|
91
|
+
|
|
92
|
+
<div class="description">
|
|
93
|
+
<p>
|
|
94
|
+
Returns an object of the current user
|
|
95
|
+
</p>
|
|
96
|
+
<p>
|
|
97
|
+
<b>Parameters:</b>
|
|
98
|
+
</p>
|
|
99
|
+
<pre>
|
|
100
|
+
user_model - The model class representing a user (User by default)
|
|
101
|
+
</pre>
|
|
102
|
+
|
|
103
|
+
</div>
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
<div class="sourcecode">
|
|
109
|
+
<p class="source-link">
|
|
110
|
+
Source: <a href="javascript:toggleSource('M000005_source')" id="l_M000005_source">show</a>
|
|
111
|
+
|
|
112
|
+
| <a href="http://github.com/cousine/Authentasuarus-2/blob/9f35019b78d87fdf386c9d64834171263868b8aa/lib/authentasaurus/authorization.rb#L110" target="_blank" class="github_url">on GitHub</a>
|
|
113
|
+
|
|
114
|
+
</p>
|
|
115
|
+
<div id="M000005_source" class="dyn-source">
|
|
116
|
+
<pre><span class="ruby-comment cmt"># File lib/authentasaurus/authorization.rb, line 110</span>
|
|
117
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">current_user</span>(<span class="ruby-identifier">user_model</span> = <span class="ruby-keyword kw">nil</span>)<span class="ruby-comment cmt">#:doc:</span>
|
|
118
|
+
<span class="ruby-identifier">user_model</span> = <span class="ruby-constant">User</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">user_model</span>.<span class="ruby-identifier">nil?</span>
|
|
119
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">user_model</span>.<span class="ruby-identifier">find</span> <span class="ruby-identifier">session</span>[<span class="ruby-identifier">:user_id</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">session</span>[<span class="ruby-identifier">:user_id</span>]
|
|
120
|
+
<span class="ruby-keyword kw">end</span></pre>
|
|
121
|
+
</div>
|
|
122
|
+
</div>
|
|
123
|
+
|
|
124
|
+
</div>
|
|
125
|
+
|
|
126
|
+
<div class="method">
|
|
127
|
+
<div class="title" id="M000006">
|
|
128
|
+
|
|
129
|
+
<a name="M000006"></a><b>has?</b>(permission, area = nil)
|
|
130
|
+
|
|
131
|
+
</div>
|
|
132
|
+
|
|
133
|
+
<div class="description">
|
|
134
|
+
<p>
|
|
135
|
+
Checks if the current user has the appropriate permission
|
|
136
|
+
</p>
|
|
137
|
+
<p>
|
|
138
|
+
<b>ex</b>:
|
|
139
|
+
</p>
|
|
140
|
+
<pre>
|
|
141
|
+
has?(:write) or has?(:read, :users)
|
|
142
|
+
</pre>
|
|
143
|
+
<p>
|
|
144
|
+
<b>Parameters:</b>
|
|
145
|
+
</p>
|
|
146
|
+
<pre>
|
|
147
|
+
permission - The permission to check, either :read or :write
|
|
148
|
+
area - The area to check the permission on, by default checks the current area.
|
|
149
|
+
</pre>
|
|
150
|
+
|
|
151
|
+
</div>
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
<div class="sourcecode">
|
|
157
|
+
<p class="source-link">
|
|
158
|
+
Source: <a href="javascript:toggleSource('M000006_source')" id="l_M000006_source">show</a>
|
|
159
|
+
|
|
160
|
+
| <a href="http://github.com/cousine/Authentasuarus-2/blob/9f35019b78d87fdf386c9d64834171263868b8aa/lib/authentasaurus/authorization.rb#L124" target="_blank" class="github_url">on GitHub</a>
|
|
161
|
+
|
|
162
|
+
</p>
|
|
163
|
+
<div id="M000006_source" class="dyn-source">
|
|
164
|
+
<pre><span class="ruby-comment cmt"># File lib/authentasaurus/authorization.rb, line 124</span>
|
|
165
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">has?</span>(<span class="ruby-identifier">permission</span>, <span class="ruby-identifier">area</span> = <span class="ruby-keyword kw">nil</span>) <span class="ruby-comment cmt">#:doc:</span>
|
|
166
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">is_logged_in?</span>
|
|
167
|
+
<span class="ruby-identifier">check</span> = <span class="ruby-keyword kw">false</span>
|
|
168
|
+
<span class="ruby-keyword kw">case</span> <span class="ruby-identifier">permission</span>
|
|
169
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:write</span>
|
|
170
|
+
<span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">area</span>
|
|
171
|
+
<span class="ruby-identifier">user_permissions</span> = <span class="ruby-identifier">session</span>[<span class="ruby-identifier">:user_permissions</span>]
|
|
172
|
+
<span class="ruby-identifier">check</span> = <span class="ruby-identifier">user_permissions</span>[<span class="ruby-identifier">:write</span>].<span class="ruby-identifier">find</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">perm</span><span class="ruby-operator">|</span> <span class="ruby-identifier">perm</span><span class="ruby-operator">==</span><span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">controller_name</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">perm</span><span class="ruby-operator">==</span><span class="ruby-value str">"all"</span> }
|
|
173
|
+
<span class="ruby-keyword kw">else</span>
|
|
174
|
+
<span class="ruby-identifier">user_permissions</span> = <span class="ruby-identifier">session</span>[<span class="ruby-identifier">:user_permissions</span>]
|
|
175
|
+
<span class="ruby-identifier">check</span> = <span class="ruby-identifier">user_permissions</span>[<span class="ruby-identifier">:write</span>].<span class="ruby-identifier">find</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">perm</span><span class="ruby-operator">|</span> <span class="ruby-identifier">perm</span><span class="ruby-operator">==</span><span class="ruby-identifier">area</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">perm</span><span class="ruby-operator">==</span><span class="ruby-value str">"all"</span> }
|
|
176
|
+
<span class="ruby-keyword kw">end</span>
|
|
177
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:read</span>
|
|
178
|
+
<span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">area</span>
|
|
179
|
+
<span class="ruby-identifier">user_permissions</span> = <span class="ruby-identifier">session</span>[<span class="ruby-identifier">:user_permissions</span>]
|
|
180
|
+
<span class="ruby-identifier">check</span> = <span class="ruby-identifier">user_permissions</span>[<span class="ruby-identifier">:read</span>].<span class="ruby-identifier">find</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">perm</span><span class="ruby-operator">|</span> <span class="ruby-identifier">perm</span><span class="ruby-operator">==</span><span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">controller_name</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">perm</span><span class="ruby-operator">==</span><span class="ruby-value str">"all"</span> }
|
|
181
|
+
<span class="ruby-keyword kw">else</span>
|
|
182
|
+
<span class="ruby-identifier">user_permissions</span> = <span class="ruby-identifier">session</span>[<span class="ruby-identifier">:user_permissions</span>]
|
|
183
|
+
<span class="ruby-identifier">check</span> = <span class="ruby-identifier">user_permissions</span>[<span class="ruby-identifier">:read</span>].<span class="ruby-identifier">find</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">perm</span><span class="ruby-operator">|</span> <span class="ruby-identifier">perm</span><span class="ruby-operator">==</span><span class="ruby-identifier">area</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">perm</span><span class="ruby-operator">==</span><span class="ruby-value str">"all"</span> }
|
|
184
|
+
<span class="ruby-keyword kw">end</span>
|
|
185
|
+
<span class="ruby-keyword kw">end</span>
|
|
186
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">check</span>
|
|
187
|
+
<span class="ruby-keyword kw">end</span></pre>
|
|
188
|
+
</div>
|
|
189
|
+
</div>
|
|
190
|
+
|
|
191
|
+
</div>
|
|
192
|
+
|
|
193
|
+
<div class="method">
|
|
194
|
+
<div class="title" id="M000009">
|
|
195
|
+
|
|
196
|
+
<a name="M000009"></a><b>is_logged_in?</b>(user_model = nil)
|
|
197
|
+
|
|
198
|
+
</div>
|
|
199
|
+
|
|
200
|
+
<div class="description">
|
|
201
|
+
<p>
|
|
202
|
+
Checks if the current user is logged in but takes no further action
|
|
203
|
+
</p>
|
|
204
|
+
<p>
|
|
205
|
+
<b>Parameters:</b>
|
|
206
|
+
</p>
|
|
207
|
+
<pre>
|
|
208
|
+
user_model - The model class representing a user (User by default)
|
|
209
|
+
</pre>
|
|
210
|
+
|
|
211
|
+
</div>
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
<div class="sourcecode">
|
|
217
|
+
<p class="source-link">
|
|
218
|
+
Source: <a href="javascript:toggleSource('M000009_source')" id="l_M000009_source">show</a>
|
|
219
|
+
|
|
220
|
+
| <a href="http://github.com/cousine/Authentasuarus-2/blob/9f35019b78d87fdf386c9d64834171263868b8aa/lib/authentasaurus/authorization.rb#L153" target="_blank" class="github_url">on GitHub</a>
|
|
221
|
+
|
|
222
|
+
</p>
|
|
223
|
+
<div id="M000009_source" class="dyn-source">
|
|
224
|
+
<pre><span class="ruby-comment cmt"># File lib/authentasaurus/authorization.rb, line 153</span>
|
|
225
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">is_logged_in?</span>(<span class="ruby-identifier">user_model</span> = <span class="ruby-keyword kw">nil</span>) <span class="ruby-comment cmt">#:doc:</span>
|
|
226
|
+
<span class="ruby-identifier">user_model</span> = <span class="ruby-constant">User</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">user_model</span>.<span class="ruby-identifier">nil?</span>
|
|
227
|
+
<span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">user_model</span>.<span class="ruby-identifier">find_by_id</span>(<span class="ruby-identifier">session</span>[<span class="ruby-identifier">:user_id</span>])
|
|
228
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">cookie_login?</span>(<span class="ruby-identifier">user_model</span>)
|
|
229
|
+
<span class="ruby-keyword kw">end</span>
|
|
230
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span>
|
|
231
|
+
<span class="ruby-keyword kw">end</span></pre>
|
|
232
|
+
</div>
|
|
233
|
+
</div>
|
|
234
|
+
|
|
235
|
+
</div>
|
|
236
|
+
|
|
237
|
+
</div>
|
|
238
|
+
</div>
|
|
239
|
+
</body>
|
|
240
|
+
</html>
|
data/rdoc/created.rid
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Mon, 22 Nov 2010 01:25:26 +0200
|
data/rdoc/css/main.css
ADDED
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
body {
|
|
2
|
+
font-family: "Helvetica Neue", Arial, sans-serif;
|
|
3
|
+
background: #FFF;
|
|
4
|
+
color: #000;
|
|
5
|
+
margin: 0px;
|
|
6
|
+
font-size: 0.82em;
|
|
7
|
+
line-height: 1.25em;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
a {
|
|
11
|
+
color: #00F;
|
|
12
|
+
text-decoration: none;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
a:hover {
|
|
16
|
+
color: #333;
|
|
17
|
+
background: #FE8;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
p {
|
|
21
|
+
margin-bottom: 1em;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
h1 {
|
|
25
|
+
font-size: 2.1em;
|
|
26
|
+
font-weight: normal;
|
|
27
|
+
line-height: 1.2em;
|
|
28
|
+
margin: 1.4em 0 0.7em 0;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
h2 {
|
|
32
|
+
font-size: 1.6em;
|
|
33
|
+
margin: 1.8em 0 0.8em 0;
|
|
34
|
+
font-weight: normal;
|
|
35
|
+
line-height: 1.2em;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
h3 {
|
|
39
|
+
font-size: 1.4em;
|
|
40
|
+
color:#555;
|
|
41
|
+
margin: 1.4em 0 0.7em 0;
|
|
42
|
+
font-weight: normal;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
h4 {
|
|
46
|
+
margin: 1.4em 0 0.5em 0;
|
|
47
|
+
font-size: 1em;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
table
|
|
51
|
+
{
|
|
52
|
+
margin-bottom: 1em;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
td, th
|
|
56
|
+
{
|
|
57
|
+
padding: 0 0.7em 0.3em 0;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
th
|
|
61
|
+
{
|
|
62
|
+
font-weight: bold;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.clear
|
|
66
|
+
{
|
|
67
|
+
clear: both;
|
|
68
|
+
width: 0; height: 0;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
dt
|
|
72
|
+
{
|
|
73
|
+
margin-bottom: 0.3em;
|
|
74
|
+
font-weight: bold;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
dd
|
|
78
|
+
{
|
|
79
|
+
margin-left: 2em;
|
|
80
|
+
margin-bottom: 1em;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
dd p
|
|
84
|
+
{
|
|
85
|
+
margin-top: 0.6em;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
li
|
|
89
|
+
{
|
|
90
|
+
margin: 0 0 0.5em 2em;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
ul li
|
|
94
|
+
{
|
|
95
|
+
list-style: disc;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
ol li
|
|
99
|
+
{
|
|
100
|
+
list-style: decimal;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.banner
|
|
104
|
+
{
|
|
105
|
+
background: #EDF3FE;
|
|
106
|
+
border-bottom: 1px solid #ccc;
|
|
107
|
+
padding: 1em 2em 0.5em 2em;
|
|
108
|
+
}
|
|
109
|
+
.banner h1
|
|
110
|
+
{
|
|
111
|
+
font-size: 1.2em;
|
|
112
|
+
margin: 0;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.banner h1 .type
|
|
116
|
+
{
|
|
117
|
+
font-size: 0.833em;
|
|
118
|
+
display:block;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.banner h1 .type,
|
|
122
|
+
.banner h1 .parent
|
|
123
|
+
{
|
|
124
|
+
color: #666;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.banner ul
|
|
128
|
+
{
|
|
129
|
+
margin-top: 0.3em;
|
|
130
|
+
margin-bottom: 0;
|
|
131
|
+
font-size: 0.85em;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.banner li
|
|
135
|
+
{
|
|
136
|
+
list-style: none;
|
|
137
|
+
margin-left: 0;
|
|
138
|
+
margin-bottom: 0;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
pre
|
|
142
|
+
{
|
|
143
|
+
margin-bottom: 1em;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.methods dt
|
|
147
|
+
{
|
|
148
|
+
width: 1em;
|
|
149
|
+
font-size: 1.5em;
|
|
150
|
+
color:#AAA;
|
|
151
|
+
position: absolute;
|
|
152
|
+
font-weight: normal;
|
|
153
|
+
margin: 0;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.methods dd
|
|
157
|
+
{
|
|
158
|
+
margin-left: 2.5em;
|
|
159
|
+
min-height: 1.8em;
|
|
160
|
+
-height: 1.8em;
|
|
161
|
+
padding-bottom: 0.8em;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
.methods ul li
|
|
166
|
+
{
|
|
167
|
+
margin-right: 0.7em;
|
|
168
|
+
margin-left: 0;
|
|
169
|
+
list-style: none;
|
|
170
|
+
display: inline;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
#content {
|
|
174
|
+
margin: 2em;
|
|
175
|
+
margin-left: 3.5em;
|
|
176
|
+
margin-right: 3.5em;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
.sectiontitle {
|
|
181
|
+
margin-top: 2em;
|
|
182
|
+
margin-bottom: 1.3em;
|
|
183
|
+
margin-left: -1.2em;
|
|
184
|
+
font-size: 1.2em;
|
|
185
|
+
padding: 0 0 0.25em 0;
|
|
186
|
+
font-weight: bold;
|
|
187
|
+
border-bottom: 1px solid #000;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.attr-rw {
|
|
191
|
+
padding-right: 1em;
|
|
192
|
+
text-align: center;
|
|
193
|
+
color: #055;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.attr-name {
|
|
197
|
+
font-weight: bold;
|
|
198
|
+
padding-right: 1em;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
.attr-desc {
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
tt {
|
|
205
|
+
font-size: 1.15em;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.attr-value {
|
|
209
|
+
font-family: monospace;
|
|
210
|
+
padding-left: 1em;
|
|
211
|
+
font-size: 1.15em;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.dyn-source {
|
|
215
|
+
display: none;
|
|
216
|
+
background: #fffde8;
|
|
217
|
+
color: #000;
|
|
218
|
+
border: #ffe0bb dotted 1px;
|
|
219
|
+
margin: 0.5em 2em 0.5em 0;
|
|
220
|
+
padding: 0.5em;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.dyn-source .cmt {
|
|
224
|
+
color: #00F;
|
|
225
|
+
font-style: italic;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.dyn-source .kw {
|
|
229
|
+
color: #070;
|
|
230
|
+
font-weight: bold;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.description pre {
|
|
234
|
+
padding: 0.5em;
|
|
235
|
+
border: #ffe0bb dotted 1px;
|
|
236
|
+
background: #fffde8;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
.method {
|
|
240
|
+
margin-bottom: 2em;
|
|
241
|
+
}
|
|
242
|
+
.method .description,
|
|
243
|
+
.method .sourcecode
|
|
244
|
+
{
|
|
245
|
+
margin-left: 1.2em;
|
|
246
|
+
}
|
|
247
|
+
.method h4
|
|
248
|
+
{
|
|
249
|
+
border-bottom: 1px dotted #999;
|
|
250
|
+
padding: 0 0 0.2em 0;
|
|
251
|
+
margin-bottom: 0.8em;
|
|
252
|
+
font-size: 1.1em;
|
|
253
|
+
color:#333;
|
|
254
|
+
}
|
|
255
|
+
.method .title {
|
|
256
|
+
border-bottom: 1px dotted #666;
|
|
257
|
+
padding: 0 0 0.15em 0;
|
|
258
|
+
margin: 0 0 0.5em 0;
|
|
259
|
+
font-size: 1.2em;
|
|
260
|
+
line-height: 1.25em;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
.method .sourcecode p.source-link {
|
|
264
|
+
text-indent: 0em;
|
|
265
|
+
margin-top: 0.5em;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
.method .aka {
|
|
269
|
+
margin-top: 0.3em;
|
|
270
|
+
margin-left: 1em;
|
|
271
|
+
font-style: italic;
|
|
272
|
+
text-indent: 2em;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
.method .source-link
|
|
276
|
+
{
|
|
277
|
+
font-size: 0.85em;
|
|
278
|
+
}
|