This repository has been archived by the owner on Dec 1, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
47 changed files
with
9,645 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,290 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" | ||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | ||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | ||
<head> | ||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> | ||
|
||
<title>Class: Ability</title> | ||
|
||
<link rel="stylesheet" href="./rdoc.css" type="text/css" media="screen" /> | ||
|
||
<script src="./js/jquery.js" type="text/javascript" | ||
charset="utf-8"></script> | ||
<script src="./js/thickbox-compressed.js" type="text/javascript" | ||
charset="utf-8"></script> | ||
<script src="./js/quicksearch.js" type="text/javascript" | ||
charset="utf-8"></script> | ||
<script src="./js/darkfish.js" type="text/javascript" | ||
charset="utf-8"></script> | ||
|
||
</head> | ||
<body class="class"> | ||
|
||
<div id="metadata"> | ||
<div id="home-metadata"> | ||
<div id="home-section" class="section"> | ||
<h3 class="section-header"> | ||
<a href="./index.html">Home</a> | ||
<a href="./index.html#classes">Classes</a> | ||
<a href="./index.html#methods">Methods</a> | ||
</h3> | ||
</div> | ||
</div> | ||
|
||
<div id="file-metadata"> | ||
<div id="file-list-section" class="section"> | ||
<h3 class="section-header">In Files</h3> | ||
<div class="section-body"> | ||
<ul> | ||
|
||
<li><a href="./app/models/ability_rb.html?TB_iframe=true&height=550&width=785" | ||
class="thickbox" title="app/models/ability.rb">app/models/ability.rb</a></li> | ||
|
||
</ul> | ||
</div> | ||
</div> | ||
|
||
|
||
</div> | ||
|
||
<div id="class-metadata"> | ||
|
||
<!-- Parent Class --> | ||
|
||
<div id="parent-class-section" class="section"> | ||
<h3 class="section-header">Parent</h3> | ||
|
||
<p class="link">Object</p> | ||
|
||
</div> | ||
|
||
|
||
<!-- Namespace Contents --> | ||
|
||
|
||
<!-- Method Quickref --> | ||
|
||
<div id="method-list-section" class="section"> | ||
<h3 class="section-header">Methods</h3> | ||
<ul class="link-list"> | ||
|
||
<li><a href="#method-c-new">::new</a></li> | ||
|
||
</ul> | ||
</div> | ||
|
||
|
||
<!-- Included Modules --> | ||
|
||
<div id="includes-section" class="section"> | ||
<h3 class="section-header">Included Modules</h3> | ||
<ul class="link-list"> | ||
|
||
|
||
<li><span class="include">CanCan::Ability</span></li> | ||
|
||
|
||
</ul> | ||
</div> | ||
|
||
</div> | ||
|
||
<div id="project-metadata"> | ||
|
||
|
||
<div id="fileindex-section" class="section project-section"> | ||
<h3 class="section-header">Files</h3> | ||
<ul> | ||
|
||
<li class="file"><a href="./doc/README_FOR_APP.html">README_FOR_APP</a></li> | ||
|
||
</ul> | ||
</div> | ||
|
||
|
||
<div id="classindex-section" class="section project-section"> | ||
<h3 class="section-header">Class Index | ||
<span class="search-toggle"><img src="./images/find.png" | ||
height="16" width="16" alt="[+]" | ||
title="show/hide quicksearch" /></span></h3> | ||
<form action="#" method="get" accept-charset="utf-8" class="initially-hidden"> | ||
<fieldset> | ||
<legend>Quicksearch</legend> | ||
<input type="text" name="quicksearch" value="" | ||
class="quicksearch-field" /> | ||
</fieldset> | ||
</form> | ||
|
||
<ul class="link-list"> | ||
|
||
<li><a href="./Admin.html">Admin</a></li> | ||
|
||
<li><a href="./Admin/UsersController.html">Admin::UsersController</a></li> | ||
|
||
<li><a href="./Admin/UsersHelper.html">Admin::UsersHelper</a></li> | ||
|
||
<li><a href="./V1.html">V1</a></li> | ||
|
||
<li><a href="./V1/PostsController.html">V1::PostsController</a></li> | ||
|
||
<li><a href="./V1/PostsHelper.html">V1::PostsHelper</a></li> | ||
|
||
<li><a href="./Users.html">Users</a></li> | ||
|
||
<li><a href="./Users/OmniauthCallbacksController.html">Users::OmniauthCallbacksController</a></li> | ||
|
||
<li><a href="./Ability.html">Ability</a></li> | ||
|
||
<li><a href="./ApiAuthorizedFilter.html">ApiAuthorizedFilter</a></li> | ||
|
||
<li><a href="./ApplicationController.html">ApplicationController</a></li> | ||
|
||
<li><a href="./ApplicationHelper.html">ApplicationHelper</a></li> | ||
|
||
<li><a href="./Bookmark.html">Bookmark</a></li> | ||
|
||
<li><a href="./General.html">General</a></li> | ||
|
||
<li><a href="./Link.html">Link</a></li> | ||
|
||
<li><a href="./PostsController.html">PostsController</a></li> | ||
|
||
<li><a href="./PostsHelper.html">PostsHelper</a></li> | ||
|
||
<li><a href="./Stat.html">Stat</a></li> | ||
|
||
<li><a href="./StatsController.html">StatsController</a></li> | ||
|
||
<li><a href="./StatsHelper.html">StatsHelper</a></li> | ||
|
||
<li><a href="./TagsController.html">TagsController</a></li> | ||
|
||
<li><a href="./TagsHelper.html">TagsHelper</a></li> | ||
|
||
<li><a href="./User.html">User</a></li> | ||
|
||
</ul> | ||
<div id="no-class-search-results" style="display: none;">No matching classes.</div> | ||
</div> | ||
|
||
|
||
</div> | ||
</div> | ||
|
||
<div id="documentation"> | ||
<h1 class="class">Ability</h1> | ||
|
||
<div id="description"> | ||
|
||
</div> | ||
|
||
<!-- Constants --> | ||
|
||
|
||
<!-- Attributes --> | ||
|
||
|
||
<!-- Methods --> | ||
|
||
<div id="public-class-method-details" class="method-section section"> | ||
<h3 class="section-header">Public Class Methods</h3> | ||
|
||
|
||
<div id="new-method" class="method-detail "> | ||
<a name="method-c-new"></a> | ||
|
||
<div class="method-heading"> | ||
|
||
<span class="method-name">new</span><span | ||
class="method-args">(user)</span> | ||
<span class="method-click-advice">click to toggle source</span> | ||
|
||
</div> | ||
|
||
<div class="method-description"> | ||
|
||
|
||
|
||
|
||
|
||
<div class="method-source-code" | ||
id="new-source"> | ||
<pre> | ||
<span class="ruby-comment cmt"># File app/models/ability.rb, line 4</span> | ||
4: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">user</span>) | ||
5: <span class="ruby-comment cmt"># Define abilities for the passed in user here. For example:</span> | ||
6: <span class="ruby-comment cmt">#</span> | ||
7: <span class="ruby-comment cmt"># user ||= User.new # guest user (not logged in)</span> | ||
8: <span class="ruby-comment cmt"># if user.admin?</span> | ||
9: <span class="ruby-comment cmt"># can :manage, :all</span> | ||
10: <span class="ruby-comment cmt"># else</span> | ||
11: <span class="ruby-comment cmt"># can :read, :all</span> | ||
12: <span class="ruby-comment cmt"># end</span> | ||
13: <span class="ruby-comment cmt">#</span> | ||
14: <span class="ruby-comment cmt"># The first argument to `can` is the action you are giving the user permission to do.</span> | ||
15: <span class="ruby-comment cmt"># If you pass :manage it will apply to every action. Other common actions here are</span> | ||
16: <span class="ruby-comment cmt"># :read, :create, :update and :destroy.</span> | ||
17: <span class="ruby-comment cmt">#</span> | ||
18: <span class="ruby-comment cmt"># The second argument is the resource the user can perform the action on. If you pass</span> | ||
19: <span class="ruby-comment cmt"># :all it will apply to every resource. Otherwise pass a Ruby class of the resource.</span> | ||
20: <span class="ruby-comment cmt">#</span> | ||
21: <span class="ruby-comment cmt"># The third argument is an optional hash of conditions to further filter the objects.</span> | ||
22: <span class="ruby-comment cmt"># For example, here the user can only update published articles.</span> | ||
23: <span class="ruby-comment cmt">#</span> | ||
24: <span class="ruby-comment cmt"># can :update, Article, :published => true</span> | ||
25: <span class="ruby-comment cmt">#</span> | ||
26: <span class="ruby-comment cmt"># See the wiki for details: https://github.com/ryanb/cancan/wiki/Defining-Abilities</span> | ||
27: <span class="ruby-identifier">user</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">User</span>.<span class="ruby-identifier">new</span> | ||
28: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">user</span>.<span class="ruby-identifier">admin?</span> | ||
29: <span class="ruby-identifier">can</span> <span class="ruby-value">:manage</span>, <span class="ruby-value">:all</span> | ||
30: <span class="ruby-keyword kw">end</span> | ||
31: | ||
32: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">user</span>.<span class="ruby-identifier">guest?</span> | ||
33: <span class="ruby-identifier">can</span> <span class="ruby-value">:read</span>, <span class="ruby-constant">Bookmark</span> | ||
34: <span class="ruby-identifier">can</span> <span class="ruby-value">:read</span>, <span class="ruby-constant">Stat</span> | ||
35: <span class="ruby-keyword kw">end</span> | ||
36: | ||
37: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">user</span>.<span class="ruby-identifier">beta?</span> | ||
38: <span class="ruby-identifier">can</span> <span class="ruby-value">:manage</span>, <span class="ruby-constant">Bookmark</span>, <span class="ruby-value">:user_id</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">user</span>.<span class="ruby-identifier">id</span> | ||
39: <span class="ruby-identifier">can</span> <span class="ruby-value">:read</span>, <span class="ruby-constant">Bookmark</span> | ||
40: <span class="ruby-identifier">can</span> <span class="ruby-value">:read</span>, <span class="ruby-constant">Stat</span> | ||
41: <span class="ruby-keyword kw">end</span> | ||
42: | ||
43: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">user</span>.<span class="ruby-identifier">locked?</span> | ||
44: <span class="ruby-identifier">can</span> <span class="ruby-value">:read</span>, <span class="ruby-constant">Bookmark</span> | ||
45: <span class="ruby-identifier">can</span> <span class="ruby-value">:read</span>, <span class="ruby-constant">Stat</span> | ||
46: <span class="ruby-keyword kw">end</span> | ||
47: | ||
48: <span class="ruby-keyword kw">end</span></pre> | ||
</div> | ||
|
||
</div> | ||
|
||
|
||
|
||
|
||
</div> | ||
|
||
|
||
</div> | ||
|
||
|
||
</div> | ||
|
||
|
||
<div id="rdoc-debugging-section-dump" class="debugging-section"> | ||
|
||
<p>Disabled; run with --debug to generate this.</p> | ||
|
||
</div> | ||
|
||
<div id="validator-badges"> | ||
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p> | ||
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish | ||
Rdoc Generator</a> 1.1.6</small>.</p> | ||
</div> | ||
|
||
</body> | ||
</html> | ||
|
Oops, something went wrong.