Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

425 lines (251 sloc) 16.061 kb
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta name="Content-Type" content="text/html; charset=utf-8" />
<title>Class: UserSessionsController</title>
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
<link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
<script type="text/javascript" charset="utf-8">
relpath = '';
if (relpath != '') relpath += '/';
</script>
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
</head>
<body>
<script type="text/javascript" charset="utf-8">
if (window.top.frames.main) document.body.className = 'frames';
</script>
<div id="header">
<div id="menu">
<a href="_index.html">Index (U)</a> &raquo;
<span class="title">UserSessionsController</span>
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
</div>
<div id="search">
<a id="class_list_link" href="#">Class List</a>
<a id="method_list_link" href="#">Method List</a>
<a id ="file_list_link" href="#">File List</a>
</div>
<div class="clear"></div>
</div>
<iframe id="search_frame"></iframe>
<div id="content"><h1>Class: UserSessionsController
</h1>
<dl class="box">
<dt class="r1">Inherits:</dt>
<dd class="r1">
<span class="inheritName"><span class='object_link'><a href="ApplicationController.html" title="ApplicationController (class)">ApplicationController</a></span></span>
<ul class="fullTree">
<li>Object</li>
<li class="next">ActionController::Base</li>
<li class="next"><span class='object_link'><a href="ApplicationController.html" title="ApplicationController (class)">ApplicationController</a></span></li>
<li class="next">UserSessionsController</li>
</ul>
<a href="#" class="inheritanceTree">show all</a>
</dd>
<dt class="r2 last">Defined in:</dt>
<dd class="r2 last">vendor/plugins/blacklight/app/controllers/user_sessions_controller.rb<span class="defines">,<br />
vendor/plugins/hydra_repository/app/controllers/user_sessions_controller.rb</span>
</dd>
</dl>
<div class="clear"></div>
<h2>
Instance Method Summary
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
</h2>
<ul class="summary">
<li class="public ">
<span class="summary_signature">
<a href="#create-instance_method" title="#create (instance method)">- (Object) <strong>create</strong> </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#destroy-instance_method" title="#destroy (instance method)">- (Object) <strong>destroy</strong> </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#new-instance_method" title="#new (instance method)">- (Object) <strong>new</strong> </a>
</span>
<span class="summary_desc"><div class='inline'><p>
def create.
</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#superuser-instance_method" title="#superuser (instance method)">- (Object) <strong>superuser</strong> </a>
</span>
<span class="summary_desc"><div class='inline'><p>
toggle to set superuser_mode in session Only allows user who can be
superusers to set this value in session.
</p>
</div></span>
</li>
</ul>
<h3 class="inherited">Methods inherited from <span class='object_link'><a href="ApplicationController.html" title="ApplicationController (class)">ApplicationController</a></span></h3>
<p class="inherited"><span class='object_link'><a href="ApplicationController.html#current_user-instance_method" title="ApplicationController#current_user (method)">#current_user</a></span>, <span class='object_link'><a href="ApplicationController.html#default_html_head-instance_method" title="ApplicationController#default_html_head (method)">#default_html_head</a></span>, <span class='object_link'><a href="ApplicationController.html#error-instance_method" title="ApplicationController#error (method)">#error</a></span>, <span class='object_link'><a href="ApplicationController.html#extra_head_content-instance_method" title="ApplicationController#extra_head_content (method)">#extra_head_content</a></span>, <span class='object_link'><a href="ApplicationController.html#javascript_includes-instance_method" title="ApplicationController#javascript_includes (method)">#javascript_includes</a></span>, <span class='object_link'><a href="ApplicationController.html#stylesheet_links-instance_method" title="ApplicationController#stylesheet_links (method)">#stylesheet_links</a></span>, <span class='object_link'><a href="ApplicationController.html#user_class-instance_method" title="ApplicationController#user_class (method)">#user_class</a></span></p>
<h3 class="inherited">Methods included from <span class='object_link'><a href="HydraAccessControlsHelper.html" title="HydraAccessControlsHelper (module)">HydraAccessControlsHelper</a></span></h3>
<p class="inherited"><span class='object_link'><a href="HydraAccessControlsHelper.html#editor%3F-instance_method" title="HydraAccessControlsHelper#editor? (method)">#editor?</a></span>, <span class='object_link'><a href="HydraAccessControlsHelper.html#reader%3F-instance_method" title="HydraAccessControlsHelper#reader? (method)">#reader?</a></span>, <span class='object_link'><a href="HydraAccessControlsHelper.html#test_permission-instance_method" title="HydraAccessControlsHelper#test_permission (method)">#test_permission</a></span></p>
<div id="instance_method_details" class="method_details_list">
<h2>Instance Method Details</h2>
<div class="method_details first">
<p class="signature first" id="create-instance_method">
- (<tt>Object</tt>) <strong>create</strong>
</p><table class="source_code">
<tr>
<td>
<pre class="lines">
27
28
29
30
31
32
33
34
35
36</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'vendor/plugins/blacklight/app/controllers/user_sessions_controller.rb', line 27</span>
<span class='def def kw'>def</span> <span class='create identifier id'>create</span>
<span class='@user_session ivar id'>@user_session</span> <span class='assign token'>=</span> <span class='UserSession constant id'>UserSession</span><span class='dot token'>.</span><span class='new identifier id'>new</span><span class='lparen token'>(</span><span class='params identifier id'>params</span><span class='lbrack token'>[</span><span class='symbol val'>:user_session</span><span class='rbrack token'>]</span><span class='rparen token'>)</span>
<span class='if if kw'>if</span> <span class='@user_session ivar id'>@user_session</span><span class='dot token'>.</span><span class='save identifier id'>save</span>
<span class='flash identifier id'>flash</span><span class='lbrack token'>[</span><span class='symbol val'>:notice</span><span class='rbrack token'>]</span> <span class='assign token'>=</span> <span class='dstring node'>&quot;Welcome #{@user_session.login}!&quot;</span>
<span class='redirect_to identifier id'>redirect_to</span> <span class='root_path identifier id'>root_path</span>
<span class='else else kw'>else</span>
<span class='flash identifier id'>flash</span><span class='dot token'>.</span><span class='now identifier id'>now</span><span class='lbrack token'>[</span><span class='symbol val'>:error</span><span class='rbrack token'>]</span> <span class='assign token'>=</span> <span class='string val'>&quot;Couldn't locate a user with those credentials&quot;</span>
<span class='render identifier id'>render</span> <span class='symbol val'>:action</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='symbol val'>:new</span>
<span class='end end kw'>end</span>
<span class='end end kw'>end</span>
</pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<p class="signature " id="destroy-instance_method">
- (<tt>Object</tt>) <strong>destroy</strong>
</p><table class="source_code">
<tr>
<td>
<pre class="lines">
38
39
40
41
42</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'vendor/plugins/blacklight/app/controllers/user_sessions_controller.rb', line 38</span>
<span class='def def kw'>def</span> <span class='destroy identifier id'>destroy</span>
<span class='current_user_session identifier id'>current_user_session</span><span class='dot token'>.</span><span class='destroy identifier id'>destroy</span>
<span class='flash identifier id'>flash</span><span class='lbrack token'>[</span><span class='symbol val'>:notice</span><span class='rbrack token'>]</span> <span class='assign token'>=</span> <span class='string val'>&quot;You have successfully logged out.&quot;</span>
<span class='redirect_to identifier id'>redirect_to</span> <span class='root_path identifier id'>root_path</span>
<span class='end end kw'>end</span>
</pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<p class="signature " id="new-instance_method">
- (<tt>Object</tt>) <strong>new</strong>
</p><div class="docstring">
<div class="discussion">
<p>
def create
</p>
<pre class="code">
<span class='if if kw'>if</span> <span class='user identifier id'>user</span> <span class='assign token'>=</span> <span class='User constant id'>User</span><span class='dot token'>.</span><span class='authenticate identifier id'>authenticate</span><span class='lparen token'>(</span><span class='params identifier id'>params</span><span class='lbrack token'>[</span><span class='symbol val'>:email</span><span class='rbrack token'>]</span><span class='comma token'>,</span> <span class='params identifier id'>params</span><span class='lbrack token'>[</span><span class='symbol val'>:password</span><span class='rbrack token'>]</span><span class='rparen token'>)</span>
<span class='self self kw'>self</span><span class='dot token'>.</span><span class='current_user identifier id'>current_user</span> <span class='assign token'>=</span> <span class='user identifier id'>user</span>
<span class='user identifier id'>user</span><span class='dot token'>.</span><span class='update_attribute identifier id'>update_attribute</span><span class='lparen token'>(</span><span class='symbol val'>:last_login</span><span class='comma token'>,</span> <span class='Time constant id'>Time</span><span class='dot token'>.</span><span class='now identifier id'>now</span><span class='rparen token'>)</span>
<span class='flash identifier id'>flash</span><span class='lbrack token'>[</span><span class='symbol val'>:notice</span><span class='rbrack token'>]</span> <span class='assign token'>=</span> <span class='dstring node'>&quot;Welcome #{user.login}!&quot;</span>
<span class='redirect_to identifier id'>redirect_to</span> <span class='root_path identifier id'>root_path</span>
<span class='else else kw'>else</span>
<span class='flash identifier id'>flash</span><span class='dot token'>.</span><span class='now identifier id'>now</span><span class='lbrack token'>[</span><span class='symbol val'>:error</span><span class='rbrack token'>]</span> <span class='assign token'>=</span> <span class='string val'>&quot;Couldn't locate a user with those credentials&quot;</span>
<span class='render identifier id'>render</span> <span class='symbol val'>:action</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='symbol val'>:new</span>
<span class='end end kw'>end</span>
<span class='end end kw'>end</span>
<span class='def def kw'>def</span> <span class='destroy identifier id'>destroy</span>
<span class='session identifier id'>session</span><span class='lbrack token'>[</span><span class='symbol val'>:user_id</span><span class='rbrack token'>]</span> <span class='assign token'>=</span> <span class='nil nil kw'>nil</span>
<span class='flash identifier id'>flash</span><span class='lbrack token'>[</span><span class='symbol val'>:notice</span><span class='rbrack token'>]</span> <span class='assign token'>=</span> <span class='string val'>&quot;You have successfully logged out.&quot;</span>
<span class='redirect_to identifier id'>redirect_to</span> <span class='root_path identifier id'>root_path</span>
<span class='end end kw'>end</span>
</pre>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
23
24
25</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'vendor/plugins/blacklight/app/controllers/user_sessions_controller.rb', line 23</span>
<span class='def def kw'>def</span> <span class='new identifier id'>new</span>
<span class='@user_session ivar id'>@user_session</span> <span class='assign token'>=</span> <span class='UserSession constant id'>UserSession</span><span class='dot token'>.</span><span class='new identifier id'>new</span>
<span class='end end kw'>end</span>
</pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<p class="signature " id="superuser-instance_method">
- (<tt>Object</tt>) <strong>superuser</strong>
</p><div class="docstring">
<div class="discussion">
<p>
toggle to set superuser_mode in session Only allows user who can be
superusers to set this value in session
</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
4
5
6
7
8
9
10
11</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'vendor/plugins/hydra_repository/app/controllers/user_sessions_controller.rb', line 4</span>
<span class='def def kw'>def</span> <span class='superuser identifier id'>superuser</span>
<span class='if if kw'>if</span> <span class='session identifier id'>session</span><span class='lbrack token'>[</span><span class='symbol val'>:superuser_mode</span><span class='rbrack token'>]</span>
<span class='session identifier id'>session</span><span class='lbrack token'>[</span><span class='symbol val'>:superuser_mode</span><span class='rbrack token'>]</span> <span class='assign token'>=</span> <span class='nil nil kw'>nil</span>
<span class='elsif elsif kw'>elsif</span> <span class='current_user identifier id'>current_user</span><span class='dot token'>.</span><span class='can_be_superuser? fid id'>can_be_superuser?</span>
<span class='session identifier id'>session</span><span class='lbrack token'>[</span><span class='symbol val'>:superuser_mode</span><span class='rbrack token'>]</span> <span class='assign token'>=</span> <span class='true true kw'>true</span>
<span class='end end kw'>end</span>
<span class='redirect_to identifier id'>redirect_to</span> <span class='symbol val'>:back</span>
<span class='end end kw'>end</span>
</pre>
</td>
</tr>
</table>
</div>
</div>
</div>
<div id="footer">
Generated on Mon Jan 17 21:46:35 2011 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.6.4 (ruby-1.8.7).
</div>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.