mirror of
https://github.com/evennia/evennia.git
synced 2026-03-19 22:36:31 +01:00
1139 lines
No EOL
74 KiB
HTML
1139 lines
No EOL
74 KiB
HTML
|
||
<!DOCTYPE html>
|
||
|
||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||
<head>
|
||
<meta charset="utf-8" />
|
||
<title>evennia.locks package — Evennia 1.0-dev documentation</title>
|
||
<link rel="stylesheet" href="../_static/alabaster.css" type="text/css" />
|
||
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
|
||
<script id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
|
||
<script src="../_static/jquery.js"></script>
|
||
<script src="../_static/underscore.js"></script>
|
||
<script src="../_static/doctools.js"></script>
|
||
<script src="../_static/language_data.js"></script>
|
||
<link rel="index" title="Index" href="../genindex.html" />
|
||
<link rel="search" title="Search" href="../search.html" />
|
||
|
||
<link rel="stylesheet" href="../_static/custom.css" type="text/css" />
|
||
|
||
|
||
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />
|
||
|
||
</head><body>
|
||
|
||
|
||
<div class="document">
|
||
<div class="documentwrapper">
|
||
<div class="bodywrapper">
|
||
|
||
|
||
<div class="body" role="main">
|
||
|
||
<div class="section" id="module-evennia.locks">
|
||
<span id="evennia-locks-package"></span><h1>evennia.locks package<a class="headerlink" href="#module-evennia.locks" title="Permalink to this headline">¶</a></h1>
|
||
<p>This sub-package defines the lock (access) mechanism of Evennia. All
|
||
lock strings are processed through the lockhandler in this package. It
|
||
also contains the default lock functions used in lock definitions.</p>
|
||
<div class="section" id="submodules">
|
||
<h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this headline">¶</a></h2>
|
||
</div>
|
||
<div class="section" id="module-evennia.locks.lockfuncs">
|
||
<span id="evennia-locks-lockfuncs-module"></span><h2>evennia.locks.lockfuncs module<a class="headerlink" href="#module-evennia.locks.lockfuncs" title="Permalink to this headline">¶</a></h2>
|
||
<p>This module provides a set of permission lock functions for use
|
||
with Evennia’s permissions system.</p>
|
||
<p>To call these locks, make sure this module is included in the
|
||
settings tuple <cite>PERMISSION_FUNC_MODULES</cite> then define a lock on the form
|
||
‘<access_type>:func(args)’ and add it to the object’s lockhandler.
|
||
Run the <cite>access()</cite> method of the handler to execute the lock check.</p>
|
||
<p>Note that <cite>accessing_obj</cite> and <cite>accessed_obj</cite> can be any object type
|
||
with a lock variable/field, so be careful to not expect
|
||
a certain object type.</p>
|
||
<p><strong>Appendix: MUX locks</strong></p>
|
||
<p>Below is a list nicked from the MUX help file on the locks available
|
||
in standard MUX. Most of these are not relevant to core Evennia since
|
||
locks in Evennia are considerably more flexible and can be implemented
|
||
on an individual command/typeclass basis rather than as globally
|
||
available like the MUX ones. So many of these are not available in
|
||
basic Evennia, but could all be implemented easily if needed for the
|
||
individual game.</p>
|
||
<p><a href="#id1"><span class="problematic" id="id2">``</span></a>`
|
||
MUX Name: Affects: Effect:
|
||
———————————————————————-
|
||
DefaultLock: Exits: controls who may traverse the exit to</p>
|
||
<blockquote>
|
||
<div><blockquote>
|
||
<div><blockquote>
|
||
<div><dl class="simple">
|
||
<dt>its destination.</dt><dd><p>Evennia: “traverse:<lockfunc()>”</p>
|
||
</dd>
|
||
</dl>
|
||
</div></blockquote>
|
||
<dl>
|
||
<dt>Rooms: controls whether the account sees the</dt><dd><p>SUCC or FAIL message for the room
|
||
following the room description when
|
||
looking at the room.</p>
|
||
<blockquote>
|
||
<div><p>Evennia: Custom typeclass</p>
|
||
</div></blockquote>
|
||
</dd>
|
||
<dt>Accounts/Things: controls who may GET the object.</dt><dd><p>Evennia: “get:<lockfunc()”</p>
|
||
</dd>
|
||
</dl>
|
||
</div></blockquote>
|
||
<dl>
|
||
<dt>EnterLock: Accounts/Things: controls who may ENTER the object</dt><dd><p>Evennia:</p>
|
||
</dd>
|
||
<dt>GetFromLock: All but Exits: controls who may gets things from a</dt><dd><dl class="simple">
|
||
<dt>given location.</dt><dd><p>Evennia:</p>
|
||
</dd>
|
||
</dl>
|
||
</dd>
|
||
<dt>GiveLock: Accounts/Things: controls who may give the object.</dt><dd><p>Evennia:</p>
|
||
</dd>
|
||
<dt>LeaveLock: Accounts/Things: controls who may LEAVE the object.</dt><dd><p>Evennia:</p>
|
||
</dd>
|
||
<dt>LinkLock: All but Exits: controls who may link to the location</dt><dd><p>if the location is LINK_OK (for linking
|
||
exits or setting drop-tos) or ABODE (for
|
||
setting homes)</p>
|
||
<blockquote>
|
||
<div><p>Evennia:</p>
|
||
</div></blockquote>
|
||
</dd>
|
||
<dt>MailLock: Accounts: controls who may @mail the account.</dt><dd><p>Evennia:</p>
|
||
</dd>
|
||
<dt>OpenLock: All but Exits: controls who may open an exit.</dt><dd><p>Evennia:</p>
|
||
</dd>
|
||
<dt>PageLock: Accounts: controls who may page the account.</dt><dd><p>Evennia: “send:<lockfunc()>”</p>
|
||
</dd>
|
||
<dt>ParentLock: All: controls who may make @parent links to</dt><dd><dl class="simple">
|
||
<dt>the object.</dt><dd><p>Evennia: Typeclasses and</p>
|
||
</dd>
|
||
</dl>
|
||
<p>“puppet:<lockstring()>”</p>
|
||
</dd>
|
||
<dt>ReceiveLock: Accounts/Things: controls who may give things to the</dt><dd><dl class="simple">
|
||
<dt>object.</dt><dd><p>Evennia:</p>
|
||
</dd>
|
||
</dl>
|
||
</dd>
|
||
<dt>SpeechLock: All but Exits: controls who may speak in that location</dt><dd><p>Evennia:</p>
|
||
</dd>
|
||
<dt>TeloutLock: All but Exits: controls who may teleport out of the</dt><dd><dl class="simple">
|
||
<dt>location.</dt><dd><p>Evennia:</p>
|
||
</dd>
|
||
</dl>
|
||
</dd>
|
||
<dt>TportLock: Rooms/Things: controls who may teleport there</dt><dd><p>Evennia:</p>
|
||
</dd>
|
||
<dt>UseLock: All but Exits: controls who may USE the object, GIVE</dt><dd><p>the object money and have the PAY
|
||
attributes run, have their messages
|
||
heard and possibly acted on by LISTEN
|
||
and AxHEAR, and invoke $-commands
|
||
stored on the object.</p>
|
||
<blockquote>
|
||
<div><p>Evennia: Commands and Cmdsets.</p>
|
||
</div></blockquote>
|
||
</dd>
|
||
<dt>DropLock: All but rooms: controls who may drop that object.</dt><dd><p>Evennia:</p>
|
||
</dd>
|
||
<dt>VisibleLock: All: Controls object visibility when the</dt><dd><p>object is not dark and the looker
|
||
passes the lock. In DARK locations, the
|
||
object must also be set LIGHT and the
|
||
viewer must pass the VisibleLock.</p>
|
||
<blockquote>
|
||
<div><dl class="simple">
|
||
<dt>Evennia: Room typeclass with</dt><dd><p>Dark/light script</p>
|
||
</dd>
|
||
</dl>
|
||
</div></blockquote>
|
||
</dd>
|
||
</dl>
|
||
</div></blockquote>
|
||
<p><a href="#id3"><span class="problematic" id="id4">``</span></a><a href="#id5"><span class="problematic" id="id6">`</span></a></p>
|
||
<dl class="function">
|
||
<dt id="evennia.locks.lockfuncs._to_account">
|
||
<code class="sig-prename descclassname">evennia.locks.lockfuncs.</code><code class="sig-name descname">_to_account</code><span class="sig-paren">(</span><em class="sig-param">accessing_obj</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/lockfuncs.html#_to_account"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.lockfuncs._to_account" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Helper function. Makes sure an accessing object is an account object</p>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="evennia.locks.lockfuncs.all">
|
||
<code class="sig-prename descclassname">evennia.locks.lockfuncs.</code><code class="sig-name descname">all</code><span class="sig-paren">(</span><em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/lockfuncs.html#all"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.lockfuncs.all" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="evennia.locks.lockfuncs.attr">
|
||
<code class="sig-prename descclassname">evennia.locks.lockfuncs.</code><code class="sig-name descname">attr</code><span class="sig-paren">(</span><em class="sig-param">accessing_obj</em>, <em class="sig-param">accessed_obj</em>, <em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/lockfuncs.html#attr"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.lockfuncs.attr" title="Permalink to this definition">¶</a></dt>
|
||
<dd><dl class="simple">
|
||
<dt>Usage:</dt><dd><p>attr(attrname)
|
||
attr(attrname, value)
|
||
attr(attrname, value, compare=type)</p>
|
||
</dd>
|
||
</dl>
|
||
<p>where compare’s type is one of (eq,gt,lt,ge,le,ne) and signifies
|
||
how the value should be compared with one on accessing_obj (so
|
||
compare=gt means the accessing_obj must have a value greater than
|
||
the one given).</p>
|
||
<p>Searches attributes <em>and</em> properties stored on the accessing_obj.
|
||
if accessing_obj has a property “obj”, then this is used as
|
||
accessing_obj (this makes this usable for Commands too)</p>
|
||
<p>The first form works like a flag - if the attribute/property
|
||
exists on the object, the value is checked for True/False. The
|
||
second form also requires that the value of the attribute/property
|
||
matches. Note that all retrieved values will be converted to
|
||
strings before doing the comparison.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="evennia.locks.lockfuncs.attr_eq">
|
||
<code class="sig-prename descclassname">evennia.locks.lockfuncs.</code><code class="sig-name descname">attr_eq</code><span class="sig-paren">(</span><em class="sig-param">accessing_obj</em>, <em class="sig-param">accessed_obj</em>, <em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/lockfuncs.html#attr_eq"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.lockfuncs.attr_eq" title="Permalink to this definition">¶</a></dt>
|
||
<dd><dl class="simple">
|
||
<dt>Usage:</dt><dd><p>attr_gt(attrname, 54)</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="evennia.locks.lockfuncs.attr_ge">
|
||
<code class="sig-prename descclassname">evennia.locks.lockfuncs.</code><code class="sig-name descname">attr_ge</code><span class="sig-paren">(</span><em class="sig-param">accessing_obj</em>, <em class="sig-param">accessed_obj</em>, <em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/lockfuncs.html#attr_ge"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.lockfuncs.attr_ge" title="Permalink to this definition">¶</a></dt>
|
||
<dd><dl class="simple">
|
||
<dt>Usage:</dt><dd><p>attr_gt(attrname, 54)</p>
|
||
</dd>
|
||
</dl>
|
||
<p>Only true if access_obj’s attribute >= the value given.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="evennia.locks.lockfuncs.attr_gt">
|
||
<code class="sig-prename descclassname">evennia.locks.lockfuncs.</code><code class="sig-name descname">attr_gt</code><span class="sig-paren">(</span><em class="sig-param">accessing_obj</em>, <em class="sig-param">accessed_obj</em>, <em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/lockfuncs.html#attr_gt"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.lockfuncs.attr_gt" title="Permalink to this definition">¶</a></dt>
|
||
<dd><dl class="simple">
|
||
<dt>Usage:</dt><dd><p>attr_gt(attrname, 54)</p>
|
||
</dd>
|
||
</dl>
|
||
<p>Only true if access_obj’s attribute > the value given.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="evennia.locks.lockfuncs.attr_le">
|
||
<code class="sig-prename descclassname">evennia.locks.lockfuncs.</code><code class="sig-name descname">attr_le</code><span class="sig-paren">(</span><em class="sig-param">accessing_obj</em>, <em class="sig-param">accessed_obj</em>, <em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/lockfuncs.html#attr_le"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.lockfuncs.attr_le" title="Permalink to this definition">¶</a></dt>
|
||
<dd><dl class="simple">
|
||
<dt>Usage:</dt><dd><p>attr_gt(attrname, 54)</p>
|
||
</dd>
|
||
</dl>
|
||
<p>Only true if access_obj’s attribute <= the value given.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="evennia.locks.lockfuncs.attr_lt">
|
||
<code class="sig-prename descclassname">evennia.locks.lockfuncs.</code><code class="sig-name descname">attr_lt</code><span class="sig-paren">(</span><em class="sig-param">accessing_obj</em>, <em class="sig-param">accessed_obj</em>, <em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/lockfuncs.html#attr_lt"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.lockfuncs.attr_lt" title="Permalink to this definition">¶</a></dt>
|
||
<dd><dl class="simple">
|
||
<dt>Usage:</dt><dd><p>attr_gt(attrname, 54)</p>
|
||
</dd>
|
||
</dl>
|
||
<p>Only true if access_obj’s attribute < the value given.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="evennia.locks.lockfuncs.attr_ne">
|
||
<code class="sig-prename descclassname">evennia.locks.lockfuncs.</code><code class="sig-name descname">attr_ne</code><span class="sig-paren">(</span><em class="sig-param">accessing_obj</em>, <em class="sig-param">accessed_obj</em>, <em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/lockfuncs.html#attr_ne"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.lockfuncs.attr_ne" title="Permalink to this definition">¶</a></dt>
|
||
<dd><dl class="simple">
|
||
<dt>Usage:</dt><dd><p>attr_gt(attrname, 54)</p>
|
||
</dd>
|
||
</dl>
|
||
<p>Only true if access_obj’s attribute != the value given.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="evennia.locks.lockfuncs.dbref">
|
||
<code class="sig-prename descclassname">evennia.locks.lockfuncs.</code><code class="sig-name descname">dbref</code><span class="sig-paren">(</span><em class="sig-param">accessing_obj</em>, <em class="sig-param">accessed_obj</em>, <em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/lockfuncs.html#dbref"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.lockfuncs.dbref" title="Permalink to this definition">¶</a></dt>
|
||
<dd><dl class="simple">
|
||
<dt>Usage:</dt><dd><p>dbref(3)</p>
|
||
</dd>
|
||
</dl>
|
||
<p>This lock type checks if the checking object
|
||
has a particular dbref. Note that this only
|
||
works for checking objects that are stored
|
||
in the database (e.g. not for commands)</p>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="evennia.locks.lockfuncs.false">
|
||
<code class="sig-prename descclassname">evennia.locks.lockfuncs.</code><code class="sig-name descname">false</code><span class="sig-paren">(</span><em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/lockfuncs.html#false"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.lockfuncs.false" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Always returns False</p>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="evennia.locks.lockfuncs.has_account">
|
||
<code class="sig-prename descclassname">evennia.locks.lockfuncs.</code><code class="sig-name descname">has_account</code><span class="sig-paren">(</span><em class="sig-param">accessing_obj</em>, <em class="sig-param">accessed_obj</em>, <em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/lockfuncs.html#has_account"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.lockfuncs.has_account" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Only returns true if accessing_obj has_account is true, that is,
|
||
this is an account-controlled object. It fails on actual accounts!</p>
|
||
<p>This is a useful lock for traverse-locking Exits to restrain NPC
|
||
mobiles from moving outside their areas.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="evennia.locks.lockfuncs.holds">
|
||
<code class="sig-prename descclassname">evennia.locks.lockfuncs.</code><code class="sig-name descname">holds</code><span class="sig-paren">(</span><em class="sig-param">accessing_obj</em>, <em class="sig-param">accessed_obj</em>, <em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/lockfuncs.html#holds"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.lockfuncs.holds" title="Permalink to this definition">¶</a></dt>
|
||
<dd><dl class="simple">
|
||
<dt>Usage:</dt><dd><dl class="simple">
|
||
<dt>holds() checks if accessed_obj or accessed_obj.obj</dt><dd><p>is held by accessing_obj</p>
|
||
</dd>
|
||
<dt>holds(key/dbref) checks if accessing_obj holds an object</dt><dd><p>with given key/dbref</p>
|
||
</dd>
|
||
<dt>holds(attrname, value) checks if accessing_obj holds an</dt><dd><p>object with the given attrname and value</p>
|
||
</dd>
|
||
</dl>
|
||
</dd>
|
||
</dl>
|
||
<p>This is passed if accessed_obj is carried by accessing_obj (that is,
|
||
accessed_obj.location == accessing_obj), or if accessing_obj itself holds
|
||
an object matching the given key.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="evennia.locks.lockfuncs.id">
|
||
<code class="sig-prename descclassname">evennia.locks.lockfuncs.</code><code class="sig-name descname">id</code><span class="sig-paren">(</span><em class="sig-param">accessing_obj</em>, <em class="sig-param">accessed_obj</em>, <em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/lockfuncs.html#id"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.lockfuncs.id" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Alias to dbref</p>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="evennia.locks.lockfuncs.inside">
|
||
<code class="sig-prename descclassname">evennia.locks.lockfuncs.</code><code class="sig-name descname">inside</code><span class="sig-paren">(</span><em class="sig-param">accessing_obj</em>, <em class="sig-param">accessed_obj</em>, <em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/lockfuncs.html#inside"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.lockfuncs.inside" title="Permalink to this definition">¶</a></dt>
|
||
<dd><dl class="simple">
|
||
<dt>Usage:</dt><dd><p>inside()</p>
|
||
</dd>
|
||
</dl>
|
||
<p>True if accessing_obj is ‘inside’ accessing_obj. Note that this only checks
|
||
one level down. So if if the lock is on a room, you will pass but not your
|
||
inventory (since their location is you, not the locked object). If you
|
||
want also nested objects to pass the lock, use the <cite>insiderecursive</cite>
|
||
lockfunc.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="evennia.locks.lockfuncs.inside_rec">
|
||
<code class="sig-prename descclassname">evennia.locks.lockfuncs.</code><code class="sig-name descname">inside_rec</code><span class="sig-paren">(</span><em class="sig-param">accessing_obj</em>, <em class="sig-param">accessed_obj</em>, <em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/lockfuncs.html#inside_rec"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.lockfuncs.inside_rec" title="Permalink to this definition">¶</a></dt>
|
||
<dd><dl class="simple">
|
||
<dt>Usage:</dt><dd><p>inside_rec()</p>
|
||
</dd>
|
||
</dl>
|
||
<p>True if accessing_obj is inside the accessed obj, at up to 10 levels
|
||
of recursion (so if this lock is on a room, then an object inside a box
|
||
in your inventory will also pass the lock).</p>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="evennia.locks.lockfuncs.locattr">
|
||
<code class="sig-prename descclassname">evennia.locks.lockfuncs.</code><code class="sig-name descname">locattr</code><span class="sig-paren">(</span><em class="sig-param">accessing_obj</em>, <em class="sig-param">accessed_obj</em>, <em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/lockfuncs.html#locattr"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.lockfuncs.locattr" title="Permalink to this definition">¶</a></dt>
|
||
<dd><dl class="simple">
|
||
<dt>Usage:</dt><dd><p>locattr(attrname)
|
||
locattr(attrname, value)
|
||
locattr(attrname, value, compare=type)</p>
|
||
</dd>
|
||
</dl>
|
||
<p>Works like attr, except it looks for an attribute on
|
||
accessing_obj.location, if such an entity exists.</p>
|
||
<p>if accessing_obj has a property “.obj” (such as is the case for a
|
||
Command), then accessing_obj.obj.location is used instead.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="evennia.locks.lockfuncs.none">
|
||
<code class="sig-prename descclassname">evennia.locks.lockfuncs.</code><code class="sig-name descname">none</code><span class="sig-paren">(</span><em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/lockfuncs.html#none"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.lockfuncs.none" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="evennia.locks.lockfuncs.objattr">
|
||
<code class="sig-prename descclassname">evennia.locks.lockfuncs.</code><code class="sig-name descname">objattr</code><span class="sig-paren">(</span><em class="sig-param">accessing_obj</em>, <em class="sig-param">accessed_obj</em>, <em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/lockfuncs.html#objattr"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.lockfuncs.objattr" title="Permalink to this definition">¶</a></dt>
|
||
<dd><dl class="simple">
|
||
<dt>Usage:</dt><dd><p>objattr(attrname)
|
||
objattr(attrname, value)
|
||
objattr(attrname, value, compare=type)</p>
|
||
</dd>
|
||
</dl>
|
||
<p>Works like attr, except it looks for an attribute on
|
||
accessed_obj instead.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="evennia.locks.lockfuncs.objlocattr">
|
||
<code class="sig-prename descclassname">evennia.locks.lockfuncs.</code><code class="sig-name descname">objlocattr</code><span class="sig-paren">(</span><em class="sig-param">accessing_obj</em>, <em class="sig-param">accessed_obj</em>, <em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/lockfuncs.html#objlocattr"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.lockfuncs.objlocattr" title="Permalink to this definition">¶</a></dt>
|
||
<dd><dl class="simple">
|
||
<dt>Usage:</dt><dd><p>locattr(attrname)
|
||
locattr(attrname, value)
|
||
locattr(attrname, value, compare=type)</p>
|
||
</dd>
|
||
</dl>
|
||
<p>Works like attr, except it looks for an attribute on
|
||
accessed_obj.location, if such an entity exists.</p>
|
||
<p>if accessed_obj has a property “.obj” (such as is the case for a
|
||
Command), then accessing_obj.obj.location is used instead.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="evennia.locks.lockfuncs.objtag">
|
||
<code class="sig-prename descclassname">evennia.locks.lockfuncs.</code><code class="sig-name descname">objtag</code><span class="sig-paren">(</span><em class="sig-param">accessing_obj</em>, <em class="sig-param">accessed_obj</em>, <em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/lockfuncs.html#objtag"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.lockfuncs.objtag" title="Permalink to this definition">¶</a></dt>
|
||
<dd><dl class="simple">
|
||
<dt>Usage:</dt><dd><p>objtag(tagkey)
|
||
objtag(tagkey, category)</p>
|
||
</dd>
|
||
</dl>
|
||
<p>Only true if accessed_obj has the specified tag and optional
|
||
category.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="evennia.locks.lockfuncs.pdbref">
|
||
<code class="sig-prename descclassname">evennia.locks.lockfuncs.</code><code class="sig-name descname">pdbref</code><span class="sig-paren">(</span><em class="sig-param">accessing_obj</em>, <em class="sig-param">accessed_obj</em>, <em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/lockfuncs.html#pdbref"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.lockfuncs.pdbref" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Same as dbref, but making sure accessing_obj is an account.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="evennia.locks.lockfuncs.perm">
|
||
<code class="sig-prename descclassname">evennia.locks.lockfuncs.</code><code class="sig-name descname">perm</code><span class="sig-paren">(</span><em class="sig-param">accessing_obj</em>, <em class="sig-param">accessed_obj</em>, <em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/lockfuncs.html#perm"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.lockfuncs.perm" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The basic permission-checker. Ignores case.</p>
|
||
<dl class="simple">
|
||
<dt>Usage:</dt><dd><p>perm(<permission>)</p>
|
||
</dd>
|
||
</dl>
|
||
<p>where <permission> is the permission accessing_obj must
|
||
have in order to pass the lock.</p>
|
||
<p>If the given permission is part of settings.PERMISSION_HIERARCHY,
|
||
permission is also granted to all ranks higher up in the hierarchy.</p>
|
||
<p>If accessing_object is an Object controlled by an Account, the
|
||
permissions of the Account is used unless the Attribute _quell
|
||
is set to True on the Object. In this case however, the
|
||
LOWEST hieararcy-permission of the Account/Object-pair will be used
|
||
(this is order to avoid Accounts potentially escalating their own permissions
|
||
by use of a higher-level Object)</p>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="evennia.locks.lockfuncs.perm_above">
|
||
<code class="sig-prename descclassname">evennia.locks.lockfuncs.</code><code class="sig-name descname">perm_above</code><span class="sig-paren">(</span><em class="sig-param">accessing_obj</em>, <em class="sig-param">accessed_obj</em>, <em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/lockfuncs.html#perm_above"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.lockfuncs.perm_above" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Only allow objects with a permission <em>higher</em> in the permission
|
||
hierarchy than the one given. If there is no such higher rank,
|
||
it’s assumed we refer to superuser. If no hierarchy is defined,
|
||
this function has no meaning and returns False.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="evennia.locks.lockfuncs.pid">
|
||
<code class="sig-prename descclassname">evennia.locks.lockfuncs.</code><code class="sig-name descname">pid</code><span class="sig-paren">(</span><em class="sig-param">accessing_obj</em>, <em class="sig-param">accessed_obj</em>, <em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/lockfuncs.html#pid"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.lockfuncs.pid" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Alias to dbref, for Accounts</p>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="evennia.locks.lockfuncs.pperm">
|
||
<code class="sig-prename descclassname">evennia.locks.lockfuncs.</code><code class="sig-name descname">pperm</code><span class="sig-paren">(</span><em class="sig-param">accessing_obj</em>, <em class="sig-param">accessed_obj</em>, <em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/lockfuncs.html#pperm"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.lockfuncs.pperm" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The basic permission-checker only for Account objects. Ignores case.</p>
|
||
<dl class="simple">
|
||
<dt>Usage:</dt><dd><p>pperm(<permission>)</p>
|
||
</dd>
|
||
</dl>
|
||
<p>where <permission> is the permission accessing_obj must
|
||
have in order to pass the lock. If the given permission
|
||
is part of _PERMISSION_HIERARCHY, permission is also granted
|
||
to all ranks higher up in the hierarchy.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="evennia.locks.lockfuncs.pperm_above">
|
||
<code class="sig-prename descclassname">evennia.locks.lockfuncs.</code><code class="sig-name descname">pperm_above</code><span class="sig-paren">(</span><em class="sig-param">accessing_obj</em>, <em class="sig-param">accessed_obj</em>, <em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/lockfuncs.html#pperm_above"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.lockfuncs.pperm_above" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Only allow Account objects with a permission <em>higher</em> in the permission
|
||
hierarchy than the one given. If there is no such higher rank,
|
||
it’s assumed we refer to superuser. If no hierarchy is defined,
|
||
this function has no meaning and returns False.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="evennia.locks.lockfuncs.self">
|
||
<code class="sig-prename descclassname">evennia.locks.lockfuncs.</code><code class="sig-name descname">self</code><span class="sig-paren">(</span><em class="sig-param">accessing_obj</em>, <em class="sig-param">accessed_obj</em>, <em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/lockfuncs.html#self"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.lockfuncs.self" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Check if accessing_obj is the same as accessed_obj</p>
|
||
<dl class="simple">
|
||
<dt>Usage:</dt><dd><p>self()</p>
|
||
</dd>
|
||
</dl>
|
||
<p>This can be used to lock specifically only to
|
||
the same object that the lock is defined on.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="evennia.locks.lockfuncs.serversetting">
|
||
<code class="sig-prename descclassname">evennia.locks.lockfuncs.</code><code class="sig-name descname">serversetting</code><span class="sig-paren">(</span><em class="sig-param">accessing_obj</em>, <em class="sig-param">accessed_obj</em>, <em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/lockfuncs.html#serversetting"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.lockfuncs.serversetting" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Only returns true if the Evennia settings exists, alternatively has
|
||
a certain value.</p>
|
||
<dl class="simple">
|
||
<dt>Usage:</dt><dd><p>serversetting(IRC_ENABLED)
|
||
serversetting(BASE_SCRIPT_PATH, [‘types’])</p>
|
||
</dd>
|
||
</dl>
|
||
<p>A given True/False or integers will be converted properly. Note that
|
||
everything will enter this function as strings, so they have to be
|
||
unpacked to their real value. We only support basic properties.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="evennia.locks.lockfuncs.superuser">
|
||
<code class="sig-prename descclassname">evennia.locks.lockfuncs.</code><code class="sig-name descname">superuser</code><span class="sig-paren">(</span><em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/lockfuncs.html#superuser"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.lockfuncs.superuser" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Only accepts an accesing_obj that is superuser (e.g. user #1)</p>
|
||
<p>Since a superuser would not ever reach this check (superusers
|
||
bypass the lock entirely), any user who gets this far cannot be a
|
||
superuser, hence we just return False. :)</p>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="evennia.locks.lockfuncs.tag">
|
||
<code class="sig-prename descclassname">evennia.locks.lockfuncs.</code><code class="sig-name descname">tag</code><span class="sig-paren">(</span><em class="sig-param">accessing_obj</em>, <em class="sig-param">accessed_obj</em>, <em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/lockfuncs.html#tag"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.lockfuncs.tag" title="Permalink to this definition">¶</a></dt>
|
||
<dd><dl class="simple">
|
||
<dt>Usage:</dt><dd><p>tag(tagkey)
|
||
tag(tagkey, category)</p>
|
||
</dd>
|
||
</dl>
|
||
<p>Only true if accessing_obj has the specified tag and optional
|
||
category.
|
||
If accessing_obj has the “.obj” property (such as is the case for
|
||
a command), then accessing_obj.obj is used instead.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="evennia.locks.lockfuncs.true">
|
||
<code class="sig-prename descclassname">evennia.locks.lockfuncs.</code><code class="sig-name descname">true</code><span class="sig-paren">(</span><em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/lockfuncs.html#true"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.lockfuncs.true" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Always returns True.</p>
|
||
</dd></dl>
|
||
|
||
</div>
|
||
<div class="section" id="module-evennia.locks.lockhandler">
|
||
<span id="evennia-locks-lockhandler-module"></span><h2>evennia.locks.lockhandler module<a class="headerlink" href="#module-evennia.locks.lockhandler" title="Permalink to this headline">¶</a></h2>
|
||
<p>A <em>lock</em> defines access to a particular subsystem or property of
|
||
Evennia. For example, the “owner” property can be impmemented as a
|
||
lock. Or the disability to lift an object or to ban users.</p>
|
||
<p>A lock consists of three parts:</p>
|
||
<blockquote>
|
||
<div><ul class="simple">
|
||
<li><p>access_type - this defines what kind of access this lock regulates. This
|
||
just a string.</p></li>
|
||
<li><p>function call - this is one or many calls to functions that will determine
|
||
if the lock is passed or not.</p></li>
|
||
<li><p>lock function(s). These are regular python functions with a special
|
||
set of allowed arguments. They should always return a boolean depending
|
||
on if they allow access or not.</p></li>
|
||
</ul>
|
||
</div></blockquote>
|
||
<p>A lock function is defined by existing in one of the modules
|
||
listed by settings.LOCK_FUNC_MODULES. It should also always
|
||
take four arguments looking like this:</p>
|
||
<blockquote>
|
||
<div><dl class="simple">
|
||
<dt>funcname(accessing_obj, accessed_obj, <a href="#id7"><span class="problematic" id="id8">*</span></a>args, <a href="#id9"><span class="problematic" id="id10">**</span></a>kwargs):</dt><dd><p>[…]</p>
|
||
</dd>
|
||
</dl>
|
||
</div></blockquote>
|
||
<p>The accessing object is the object wanting to gain access.
|
||
The accessed object is the object this lock resides on
|
||
args and kwargs will hold optional arguments and/or keyword arguments
|
||
to the function as a list and a dictionary respectively.</p>
|
||
<p class="rubric">Example</p>
|
||
<dl>
|
||
<dt>perm(accessing_obj, accessed_obj, <a href="#id11"><span class="problematic" id="id12">*</span></a>args, <a href="#id13"><span class="problematic" id="id14">**</span></a>kwargs):</dt><dd><p>“Checking if the object has a particular, desired permission”
|
||
if args:</p>
|
||
<blockquote>
|
||
<div><p>desired_perm = args[0]
|
||
return desired_perm in accessing_obj.permissions.all()</p>
|
||
</div></blockquote>
|
||
<p>return False</p>
|
||
</dd>
|
||
</dl>
|
||
<p>Lock functions should most often be pretty general and ideally possible to
|
||
re-use and combine in various ways to build clever locks.</p>
|
||
<p>Lock definition (“Lock string”)</p>
|
||
<p>A lock definition is a string with a special syntax. It is added to
|
||
each object’s lockhandler, making that lock available from then on.</p>
|
||
<p>The lock definition looks like this:</p>
|
||
<blockquote>
|
||
<div><p>‘access_type:[NOT] func1(args)[ AND|OR][NOT] func2() …’</p>
|
||
</div></blockquote>
|
||
<p>That is, the access_type, a colon followed by calls to lock functions
|
||
combined with AND or OR. NOT negates the result of the following call.</p>
|
||
<p class="rubric">Example</p>
|
||
<p>We want to limit who may edit a particular object (let’s call this access_type</p>
|
||
<p>for ‘edit’, it depends on what the command is looking for). We want this to
|
||
only work for those with the Permission ‘Builder’. So we use our lock
|
||
function above and define it like this:</p>
|
||
<blockquote>
|
||
<div><p>‘edit:perm(Builder)’</p>
|
||
</div></blockquote>
|
||
<p>Here, the lock-function perm() will be called with the string
|
||
‘Builder’ (accessing_obj and accessed_obj are added automatically,
|
||
you only need to add the args/kwargs, if any).</p>
|
||
<p>If we wanted to make sure the accessing object was BOTH a Builder and a
|
||
GoodGuy, we could use AND:</p>
|
||
<blockquote>
|
||
<div><p>‘edit:perm(Builder) AND perm(GoodGuy)’</p>
|
||
</div></blockquote>
|
||
<p>To allow EITHER Builder and GoodGuys, we replace AND with OR. perm() is just
|
||
one example, the lock function can do anything and compare any properties of
|
||
the calling object to decide if the lock is passed or not.</p>
|
||
<blockquote>
|
||
<div><p>‘lift:attrib(very_strong) AND NOT attrib(bad_back)’</p>
|
||
</div></blockquote>
|
||
<p>To make these work, add the string to the lockhandler of the object you want
|
||
to apply the lock to:</p>
|
||
<blockquote>
|
||
<div><p>obj.lockhandler.add(‘edit:perm(Builder)’)</p>
|
||
</div></blockquote>
|
||
<p>From then on, a command that wants to check for ‘edit’ access on this
|
||
object would do something like this:</p>
|
||
<blockquote>
|
||
<div><dl class="simple">
|
||
<dt>if not target_obj.lockhandler.has_perm(caller, ‘edit’):</dt><dd><p>caller.msg(“Sorry, you cannot edit that.”)</p>
|
||
</dd>
|
||
</dl>
|
||
</div></blockquote>
|
||
<p>All objects also has a shortcut called ‘access’ that is recommended to
|
||
use instead:</p>
|
||
<blockquote>
|
||
<div><dl class="simple">
|
||
<dt>if not target_obj.access(caller, ‘edit’):</dt><dd><p>caller.msg(“Sorry, you cannot edit that.”)</p>
|
||
</dd>
|
||
</dl>
|
||
</div></blockquote>
|
||
<p>Permissions</p>
|
||
<p>Permissions are just text strings stored in a comma-separated list on
|
||
typeclassed objects. The default perm() lock function uses them,
|
||
taking into account settings.PERMISSION_HIERARCHY. Also, the
|
||
restricted @perm command sets them, but otherwise they are identical
|
||
to any other identifier you can use.</p>
|
||
<dl class="class">
|
||
<dt id="evennia.locks.lockhandler.LockHandler">
|
||
<em class="property">class </em><code class="sig-prename descclassname">evennia.locks.lockhandler.</code><code class="sig-name descname">LockHandler</code><span class="sig-paren">(</span><em class="sig-param">obj</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/lockhandler.html#LockHandler"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.lockhandler.LockHandler" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
|
||
<p>This handler should be attached to all objects implementing
|
||
permission checks, under the property ‘lockhandler’.</p>
|
||
<dl class="method">
|
||
<dt id="evennia.locks.lockhandler.LockHandler.__init__">
|
||
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">obj</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/lockhandler.html#LockHandler.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.lockhandler.LockHandler.__init__" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Loads and pre-caches all relevant locks and their functions.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>obj</strong> (<em>object</em>) – The object on which the lockhandler is</p></li>
|
||
<li><p><strong>defined.</strong> – </p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="evennia.locks.lockhandler.LockHandler._cache_locks">
|
||
<code class="sig-name descname">_cache_locks</code><span class="sig-paren">(</span><em class="sig-param">storage_lockstring</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/lockhandler.html#LockHandler._cache_locks"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.lockhandler.LockHandler._cache_locks" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Store data</p>
|
||
</dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="evennia.locks.lockhandler.LockHandler._eval_access_type">
|
||
<code class="sig-name descname">_eval_access_type</code><span class="sig-paren">(</span><em class="sig-param">accessing_obj</em>, <em class="sig-param">locks</em>, <em class="sig-param">access_type</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/lockhandler.html#LockHandler._eval_access_type"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.lockhandler.LockHandler._eval_access_type" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Helper method for evaluating the access type using eval().</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>accessing_obj</strong> (<em>object</em>) – Object seeking access.</p></li>
|
||
<li><p><strong>locks</strong> (<em>dict</em>) – The pre-parsed representation of all access-types.</p></li>
|
||
<li><p><strong>access_type</strong> (<em>str</em>) – An access-type key to evaluate.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="evennia.locks.lockhandler.LockHandler._log_error">
|
||
<code class="sig-name descname">_log_error</code><span class="sig-paren">(</span><em class="sig-param">message</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/lockhandler.html#LockHandler._log_error"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.lockhandler.LockHandler._log_error" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Try to log errors back to object</p>
|
||
</dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="evennia.locks.lockhandler.LockHandler._parse_lockstring">
|
||
<code class="sig-name descname">_parse_lockstring</code><span class="sig-paren">(</span><em class="sig-param">storage_lockstring</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/lockhandler.html#LockHandler._parse_lockstring"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.lockhandler.LockHandler._parse_lockstring" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Helper function. This is normally only called when the
|
||
lockstring is cached and does preliminary checking. locks are
|
||
stored as a string</p>
|
||
<blockquote>
|
||
<div><p>atype:[NOT] lock()[[ AND|OR [NOT] lock()[…]];atype…</p>
|
||
</div></blockquote>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>storage_locksring</strong> (<em>str</em>) – The lockstring to parse.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="evennia.locks.lockhandler.LockHandler._save_locks">
|
||
<code class="sig-name descname">_save_locks</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/lockhandler.html#LockHandler._save_locks"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.lockhandler.LockHandler._save_locks" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Store locks to obj</p>
|
||
</dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="evennia.locks.lockhandler.LockHandler.add">
|
||
<code class="sig-name descname">add</code><span class="sig-paren">(</span><em class="sig-param">lockstring</em>, <em class="sig-param">validate_only=False</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/lockhandler.html#LockHandler.add"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.lockhandler.LockHandler.add" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Add a new lockstring to handler.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>lockstring</strong> (<em>str</em><em> or </em><em>list</em>) – A string on the form
|
||
<cite>“<access_type>:<functions>”</cite>. Multiple access types
|
||
should be separated by semicolon (<cite>;</cite>). Alternatively,
|
||
a list with lockstrings.</p></li>
|
||
<li><p><strong>validate_only</strong> (<em>bool</em><em>, </em><em>optional</em>) – If True, validate the lockstring but
|
||
don’t actually store it.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p><dl class="simple">
|
||
<dt>The outcome of the addition, <cite>False</cite> on</dt><dd><p>error. If <cite>validate_only</cite> is True, this will be a tuple
|
||
(bool, error), for pass/fail and a string error.</p>
|
||
</dd>
|
||
</dl>
|
||
</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>success (bool)</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="evennia.locks.lockhandler.LockHandler.all">
|
||
<code class="sig-name descname">all</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/lockhandler.html#LockHandler.all"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.lockhandler.LockHandler.all" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Return all lockstrings</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Returns</dt>
|
||
<dd class="field-odd"><p>All separate lockstrings</p>
|
||
</dd>
|
||
<dt class="field-even">Return type</dt>
|
||
<dd class="field-even"><p>lockstrings (list)</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="evennia.locks.lockhandler.LockHandler.append">
|
||
<code class="sig-name descname">append</code><span class="sig-paren">(</span><em class="sig-param">access_type</em>, <em class="sig-param">lockstring</em>, <em class="sig-param">op='or'</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/lockhandler.html#LockHandler.append"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.lockhandler.LockHandler.append" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Append a lock definition to access_type if it doesn’t already exist.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>access_type</strong> (<em>str</em>) – Access type.</p></li>
|
||
<li><p><strong>lockstring</strong> (<em>str</em>) – A valid lockstring, without the operator to
|
||
link it to an eventual existing lockstring.</p></li>
|
||
<li><p><strong>op</strong> (<em>str</em>) – An operator ‘and’, ‘or’, ‘and not’, ‘or not’ used
|
||
for appending the lockstring to an existing access-type.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<p>The most common use of this method is for use in commands where
|
||
the user can specify their own lockstrings. This method allows
|
||
the system to auto-add things like Admin-override access.</p>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="evennia.locks.lockhandler.LockHandler.cache_lock_bypass">
|
||
<code class="sig-name descname">cache_lock_bypass</code><span class="sig-paren">(</span><em class="sig-param">obj</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/lockhandler.html#LockHandler.cache_lock_bypass"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.lockhandler.LockHandler.cache_lock_bypass" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>We cache superuser bypass checks here for efficiency. This
|
||
needs to be re-run when an account is assigned to a character.
|
||
We need to grant access to superusers. We need to check both
|
||
directly on the object (accounts), through obj.account and using
|
||
the get_account() method (this sits on serversessions, in some
|
||
rare cases where a check is done before the login process has
|
||
yet been fully finalized)</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>obj</strong> (<em>object</em>) – This is checked for the <cite>is_superuser</cite> property.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="evennia.locks.lockhandler.LockHandler.check">
|
||
<code class="sig-name descname">check</code><span class="sig-paren">(</span><em class="sig-param">accessing_obj</em>, <em class="sig-param">access_type</em>, <em class="sig-param">default=False</em>, <em class="sig-param">no_superuser_bypass=False</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/lockhandler.html#LockHandler.check"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.lockhandler.LockHandler.check" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Checks a lock of the correct type by passing execution off to
|
||
the lock function(s).</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>accessing_obj</strong> (<em>object</em>) – The object seeking access.</p></li>
|
||
<li><p><strong>access_type</strong> (<em>str</em>) – The type of access wanted.</p></li>
|
||
<li><p><strong>default</strong> (<em>bool</em><em>, </em><em>optional</em>) – If no suitable lock type is
|
||
found, default to this result.</p></li>
|
||
<li><p><strong>no_superuser_bypass</strong> (<em>bool</em>) – Don’t use this unless you
|
||
really, really need to, it makes supersusers susceptible
|
||
to the lock check.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
<p class="rubric">Notes</p>
|
||
<p>A lock is executed in the follwoing way:</p>
|
||
<p>Parsing the lockstring, we (during cache) extract the valid
|
||
lock functions and store their function objects in the right
|
||
order along with their args/kwargs. These are now executed in
|
||
sequence, creating a list of True/False values. This is put
|
||
into the evalstring, which is a string of AND/OR/NOT entries
|
||
separated by placeholders where each function result should
|
||
go. We just put those results in and evaluate the string to
|
||
get a final, combined True/False value for the lockstring.</p>
|
||
<p>The important bit with this solution is that the full
|
||
lockstring is never blindly evaluated, and thus there (should
|
||
be) no way to sneak in malign code in it. Only “safe” lock
|
||
functions (as defined by your settings) are executed.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="evennia.locks.lockhandler.LockHandler.check_lockstring">
|
||
<code class="sig-name descname">check_lockstring</code><span class="sig-paren">(</span><em class="sig-param">accessing_obj</em>, <em class="sig-param">lockstring</em>, <em class="sig-param">no_superuser_bypass=False</em>, <em class="sig-param">default=False</em>, <em class="sig-param">access_type=None</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/lockhandler.html#LockHandler.check_lockstring"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.lockhandler.LockHandler.check_lockstring" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Do a direct check against a lockstring (‘atype:func()..’),
|
||
without any intermediary storage on the accessed object.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>accessing_obj</strong> (<em>object</em><em> or </em><em>None</em>) – The object seeking access.
|
||
Importantly, this can be left unset if the lock functions
|
||
don’t access it, no updating or storage of locks are made
|
||
against this object in this method.</p></li>
|
||
<li><p><strong>lockstring</strong> (<em>str</em>) – Lock string to check, on the form
|
||
<cite>“access_type:lock_definition”</cite> where the <cite>access_type</cite>
|
||
part can potentially be set to a dummy value to just check
|
||
a lock condition.</p></li>
|
||
<li><p><strong>no_superuser_bypass</strong> (<em>bool</em><em>, </em><em>optional</em>) – Force superusers to heed lock.</p></li>
|
||
<li><p><strong>default</strong> (<em>bool</em><em>, </em><em>optional</em>) – Fallback result to use if <cite>access_type</cite> is set
|
||
but no such <cite>access_type</cite> is found in the given <cite>lockstring</cite>.</p></li>
|
||
<li><p><strong>access_type</strong> (<em>str</em><em>, </em><em>bool</em>) – If set, only this access_type will be looked up
|
||
among the locks defined by <cite>lockstring</cite>.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>If check is passed or not.</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>access (bool)</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="evennia.locks.lockhandler.LockHandler.clear">
|
||
<code class="sig-name descname">clear</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/lockhandler.html#LockHandler.clear"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.lockhandler.LockHandler.clear" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Remove all locks in the handler.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="evennia.locks.lockhandler.LockHandler.delete">
|
||
<code class="sig-name descname">delete</code><span class="sig-paren">(</span><em class="sig-param">access_type</em><span class="sig-paren">)</span><a class="headerlink" href="#evennia.locks.lockhandler.LockHandler.delete" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Remove a particular lock from the handler</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>access_type</strong> (<em>str</em>) – The type of lock to remove.</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p><dl class="simple">
|
||
<dt>If the access_type was not found</dt><dd><p>in the lock, this returns <cite>False</cite>.</p>
|
||
</dd>
|
||
</dl>
|
||
</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>success (bool)</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="evennia.locks.lockhandler.LockHandler.get">
|
||
<code class="sig-name descname">get</code><span class="sig-paren">(</span><em class="sig-param">access_type=None</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/lockhandler.html#LockHandler.get"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.lockhandler.LockHandler.get" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Get the full lockstring or the lockstring of a particular
|
||
access type.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>access_type</strong> (<em>str</em><em>, </em><em>optional</em>) – </p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p><dl class="simple">
|
||
<dt>The matched lockstring, or the full</dt><dd><p>lockstring if no access_type was given.</p>
|
||
</dd>
|
||
</dl>
|
||
</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>lockstring (str)</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="evennia.locks.lockhandler.LockHandler.remove">
|
||
<code class="sig-name descname">remove</code><span class="sig-paren">(</span><em class="sig-param">access_type</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/lockhandler.html#LockHandler.remove"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.lockhandler.LockHandler.remove" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Remove a particular lock from the handler</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>access_type</strong> (<em>str</em>) – The type of lock to remove.</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p><dl class="simple">
|
||
<dt>If the access_type was not found</dt><dd><p>in the lock, this returns <cite>False</cite>.</p>
|
||
</dd>
|
||
</dl>
|
||
</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>success (bool)</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="evennia.locks.lockhandler.LockHandler.replace">
|
||
<code class="sig-name descname">replace</code><span class="sig-paren">(</span><em class="sig-param">lockstring</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/lockhandler.html#LockHandler.replace"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.lockhandler.LockHandler.replace" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Replaces the lockstring entirely.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>lockstring</strong> (<em>str</em>) – The new lock definition.</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>False if an error occurred.</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>success (bool)</p>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><p><a class="reference internal" href="#evennia.locks.lockhandler.LockException" title="evennia.locks.lockhandler.LockException"><strong>LockException</strong></a> – If a critical error occurred.
|
||
If so, the old string is recovered.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="evennia.locks.lockhandler.LockHandler.reset">
|
||
<code class="sig-name descname">reset</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/lockhandler.html#LockHandler.reset"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.lockhandler.LockHandler.reset" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Set the reset flag, so the the lock will be re-cached at next
|
||
checking. This is usually called by @reload.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="evennia.locks.lockhandler.LockHandler.validate">
|
||
<code class="sig-name descname">validate</code><span class="sig-paren">(</span><em class="sig-param">lockstring</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/lockhandler.html#LockHandler.validate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.lockhandler.LockHandler.validate" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Validate lockstring syntactically, without saving it.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>lockstring</strong> (<em>str</em>) – Lockstring to validate.</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>If validation passed or not.</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>valid (bool)</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="exception">
|
||
<dt id="evennia.locks.lockhandler.LockException">
|
||
<em class="property">exception </em><code class="sig-prename descclassname">evennia.locks.lockhandler.</code><code class="sig-name descname">LockException</code><a class="reference internal" href="../_modules/evennia/locks/lockhandler.html#LockException"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.lockhandler.LockException" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">Exception</span></code></p>
|
||
<p>Raised during an error in a lock.</p>
|
||
</dd></dl>
|
||
|
||
</div>
|
||
<div class="section" id="module-evennia.locks.tests">
|
||
<span id="evennia-locks-tests-module"></span><h2>evennia.locks.tests module<a class="headerlink" href="#module-evennia.locks.tests" title="Permalink to this headline">¶</a></h2>
|
||
<p>This is part of Evennia’s unittest framework, for testing
|
||
the stability and integrity of the codebase during updates.</p>
|
||
<p>This module tests the lock functionality of Evennia.</p>
|
||
<dl class="class">
|
||
<dt id="evennia.locks.tests.TestLockCheck">
|
||
<em class="property">class </em><code class="sig-prename descclassname">evennia.locks.tests.</code><code class="sig-name descname">TestLockCheck</code><span class="sig-paren">(</span><em class="sig-param">methodName='runTest'</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/tests.html#TestLockCheck"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.tests.TestLockCheck" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Bases: <a class="reference internal" href="evennia.utils.html#evennia.utils.test_resources.EvenniaTest" title="evennia.utils.test_resources.EvenniaTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.EvenniaTest</span></code></a></p>
|
||
<dl class="method">
|
||
<dt id="evennia.locks.tests.TestLockCheck.testrun">
|
||
<code class="sig-name descname">testrun</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/tests.html#TestLockCheck.testrun"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.tests.TestLockCheck.testrun" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="class">
|
||
<dt id="evennia.locks.tests.TestLockfuncs">
|
||
<em class="property">class </em><code class="sig-prename descclassname">evennia.locks.tests.</code><code class="sig-name descname">TestLockfuncs</code><span class="sig-paren">(</span><em class="sig-param">methodName='runTest'</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/tests.html#TestLockfuncs"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.tests.TestLockfuncs" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Bases: <a class="reference internal" href="evennia.utils.html#evennia.utils.test_resources.EvenniaTest" title="evennia.utils.test_resources.EvenniaTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.EvenniaTest</span></code></a></p>
|
||
<dl class="method">
|
||
<dt id="evennia.locks.tests.TestLockfuncs.setUp">
|
||
<code class="sig-name descname">setUp</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/tests.html#TestLockfuncs.setUp"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.tests.TestLockfuncs.setUp" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Sets up testing environment</p>
|
||
</dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="evennia.locks.tests.TestLockfuncs.test_account_perm">
|
||
<code class="sig-name descname">test_account_perm</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/tests.html#TestLockfuncs.test_account_perm"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.tests.TestLockfuncs.test_account_perm" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="evennia.locks.tests.TestLockfuncs.test_account_perm_above">
|
||
<code class="sig-name descname">test_account_perm_above</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/tests.html#TestLockfuncs.test_account_perm_above"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.tests.TestLockfuncs.test_account_perm_above" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="evennia.locks.tests.TestLockfuncs.test_attr">
|
||
<code class="sig-name descname">test_attr</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/tests.html#TestLockfuncs.test_attr"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.tests.TestLockfuncs.test_attr" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="evennia.locks.tests.TestLockfuncs.test_booleans">
|
||
<code class="sig-name descname">test_booleans</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/tests.html#TestLockfuncs.test_booleans"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.tests.TestLockfuncs.test_booleans" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="evennia.locks.tests.TestLockfuncs.test_dbref">
|
||
<code class="sig-name descname">test_dbref</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/tests.html#TestLockfuncs.test_dbref"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.tests.TestLockfuncs.test_dbref" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="evennia.locks.tests.TestLockfuncs.test_has_account">
|
||
<code class="sig-name descname">test_has_account</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/tests.html#TestLockfuncs.test_has_account"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.tests.TestLockfuncs.test_has_account" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="evennia.locks.tests.TestLockfuncs.test_inside_holds">
|
||
<code class="sig-name descname">test_inside_holds</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/tests.html#TestLockfuncs.test_inside_holds"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.tests.TestLockfuncs.test_inside_holds" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="evennia.locks.tests.TestLockfuncs.test_locattr">
|
||
<code class="sig-name descname">test_locattr</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/tests.html#TestLockfuncs.test_locattr"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.tests.TestLockfuncs.test_locattr" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="evennia.locks.tests.TestLockfuncs.test_object_above_perm">
|
||
<code class="sig-name descname">test_object_above_perm</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/tests.html#TestLockfuncs.test_object_above_perm"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.tests.TestLockfuncs.test_object_above_perm" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="evennia.locks.tests.TestLockfuncs.test_object_perm">
|
||
<code class="sig-name descname">test_object_perm</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/tests.html#TestLockfuncs.test_object_perm"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.tests.TestLockfuncs.test_object_perm" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="evennia.locks.tests.TestLockfuncs.test_pperm">
|
||
<code class="sig-name descname">test_pperm</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/tests.html#TestLockfuncs.test_pperm"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.tests.TestLockfuncs.test_pperm" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="evennia.locks.tests.TestLockfuncs.test_puppet_perm">
|
||
<code class="sig-name descname">test_puppet_perm</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/tests.html#TestLockfuncs.test_puppet_perm"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.tests.TestLockfuncs.test_puppet_perm" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="evennia.locks.tests.TestLockfuncs.test_quell_above_perm">
|
||
<code class="sig-name descname">test_quell_above_perm</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/tests.html#TestLockfuncs.test_quell_above_perm"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.tests.TestLockfuncs.test_quell_above_perm" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="evennia.locks.tests.TestLockfuncs.test_quell_perm">
|
||
<code class="sig-name descname">test_quell_perm</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/tests.html#TestLockfuncs.test_quell_perm"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.tests.TestLockfuncs.test_quell_perm" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="evennia.locks.tests.TestLockfuncs.test_serversetting">
|
||
<code class="sig-name descname">test_serversetting</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/tests.html#TestLockfuncs.test_serversetting"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.tests.TestLockfuncs.test_serversetting" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="evennia.locks.tests.TestLockfuncs.test_tag">
|
||
<code class="sig-name descname">test_tag</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/tests.html#TestLockfuncs.test_tag"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.tests.TestLockfuncs.test_tag" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="evennia.locks.tests.TestLockfuncs.test_traverse_taglock">
|
||
<code class="sig-name descname">test_traverse_taglock</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/tests.html#TestLockfuncs.test_traverse_taglock"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.tests.TestLockfuncs.test_traverse_taglock" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="evennia.locks.tests.TestLockfuncs.test_traverse_taglock_fail">
|
||
<code class="sig-name descname">test_traverse_taglock_fail</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/locks/tests.html#TestLockfuncs.test_traverse_taglock_fail"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.locks.tests.TestLockfuncs.test_traverse_taglock_fail" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
</div>
|
||
</div>
|
||
|
||
|
||
</div>
|
||
|
||
</div>
|
||
</div>
|
||
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
||
<div class="sphinxsidebarwrapper">
|
||
<div id="searchbox" style="display: none" role="search">
|
||
<h3 id="searchlabel">Quick search</h3>
|
||
<div class="searchformwrapper">
|
||
<form class="search" action="../search.html" method="get">
|
||
<input type="text" name="q" aria-labelledby="searchlabel" />
|
||
<input type="submit" value="Go" />
|
||
</form>
|
||
</div>
|
||
</div>
|
||
<script>$('#searchbox').show(0);</script>
|
||
<p><h3><a href="../index.html">Table of Contents</a></h3>
|
||
<ul>
|
||
<li><a class="reference internal" href="#">evennia.locks package</a><ul>
|
||
<li><a class="reference internal" href="#submodules">Submodules</a></li>
|
||
<li><a class="reference internal" href="#module-evennia.locks.lockfuncs">evennia.locks.lockfuncs module</a></li>
|
||
<li><a class="reference internal" href="#module-evennia.locks.lockhandler">evennia.locks.lockhandler module</a></li>
|
||
<li><a class="reference internal" href="#module-evennia.locks.tests">evennia.locks.tests module</a></li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
<div class="relations">
|
||
<h3>Related Topics</h3>
|
||
<ul>
|
||
<li><a href="../index.html">Documentation overview</a><ul>
|
||
</ul></li>
|
||
</ul>
|
||
</div>
|
||
<div role="note" aria-label="source link">
|
||
<!--h3>This Page</h3-->
|
||
<ul class="this-page-menu">
|
||
<li><a href="../_sources/api/evennia.locks.rst.txt"
|
||
rel="nofollow">Show Page Source</a></li>
|
||
</ul>
|
||
</div>
|
||
<h3>Versions</h3>
|
||
<ul>
|
||
<li><a href="evennia.locks.html">1.0-dev (develop branch)</a></li>
|
||
<li><a href="../../../versions/0.9.1/api/evennia.locks.html">0.9.1 (master branch)</a></li>
|
||
</ul>
|
||
|
||
</div>
|
||
</div>
|
||
<div class="clearer"></div>
|
||
</div>
|
||
<div class="footer">
|
||
©2020, The Evennia developer community.
|
||
|
||
|
|
||
Powered by <a href="http://sphinx-doc.org/">Sphinx 2.4.4</a>
|
||
& <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
|
||
|
||
|
|
||
<a href="../_sources/api/evennia.locks.rst.txt"
|
||
rel="nofollow">Page source</a>
|
||
</div>
|
||
|
||
|
||
|
||
|
||
</body>
|
||
</html> |