gitlabhq/doc/code/classes/Account.html
2012-12-30 14:43:00 +02:00

1032 lines
37 KiB
HTML

<?xml version="1.0" encoding="utf-8"?>
<!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>
<title>Account</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../css/main.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../css/github.css" type="text/css" media="screen" />
<script src="../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/main.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<h1>
<span class="type">Module</span>
Account
</h1>
<ul class="files">
<li><a href="../files/app/roles/account_rb.html">app/roles/account.rb</a></li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<!-- Method ref -->
<div class="sectiontitle">Methods</div>
<dl class="methods">
<dt>A</dt>
<dd>
<ul>
<li>
<a href="#method-i-abilities">abilities</a>,
</li>
<li>
<a href="#method-i-authorized_groups">authorized_groups</a>,
</li>
<li>
<a href="#method-i-authorized_projects">authorized_projects</a>
</li>
</ul>
</dd>
<dt>B</dt>
<dd>
<ul>
<li>
<a href="#method-i-block">block</a>
</li>
</ul>
</dd>
<dt>C</dt>
<dd>
<ul>
<li>
<a href="#method-i-can-3F">can?</a>,
</li>
<li>
<a href="#method-i-can_create_group-3F">can_create_group?</a>,
</li>
<li>
<a href="#method-i-can_create_project-3F">can_create_project?</a>,
</li>
<li>
<a href="#method-i-cared_merge_requests">cared_merge_requests</a>
</li>
</ul>
</dd>
<dt>F</dt>
<dd>
<ul>
<li>
<a href="#method-i-first_name">first_name</a>
</li>
</ul>
</dd>
<dt>I</dt>
<dd>
<ul>
<li>
<a href="#method-i-identifier">identifier</a>,
</li>
<li>
<a href="#method-i-is_admin-3F">is_admin?</a>
</li>
</ul>
</dd>
<dt>L</dt>
<dd>
<ul>
<li>
<a href="#method-i-last_activity_project">last_activity_project</a>
</li>
</ul>
</dd>
<dt>M</dt>
<dd>
<ul>
<li>
<a href="#method-i-my_own_projects">my_own_projects</a>
</li>
</ul>
</dd>
<dt>N</dt>
<dd>
<ul>
<li>
<a href="#method-i-namespace_id">namespace_id</a>,
</li>
<li>
<a href="#method-i-namespaces">namespaces</a>
</li>
</ul>
</dd>
<dt>P</dt>
<dd>
<ul>
<li>
<a href="#method-i-project_ids">project_ids</a>,
</li>
<li>
<a href="#method-i-projects_limit_percent">projects_limit_percent</a>,
</li>
<li>
<a href="#method-i-projects_sorted_by_activity">projects_sorted_by_activity</a>
</li>
</ul>
</dd>
<dt>R</dt>
<dd>
<ul>
<li>
<a href="#method-i-recent_push">recent_push</a>,
</li>
<li>
<a href="#method-i-require_ssh_key-3F">require_ssh_key?</a>
</li>
</ul>
</dd>
<dt>S</dt>
<dd>
<ul>
<li>
<a href="#method-i-several_namespaces-3F">several_namespaces?</a>
</li>
</ul>
</dd>
</dl>
<!-- Methods -->
<div class="sectiontitle">Instance Public methods</div>
<div class="method">
<div class="title method-title" id="method-i-abilities">
<b>abilities</b>()
<a href="../classes/Account.html#method-i-abilities" name="method-i-abilities" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-abilities_source')" id="l_method-i-abilities_source">show</a>
</p>
<div id="method-i-abilities_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/roles/account.rb, line 29</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">abilities</span>
<span class="ruby-ivar">@abilities</span> <span class="ruby-operator">||=</span> <span class="ruby-keyword">begin</span>
<span class="ruby-identifier">abilities</span> = <span class="ruby-constant">Six</span>.<span class="ruby-identifier">new</span>
<span class="ruby-identifier">abilities</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">Ability</span>
<span class="ruby-identifier">abilities</span>
<span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-authorized_groups">
<b>authorized_groups</b>()
<a href="../classes/Account.html#method-i-authorized_groups" name="method-i-authorized_groups" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-authorized_groups_source')" id="l_method-i-authorized_groups_source">show</a>
</p>
<div id="method-i-authorized_groups_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/roles/account.rb, line 109</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">authorized_groups</span>
<span class="ruby-ivar">@authorized_groups</span> <span class="ruby-operator">||=</span> <span class="ruby-keyword">begin</span>
<span class="ruby-identifier">groups</span> = <span class="ruby-constant">Group</span>.<span class="ruby-identifier">where</span>(<span class="ruby-identifier">id</span><span class="ruby-operator">:</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">projects</span>.<span class="ruby-identifier">pluck</span>(<span class="ruby-value">:namespace_id</span>)).<span class="ruby-identifier">all</span>
<span class="ruby-identifier">groups</span> = <span class="ruby-identifier">groups</span> <span class="ruby-operator">+</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">groups</span>
<span class="ruby-identifier">groups</span>.<span class="ruby-identifier">uniq</span>
<span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-authorized_projects">
<b>authorized_projects</b>()
<a href="../classes/Account.html#method-i-authorized_projects" name="method-i-authorized_projects" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-authorized_projects_source')" id="l_method-i-authorized_projects_source">show</a>
</p>
<div id="method-i-authorized_projects_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/roles/account.rb, line 117</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">authorized_projects</span>
<span class="ruby-constant">Project</span>.<span class="ruby-identifier">authorized_for</span>(<span class="ruby-keyword">self</span>)
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-block">
<b>block</b>()
<a href="../classes/Account.html#method-i-block" name="method-i-block" class="permalink">Link</a>
</div>
<div class="description">
<p>Remove user from all projects and set blocked attribute to true</p>
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-block_source')" id="l_method-i-block_source">show</a>
</p>
<div id="method-i-block_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/roles/account.rb, line 59</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">block</span>
<span class="ruby-identifier">users_projects</span>.<span class="ruby-identifier">find_each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">membership</span><span class="ruby-operator">|</span>
<span class="ruby-keyword">return</span> <span class="ruby-keyword">false</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">membership</span>.<span class="ruby-identifier">destroy</span>
<span class="ruby-keyword">end</span>
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">blocked</span> = <span class="ruby-keyword">true</span>
<span class="ruby-identifier">save</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-can-3F">
<b>can?</b>(action, subject)
<a href="../classes/Account.html#method-i-can-3F" name="method-i-can-3F" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-can-3F_source')" id="l_method-i-can-3F_source">show</a>
</p>
<div id="method-i-can-3F_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/roles/account.rb, line 37</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">can?</span> <span class="ruby-identifier">action</span>, <span class="ruby-identifier">subject</span>
<span class="ruby-identifier">abilities</span>.<span class="ruby-identifier">allowed?</span>(<span class="ruby-keyword">self</span>, <span class="ruby-identifier">action</span>, <span class="ruby-identifier">subject</span>)
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-can_create_group-3F">
<b>can_create_group?</b>()
<a href="../classes/Account.html#method-i-can_create_group-3F" name="method-i-can_create_group-3F" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-can_create_group-3F_source')" id="l_method-i-can_create_group-3F_source">show</a>
</p>
<div id="method-i-can_create_group-3F_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/roles/account.rb, line 25</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">can_create_group?</span>
<span class="ruby-identifier">is_admin?</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-can_create_project-3F">
<b>can_create_project?</b>()
<a href="../classes/Account.html#method-i-can_create_project-3F" name="method-i-can_create_project-3F" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-can_create_project-3F_source')" id="l_method-i-can_create_project-3F_source">show</a>
</p>
<div id="method-i-can_create_project-3F_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/roles/account.rb, line 21</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">can_create_project?</span>
<span class="ruby-identifier">projects_limit</span> <span class="ruby-operator">&gt;</span> <span class="ruby-identifier">my_own_projects</span>.<span class="ruby-identifier">count</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-cared_merge_requests">
<b>cared_merge_requests</b>()
<a href="../classes/Account.html#method-i-cared_merge_requests" name="method-i-cared_merge_requests" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-cared_merge_requests_source')" id="l_method-i-cared_merge_requests_source">show</a>
</p>
<div id="method-i-cared_merge_requests_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/roles/account.rb, line 49</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">cared_merge_requests</span>
<span class="ruby-constant">MergeRequest</span>.<span class="ruby-identifier">where</span>(<span class="ruby-string">&quot;author_id = :id or assignee_id = :id&quot;</span>, <span class="ruby-identifier">id</span><span class="ruby-operator">:</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">id</span>)
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-first_name">
<b>first_name</b>()
<a href="../classes/Account.html#method-i-first_name" name="method-i-first_name" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-first_name_source')" id="l_method-i-first_name_source">show</a>
</p>
<div id="method-i-first_name_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/roles/account.rb, line 45</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">first_name</span>
<span class="ruby-identifier">name</span>.<span class="ruby-identifier">split</span>.<span class="ruby-identifier">first</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">name</span>.<span class="ruby-identifier">blank?</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-identifier">
<b>identifier</b>()
<a href="../classes/Account.html#method-i-identifier" name="method-i-identifier" class="permalink">Link</a>
</div>
<div class="description">
<p>Returns a string for use as a Gitolite user identifier</p>
<p><a href="Note.html">Note</a> that Gitolite 2.x requires the following
pattern for users:</p>
<pre>^@?[0-9a-zA-Z][0-9a-zA-Z._\@+-]*$</pre>
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-identifier_source')" id="l_method-i-identifier_source">show</a>
</p>
<div id="method-i-identifier_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/roles/account.rb, line 7</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">identifier</span>
<span class="ruby-comment"># Replace non-word chars with underscores, then make sure it starts with</span>
<span class="ruby-comment"># valid chars</span>
<span class="ruby-identifier">email</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp">%r\W/</span>, <span class="ruby-string">'_'</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp">%r\A([\W\_])+/</span>, <span class="ruby-string">''</span>)
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-is_admin-3F">
<b>is_admin?</b>()
<a href="../classes/Account.html#method-i-is_admin-3F" name="method-i-is_admin-3F" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-is_admin-3F_source')" id="l_method-i-is_admin-3F_source">show</a>
</p>
<div id="method-i-is_admin-3F_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/roles/account.rb, line 13</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">is_admin?</span>
<span class="ruby-identifier">admin</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-last_activity_project">
<b>last_activity_project</b>()
<a href="../classes/Account.html#method-i-last_activity_project" name="method-i-last_activity_project" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-last_activity_project_source')" id="l_method-i-last_activity_project_source">show</a>
</p>
<div id="method-i-last_activity_project_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/roles/account.rb, line 41</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">last_activity_project</span>
<span class="ruby-identifier">projects</span>.<span class="ruby-identifier">first</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-my_own_projects">
<b>my_own_projects</b>()
<a href="../classes/Account.html#method-i-my_own_projects" name="method-i-my_own_projects" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-my_own_projects_source')" id="l_method-i-my_own_projects_source">show</a>
</p>
<div id="method-i-my_own_projects_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/roles/account.rb, line 121</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">my_own_projects</span>
<span class="ruby-constant">Project</span>.<span class="ruby-identifier">personal</span>(<span class="ruby-keyword">self</span>)
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-namespace_id">
<b>namespace_id</b>()
<a href="../classes/Account.html#method-i-namespace_id" name="method-i-namespace_id" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-namespace_id_source')" id="l_method-i-namespace_id_source">show</a>
</p>
<div id="method-i-namespace_id_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/roles/account.rb, line 105</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">namespace_id</span>
<span class="ruby-identifier">namespace</span>.<span class="ruby-identifier">try</span> <span class="ruby-value">:id</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-namespaces">
<b>namespaces</b>()
<a href="../classes/Account.html#method-i-namespaces" name="method-i-namespaces" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-namespaces_source')" id="l_method-i-namespaces_source">show</a>
</p>
<div id="method-i-namespaces_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/roles/account.rb, line 86</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">namespaces</span>
<span class="ruby-identifier">namespaces</span> = []
<span class="ruby-comment"># Add user account namespace</span>
<span class="ruby-identifier">namespaces</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">namespace</span> <span class="ruby-keyword">if</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">namespace</span>
<span class="ruby-comment"># Add groups you can manage</span>
<span class="ruby-identifier">namespaces</span> <span class="ruby-operator">+=</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">admin</span>
<span class="ruby-constant">Group</span>.<span class="ruby-identifier">all</span>
<span class="ruby-keyword">else</span>
<span class="ruby-identifier">groups</span>.<span class="ruby-identifier">all</span>
<span class="ruby-keyword">end</span>
<span class="ruby-identifier">namespaces</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-project_ids">
<b>project_ids</b>()
<a href="../classes/Account.html#method-i-project_ids" name="method-i-project_ids" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-project_ids_source')" id="l_method-i-project_ids_source">show</a>
</p>
<div id="method-i-project_ids_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/roles/account.rb, line 53</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">project_ids</span>
<span class="ruby-identifier">projects</span>.<span class="ruby-identifier">map</span>(&amp;<span class="ruby-value">:id</span>)
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-projects_limit_percent">
<b>projects_limit_percent</b>()
<a href="../classes/Account.html#method-i-projects_limit_percent" name="method-i-projects_limit_percent" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-projects_limit_percent_source')" id="l_method-i-projects_limit_percent_source">show</a>
</p>
<div id="method-i-projects_limit_percent_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/roles/account.rb, line 68</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">projects_limit_percent</span>
<span class="ruby-keyword">return</span> <span class="ruby-number">100</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">projects_limit</span>.<span class="ruby-identifier">zero?</span>
(<span class="ruby-identifier">my_own_projects</span>.<span class="ruby-identifier">count</span>.<span class="ruby-identifier">to_f</span> <span class="ruby-operator">/</span> <span class="ruby-identifier">projects_limit</span>) * <span class="ruby-number">100</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-projects_sorted_by_activity">
<b>projects_sorted_by_activity</b>()
<a href="../classes/Account.html#method-i-projects_sorted_by_activity" name="method-i-projects_sorted_by_activity" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-projects_sorted_by_activity_source')" id="l_method-i-projects_sorted_by_activity_source">show</a>
</p>
<div id="method-i-projects_sorted_by_activity_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/roles/account.rb, line 82</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">projects_sorted_by_activity</span>
<span class="ruby-identifier">projects</span>.<span class="ruby-identifier">sorted_by_activity</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-recent_push">
<b>recent_push</b>(project_id = nil)
<a href="../classes/Account.html#method-i-recent_push" name="method-i-recent_push" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-recent_push_source')" id="l_method-i-recent_push_source">show</a>
</p>
<div id="method-i-recent_push_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/roles/account.rb, line 73</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">recent_push</span> <span class="ruby-identifier">project_id</span> = <span class="ruby-keyword">nil</span>
<span class="ruby-comment"># Get push events not earlier than 2 hours ago</span>
<span class="ruby-identifier">events</span> = <span class="ruby-identifier">recent_events</span>.<span class="ruby-identifier">code_push</span>.<span class="ruby-identifier">where</span>(<span class="ruby-string">&quot;created_at &gt; ?&quot;</span>, <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span> <span class="ruby-operator">-</span> <span class="ruby-number">2</span>.<span class="ruby-identifier">hours</span>)
<span class="ruby-identifier">events</span> = <span class="ruby-identifier">events</span>.<span class="ruby-identifier">where</span>(<span class="ruby-identifier">project_id</span><span class="ruby-operator">:</span> <span class="ruby-identifier">project_id</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">project_id</span>
<span class="ruby-comment"># Take only latest one</span>
<span class="ruby-identifier">events</span> = <span class="ruby-identifier">events</span>.<span class="ruby-identifier">recent</span>.<span class="ruby-identifier">limit</span>(<span class="ruby-number">1</span>).<span class="ruby-identifier">first</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-require_ssh_key-3F">
<b>require_ssh_key?</b>()
<a href="../classes/Account.html#method-i-require_ssh_key-3F" name="method-i-require_ssh_key-3F" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-require_ssh_key-3F_source')" id="l_method-i-require_ssh_key-3F_source">show</a>
</p>
<div id="method-i-require_ssh_key-3F_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/roles/account.rb, line 17</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">require_ssh_key?</span>
<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">count</span> <span class="ruby-operator">==</span> <span class="ruby-number">0</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-several_namespaces-3F">
<b>several_namespaces?</b>()
<a href="../classes/Account.html#method-i-several_namespaces-3F" name="method-i-several_namespaces-3F" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-several_namespaces-3F_source')" id="l_method-i-several_namespaces-3F_source">show</a>
</p>
<div id="method-i-several_namespaces-3F_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/roles/account.rb, line 101</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">several_namespaces?</span>
<span class="ruby-identifier">namespaces</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&gt;</span> <span class="ruby-number">1</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
</div>
</div>
</body>
</html>