<spanid="evennia-locks-package"></span><h1>evennia.locks package<aclass="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>
<divclass="section"id="submodules">
<h2>Submodules<aclass="headerlink"href="#submodules"title="Permalink to this headline">¶</a></h2>
<spanid="evennia-locks-lockfuncs-module"></span><h2>evennia.locks.lockfuncs module<aclass="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
<codeclass="sig-prename descclassname">evennia.locks.lockfuncs.</code><codeclass="sig-name descname">_to_account</code><spanclass="sig-paren">(</span><emclass="sig-param">accessing_obj</em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/lockfuncs.html#_to_account"><spanclass="viewcode-link">[source]</span></a><aclass="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>
<dlclass="function">
<dtid="evennia.locks.lockfuncs.all">
<codeclass="sig-prename descclassname">evennia.locks.lockfuncs.</code><codeclass="sig-name descname">all</code><spanclass="sig-paren">(</span><emclass="sig-param">*args</em>, <emclass="sig-param">**kwargs</em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/lockfuncs.html#all"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.locks.lockfuncs.all"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="function">
<dtid="evennia.locks.lockfuncs.attr">
<codeclass="sig-prename descclassname">evennia.locks.lockfuncs.</code><codeclass="sig-name descname">attr</code><spanclass="sig-paren">(</span><emclass="sig-param">accessing_obj</em>, <emclass="sig-param">accessed_obj</em>, <emclass="sig-param">*args</em>, <emclass="sig-param">**kwargs</em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/lockfuncs.html#attr"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.locks.lockfuncs.attr"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="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>
<dlclass="function">
<dtid="evennia.locks.lockfuncs.attr_eq">
<codeclass="sig-prename descclassname">evennia.locks.lockfuncs.</code><codeclass="sig-name descname">attr_eq</code><spanclass="sig-paren">(</span><emclass="sig-param">accessing_obj</em>, <emclass="sig-param">accessed_obj</em>, <emclass="sig-param">*args</em>, <emclass="sig-param">**kwargs</em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/lockfuncs.html#attr_eq"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.locks.lockfuncs.attr_eq"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="simple">
<dt>Usage:</dt><dd><p>attr_gt(attrname, 54)</p>
</dd>
</dl>
</dd></dl>
<dlclass="function">
<dtid="evennia.locks.lockfuncs.attr_ge">
<codeclass="sig-prename descclassname">evennia.locks.lockfuncs.</code><codeclass="sig-name descname">attr_ge</code><spanclass="sig-paren">(</span><emclass="sig-param">accessing_obj</em>, <emclass="sig-param">accessed_obj</em>, <emclass="sig-param">*args</em>, <emclass="sig-param">**kwargs</em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/lockfuncs.html#attr_ge"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.locks.lockfuncs.attr_ge"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="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>
<dlclass="function">
<dtid="evennia.locks.lockfuncs.attr_gt">
<codeclass="sig-prename descclassname">evennia.locks.lockfuncs.</code><codeclass="sig-name descname">attr_gt</code><spanclass="sig-paren">(</span><emclass="sig-param">accessing_obj</em>, <emclass="sig-param">accessed_obj</em>, <emclass="sig-param">*args</em>, <emclass="sig-param">**kwargs</em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/lockfuncs.html#attr_gt"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.locks.lockfuncs.attr_gt"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="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>
<dlclass="function">
<dtid="evennia.locks.lockfuncs.attr_le">
<codeclass="sig-prename descclassname">evennia.locks.lockfuncs.</code><codeclass="sig-name descname">attr_le</code><spanclass="sig-paren">(</span><emclass="sig-param">accessing_obj</em>, <emclass="sig-param">accessed_obj</em>, <emclass="sig-param">*args</em>, <emclass="sig-param">**kwargs</em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/lockfuncs.html#attr_le"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.locks.lockfuncs.attr_le"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="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>
<dlclass="function">
<dtid="evennia.locks.lockfuncs.attr_lt">
<codeclass="sig-prename descclassname">evennia.locks.lockfuncs.</code><codeclass="sig-name descname">attr_lt</code><spanclass="sig-paren">(</span><emclass="sig-param">accessing_obj</em>, <emclass="sig-param">accessed_obj</em>, <emclass="sig-param">*args</em>, <emclass="sig-param">**kwargs</em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/lockfuncs.html#attr_lt"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.locks.lockfuncs.attr_lt"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="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>
<dlclass="function">
<dtid="evennia.locks.lockfuncs.attr_ne">
<codeclass="sig-prename descclassname">evennia.locks.lockfuncs.</code><codeclass="sig-name descname">attr_ne</code><spanclass="sig-paren">(</span><emclass="sig-param">accessing_obj</em>, <emclass="sig-param">accessed_obj</em>, <emclass="sig-param">*args</em>, <emclass="sig-param">**kwargs</em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/lockfuncs.html#attr_ne"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.locks.lockfuncs.attr_ne"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="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>
<dlclass="function">
<dtid="evennia.locks.lockfuncs.dbref">
<codeclass="sig-prename descclassname">evennia.locks.lockfuncs.</code><codeclass="sig-name descname">dbref</code><spanclass="sig-paren">(</span><emclass="sig-param">accessing_obj</em>, <emclass="sig-param">accessed_obj</em>, <emclass="sig-param">*args</em>, <emclass="sig-param">**kwargs</em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/lockfuncs.html#dbref"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.locks.lockfuncs.dbref"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="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>
<dlclass="function">
<dtid="evennia.locks.lockfuncs.false">
<codeclass="sig-prename descclassname">evennia.locks.lockfuncs.</code><codeclass="sig-name descname">false</code><spanclass="sig-paren">(</span><emclass="sig-param">*args</em>, <emclass="sig-param">**kwargs</em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/lockfuncs.html#false"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.locks.lockfuncs.false"title="Permalink to this definition">¶</a></dt>
<dd><p>Always returns False</p>
</dd></dl>
<dlclass="function">
<dtid="evennia.locks.lockfuncs.has_account">
<codeclass="sig-prename descclassname">evennia.locks.lockfuncs.</code><codeclass="sig-name descname">has_account</code><spanclass="sig-paren">(</span><emclass="sig-param">accessing_obj</em>, <emclass="sig-param">accessed_obj</em>, <emclass="sig-param">*args</em>, <emclass="sig-param">**kwargs</em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/lockfuncs.html#has_account"><spanclass="viewcode-link">[source]</span></a><aclass="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>
<dlclass="function">
<dtid="evennia.locks.lockfuncs.holds">
<codeclass="sig-prename descclassname">evennia.locks.lockfuncs.</code><codeclass="sig-name descname">holds</code><spanclass="sig-paren">(</span><emclass="sig-param">accessing_obj</em>, <emclass="sig-param">accessed_obj</em>, <emclass="sig-param">*args</em>, <emclass="sig-param">**kwargs</em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/lockfuncs.html#holds"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.locks.lockfuncs.holds"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="simple">
<dt>Usage:</dt><dd><dlclass="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>
<dlclass="function">
<dtid="evennia.locks.lockfuncs.id">
<codeclass="sig-prename descclassname">evennia.locks.lockfuncs.</code><codeclass="sig-name descname">id</code><spanclass="sig-paren">(</span><emclass="sig-param">accessing_obj</em>, <emclass="sig-param">accessed_obj</em>, <emclass="sig-param">*args</em>, <emclass="sig-param">**kwargs</em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/lockfuncs.html#id"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.locks.lockfuncs.id"title="Permalink to this definition">¶</a></dt>
<dd><p>Alias to dbref</p>
</dd></dl>
<dlclass="function">
<dtid="evennia.locks.lockfuncs.inside">
<codeclass="sig-prename descclassname">evennia.locks.lockfuncs.</code><codeclass="sig-name descname">inside</code><spanclass="sig-paren">(</span><emclass="sig-param">accessing_obj</em>, <emclass="sig-param">accessed_obj</em>, <emclass="sig-param">*args</em>, <emclass="sig-param">**kwargs</em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/lockfuncs.html#inside"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.locks.lockfuncs.inside"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="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>
<dlclass="function">
<dtid="evennia.locks.lockfuncs.inside_rec">
<codeclass="sig-prename descclassname">evennia.locks.lockfuncs.</code><codeclass="sig-name descname">inside_rec</code><spanclass="sig-paren">(</span><emclass="sig-param">accessing_obj</em>, <emclass="sig-param">accessed_obj</em>, <emclass="sig-param">*args</em>, <emclass="sig-param">**kwargs</em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/lockfuncs.html#inside_rec"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.locks.lockfuncs.inside_rec"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="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>
<dlclass="function">
<dtid="evennia.locks.lockfuncs.locattr">
<codeclass="sig-prename descclassname">evennia.locks.lockfuncs.</code><codeclass="sig-name descname">locattr</code><spanclass="sig-paren">(</span><emclass="sig-param">accessing_obj</em>, <emclass="sig-param">accessed_obj</em>, <emclass="sig-param">*args</em>, <emclass="sig-param">**kwargs</em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/lockfuncs.html#locattr"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.locks.lockfuncs.locattr"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="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>
<dlclass="function">
<dtid="evennia.locks.lockfuncs.none">
<codeclass="sig-prename descclassname">evennia.locks.lockfuncs.</code><codeclass="sig-name descname">none</code><spanclass="sig-paren">(</span><emclass="sig-param">*args</em>, <emclass="sig-param">**kwargs</em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/lockfuncs.html#none"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.locks.lockfuncs.none"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="function">
<dtid="evennia.locks.lockfuncs.objattr">
<codeclass="sig-prename descclassname">evennia.locks.lockfuncs.</code><codeclass="sig-name descname">objattr</code><spanclass="sig-paren">(</span><emclass="sig-param">accessing_obj</em>, <emclass="sig-param">accessed_obj</em>, <emclass="sig-param">*args</em>, <emclass="sig-param">**kwargs</em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/lockfuncs.html#objattr"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.locks.lockfuncs.objattr"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="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>
<dlclass="function">
<dtid="evennia.locks.lockfuncs.objlocattr">
<codeclass="sig-prename descclassname">evennia.locks.lockfuncs.</code><codeclass="sig-name descname">objlocattr</code><spanclass="sig-paren">(</span><emclass="sig-param">accessing_obj</em>, <emclass="sig-param">accessed_obj</em>, <emclass="sig-param">*args</em>, <emclass="sig-param">**kwargs</em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/lockfuncs.html#objlocattr"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.locks.lockfuncs.objlocattr"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="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>
<dlclass="function">
<dtid="evennia.locks.lockfuncs.objtag">
<codeclass="sig-prename descclassname">evennia.locks.lockfuncs.</code><codeclass="sig-name descname">objtag</code><spanclass="sig-paren">(</span><emclass="sig-param">accessing_obj</em>, <emclass="sig-param">accessed_obj</em>, <emclass="sig-param">*args</em>, <emclass="sig-param">**kwargs</em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/lockfuncs.html#objtag"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.locks.lockfuncs.objtag"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="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>
<dlclass="function">
<dtid="evennia.locks.lockfuncs.pdbref">
<codeclass="sig-prename descclassname">evennia.locks.lockfuncs.</code><codeclass="sig-name descname">pdbref</code><spanclass="sig-paren">(</span><emclass="sig-param">accessing_obj</em>, <emclass="sig-param">accessed_obj</em>, <emclass="sig-param">*args</em>, <emclass="sig-param">**kwargs</em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/lockfuncs.html#pdbref"><spanclass="viewcode-link">[source]</span></a><aclass="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>
<dlclass="function">
<dtid="evennia.locks.lockfuncs.perm">
<codeclass="sig-prename descclassname">evennia.locks.lockfuncs.</code><codeclass="sig-name descname">perm</code><spanclass="sig-paren">(</span><emclass="sig-param">accessing_obj</em>, <emclass="sig-param">accessed_obj</em>, <emclass="sig-param">*args</em>, <emclass="sig-param">**kwargs</em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/lockfuncs.html#perm"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.locks.lockfuncs.perm"title="Permalink to this definition">¶</a></dt>
<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>
<dlclass="function">
<dtid="evennia.locks.lockfuncs.perm_above">
<codeclass="sig-prename descclassname">evennia.locks.lockfuncs.</code><codeclass="sig-name descname">perm_above</code><spanclass="sig-paren">(</span><emclass="sig-param">accessing_obj</em>, <emclass="sig-param">accessed_obj</em>, <emclass="sig-param">*args</em>, <emclass="sig-param">**kwargs</em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/lockfuncs.html#perm_above"><spanclass="viewcode-link">[source]</span></a><aclass="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>
<dlclass="function">
<dtid="evennia.locks.lockfuncs.pid">
<codeclass="sig-prename descclassname">evennia.locks.lockfuncs.</code><codeclass="sig-name descname">pid</code><spanclass="sig-paren">(</span><emclass="sig-param">accessing_obj</em>, <emclass="sig-param">accessed_obj</em>, <emclass="sig-param">*args</em>, <emclass="sig-param">**kwargs</em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/lockfuncs.html#pid"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.locks.lockfuncs.pid"title="Permalink to this definition">¶</a></dt>
<dd><p>Alias to dbref, for Accounts</p>
</dd></dl>
<dlclass="function">
<dtid="evennia.locks.lockfuncs.pperm">
<codeclass="sig-prename descclassname">evennia.locks.lockfuncs.</code><codeclass="sig-name descname">pperm</code><spanclass="sig-paren">(</span><emclass="sig-param">accessing_obj</em>, <emclass="sig-param">accessed_obj</em>, <emclass="sig-param">*args</em>, <emclass="sig-param">**kwargs</em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/lockfuncs.html#pperm"><spanclass="viewcode-link">[source]</span></a><aclass="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>
<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>
<dlclass="function">
<dtid="evennia.locks.lockfuncs.pperm_above">
<codeclass="sig-prename descclassname">evennia.locks.lockfuncs.</code><codeclass="sig-name descname">pperm_above</code><spanclass="sig-paren">(</span><emclass="sig-param">accessing_obj</em>, <emclass="sig-param">accessed_obj</em>, <emclass="sig-param">*args</em>, <emclass="sig-param">**kwargs</em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/lockfuncs.html#pperm_above"><spanclass="viewcode-link">[source]</span></a><aclass="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>
<dlclass="function">
<dtid="evennia.locks.lockfuncs.self">
<codeclass="sig-prename descclassname">evennia.locks.lockfuncs.</code><codeclass="sig-name descname">self</code><spanclass="sig-paren">(</span><emclass="sig-param">accessing_obj</em>, <emclass="sig-param">accessed_obj</em>, <emclass="sig-param">*args</em>, <emclass="sig-param">**kwargs</em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/lockfuncs.html#self"><spanclass="viewcode-link">[source]</span></a><aclass="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>
<dlclass="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>
<dlclass="function">
<dtid="evennia.locks.lockfuncs.serversetting">
<codeclass="sig-prename descclassname">evennia.locks.lockfuncs.</code><codeclass="sig-name descname">serversetting</code><spanclass="sig-paren">(</span><emclass="sig-param">accessing_obj</em>, <emclass="sig-param">accessed_obj</em>, <emclass="sig-param">*args</em>, <emclass="sig-param">**kwargs</em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/lockfuncs.html#serversetting"><spanclass="viewcode-link">[source]</span></a><aclass="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>
<dlclass="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>
<dlclass="function">
<dtid="evennia.locks.lockfuncs.superuser">
<codeclass="sig-prename descclassname">evennia.locks.lockfuncs.</code><codeclass="sig-name descname">superuser</code><spanclass="sig-paren">(</span><emclass="sig-param">*args</em>, <emclass="sig-param">**kwargs</em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/lockfuncs.html#superuser"><spanclass="viewcode-link">[source]</span></a><aclass="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>
<dlclass="function">
<dtid="evennia.locks.lockfuncs.tag">
<codeclass="sig-prename descclassname">evennia.locks.lockfuncs.</code><codeclass="sig-name descname">tag</code><spanclass="sig-paren">(</span><emclass="sig-param">accessing_obj</em>, <emclass="sig-param">accessed_obj</em>, <emclass="sig-param">*args</em>, <emclass="sig-param">**kwargs</em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/lockfuncs.html#tag"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.locks.lockfuncs.tag"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="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>
<dlclass="function">
<dtid="evennia.locks.lockfuncs.true">
<codeclass="sig-prename descclassname">evennia.locks.lockfuncs.</code><codeclass="sig-name descname">true</code><spanclass="sig-paren">(</span><emclass="sig-param">*args</em>, <emclass="sig-param">**kwargs</em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/lockfuncs.html#true"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.locks.lockfuncs.true"title="Permalink to this definition">¶</a></dt>
<spanid="evennia-locks-lockhandler-module"></span><h2>evennia.locks.lockhandler module<aclass="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><ulclass="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
<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>
<pclass="rubric">Example</p>
<dl>
<dt>perm(accessing_obj, accessed_obj, <ahref="#id11"><spanclass="problematic"id="id12">*</span></a>args, <ahref="#id13"><spanclass="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>From then on, a command that wants to check for ‘edit’ access on this
object would do something like this:</p>
<blockquote>
<div><dlclass="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><dlclass="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>
<dlclass="class">
<dtid="evennia.locks.lockhandler.LockHandler">
<emclass="property">class </em><codeclass="sig-prename descclassname">evennia.locks.lockhandler.</code><codeclass="sig-name descname">LockHandler</code><spanclass="sig-paren">(</span><emclass="sig-param">obj</em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/lockhandler.html#LockHandler"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.locks.lockhandler.LockHandler"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">__init__</code><spanclass="sig-paren">(</span><emclass="sig-param">obj</em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/lockhandler.html#LockHandler.__init__"><spanclass="viewcode-link">[source]</span></a><aclass="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>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>obj</strong> (<em>object</em>) – The object on which the lockhandler is</p></li>
<codeclass="sig-name descname">_cache_locks</code><spanclass="sig-paren">(</span><emclass="sig-param">storage_lockstring</em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/lockhandler.html#LockHandler._cache_locks"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.locks.lockhandler.LockHandler._cache_locks"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">_eval_access_type</code><spanclass="sig-paren">(</span><emclass="sig-param">accessing_obj</em>, <emclass="sig-param">locks</em>, <emclass="sig-param">access_type</em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/lockhandler.html#LockHandler._eval_access_type"><spanclass="viewcode-link">[source]</span></a><aclass="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>
<codeclass="sig-name descname">_log_error</code><spanclass="sig-paren">(</span><emclass="sig-param">message</em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/lockhandler.html#LockHandler._log_error"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.locks.lockhandler.LockHandler._log_error"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">_parse_lockstring</code><spanclass="sig-paren">(</span><emclass="sig-param">storage_lockstring</em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/lockhandler.html#LockHandler._parse_lockstring"><spanclass="viewcode-link">[source]</span></a><aclass="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
<codeclass="sig-name descname">_save_locks</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/lockhandler.html#LockHandler._save_locks"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.locks.lockhandler.LockHandler._save_locks"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">add</code><spanclass="sig-paren">(</span><emclass="sig-param">lockstring</em>, <emclass="sig-param">validate_only=False</em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/lockhandler.html#LockHandler.add"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.locks.lockhandler.LockHandler.add"title="Permalink to this definition">¶</a></dt>
<dd><p>Add a new lockstring to handler.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>lockstring</strong> (<em>str</em><em> or </em><em>list</em>) – A string on the form
<codeclass="sig-name descname">all</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/lockhandler.html#LockHandler.all"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.locks.lockhandler.LockHandler.all"title="Permalink to this definition">¶</a></dt>
<dd><p>Return all lockstrings</p>
<dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p>All separate lockstrings</p>
<codeclass="sig-name descname">append</code><spanclass="sig-paren">(</span><emclass="sig-param">access_type</em>, <emclass="sig-param">lockstring</em>, <emclass="sig-param">op='or'</em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/lockhandler.html#LockHandler.append"><spanclass="viewcode-link">[source]</span></a><aclass="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>
<codeclass="sig-name descname">cache_lock_bypass</code><spanclass="sig-paren">(</span><emclass="sig-param">obj</em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/lockhandler.html#LockHandler.cache_lock_bypass"><spanclass="viewcode-link">[source]</span></a><aclass="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>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>obj</strong> (<em>object</em>) – This is checked for the <cite>is_superuser</cite> property.</p>
<codeclass="sig-name descname">check</code><spanclass="sig-paren">(</span><emclass="sig-param">accessing_obj</em>, <emclass="sig-param">access_type</em>, <emclass="sig-param">default=False</em>, <emclass="sig-param">no_superuser_bypass=False</em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/lockhandler.html#LockHandler.check"><spanclass="viewcode-link">[source]</span></a><aclass="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>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="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>
<pclass="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>
<codeclass="sig-name descname">check_lockstring</code><spanclass="sig-paren">(</span><emclass="sig-param">accessing_obj</em>, <emclass="sig-param">lockstring</em>, <emclass="sig-param">no_superuser_bypass=False</em>, <emclass="sig-param">default=False</em>, <emclass="sig-param">access_type=None</em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/lockhandler.html#LockHandler.check_lockstring"><spanclass="viewcode-link">[source]</span></a><aclass="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>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="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>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p>If check is passed or not.</p>
<codeclass="sig-name descname">clear</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/lockhandler.html#LockHandler.clear"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.locks.lockhandler.LockHandler.clear"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">delete</code><spanclass="sig-paren">(</span><emclass="sig-param">access_type</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#evennia.locks.lockhandler.LockHandler.delete"title="Permalink to this definition">¶</a></dt>
<dd><p>Remove a particular lock from the handler</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>access_type</strong> (<em>str</em>) – The type of lock to remove.</p>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p><dlclass="simple">
<dt>If the access_type was not found</dt><dd><p>in the lock, this returns <cite>False</cite>.</p>
<codeclass="sig-name descname">get</code><spanclass="sig-paren">(</span><emclass="sig-param">access_type=None</em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/lockhandler.html#LockHandler.get"><spanclass="viewcode-link">[source]</span></a><aclass="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
<codeclass="sig-name descname">remove</code><spanclass="sig-paren">(</span><emclass="sig-param">access_type</em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/lockhandler.html#LockHandler.remove"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.locks.lockhandler.LockHandler.remove"title="Permalink to this definition">¶</a></dt>
<dd><p>Remove a particular lock from the handler</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>access_type</strong> (<em>str</em>) – The type of lock to remove.</p>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p><dlclass="simple">
<dt>If the access_type was not found</dt><dd><p>in the lock, this returns <cite>False</cite>.</p>
<codeclass="sig-name descname">replace</code><spanclass="sig-paren">(</span><emclass="sig-param">lockstring</em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/lockhandler.html#LockHandler.replace"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.locks.lockhandler.LockHandler.replace"title="Permalink to this definition">¶</a></dt>
<dd><p>Replaces the lockstring entirely.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>lockstring</strong> (<em>str</em>) – The new lock definition.</p>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p>False if an error occurred.</p>
</dd>
<dtclass="field-odd">Return type</dt>
<ddclass="field-odd"><p>success (bool)</p>
</dd>
<dtclass="field-even">Raises</dt>
<ddclass="field-even"><p><aclass="reference internal"href="#evennia.locks.lockhandler.LockException"title="evennia.locks.lockhandler.LockException"><strong>LockException</strong></a>– If a critical error occurred.
<codeclass="sig-name descname">reset</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/lockhandler.html#LockHandler.reset"><spanclass="viewcode-link">[source]</span></a><aclass="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>
<codeclass="sig-name descname">validate</code><spanclass="sig-paren">(</span><emclass="sig-param">lockstring</em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/lockhandler.html#LockHandler.validate"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.locks.lockhandler.LockHandler.validate"title="Permalink to this definition">¶</a></dt>
<dd><p>Validate lockstring syntactically, without saving it.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>lockstring</strong> (<em>str</em>) – Lockstring to validate.</p>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p>If validation passed or not.</p>
</dd>
<dtclass="field-odd">Return type</dt>
<ddclass="field-odd"><p>valid (bool)</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dlclass="exception">
<dtid="evennia.locks.lockhandler.LockException">
<emclass="property">exception </em><codeclass="sig-prename descclassname">evennia.locks.lockhandler.</code><codeclass="sig-name descname">LockException</code><aclass="reference internal"href="../_modules/evennia/locks/lockhandler.html#LockException"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.locks.lockhandler.LockException"title="Permalink to this definition">¶</a></dt>
<spanid="evennia-locks-tests-module"></span><h2>evennia.locks.tests module<aclass="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>
<dlclass="class">
<dtid="evennia.locks.tests.TestLockCheck">
<emclass="property">class </em><codeclass="sig-prename descclassname">evennia.locks.tests.</code><codeclass="sig-name descname">TestLockCheck</code><spanclass="sig-paren">(</span><emclass="sig-param">methodName='runTest'</em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/tests.html#TestLockCheck"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.locks.tests.TestLockCheck"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">testrun</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/tests.html#TestLockCheck.testrun"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.locks.tests.TestLockCheck.testrun"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dlclass="class">
<dtid="evennia.locks.tests.TestLockfuncs">
<emclass="property">class </em><codeclass="sig-prename descclassname">evennia.locks.tests.</code><codeclass="sig-name descname">TestLockfuncs</code><spanclass="sig-paren">(</span><emclass="sig-param">methodName='runTest'</em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/tests.html#TestLockfuncs"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.locks.tests.TestLockfuncs"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">setUp</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/tests.html#TestLockfuncs.setUp"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.locks.tests.TestLockfuncs.setUp"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">test_account_perm</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/tests.html#TestLockfuncs.test_account_perm"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.locks.tests.TestLockfuncs.test_account_perm"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">test_account_perm_above</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/tests.html#TestLockfuncs.test_account_perm_above"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.locks.tests.TestLockfuncs.test_account_perm_above"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">test_attr</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/tests.html#TestLockfuncs.test_attr"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.locks.tests.TestLockfuncs.test_attr"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">test_booleans</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/tests.html#TestLockfuncs.test_booleans"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.locks.tests.TestLockfuncs.test_booleans"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">test_dbref</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/tests.html#TestLockfuncs.test_dbref"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.locks.tests.TestLockfuncs.test_dbref"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">test_has_account</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/tests.html#TestLockfuncs.test_has_account"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.locks.tests.TestLockfuncs.test_has_account"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">test_inside_holds</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/tests.html#TestLockfuncs.test_inside_holds"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.locks.tests.TestLockfuncs.test_inside_holds"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">test_locattr</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/tests.html#TestLockfuncs.test_locattr"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.locks.tests.TestLockfuncs.test_locattr"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">test_object_above_perm</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/tests.html#TestLockfuncs.test_object_above_perm"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.locks.tests.TestLockfuncs.test_object_above_perm"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">test_object_perm</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/tests.html#TestLockfuncs.test_object_perm"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.locks.tests.TestLockfuncs.test_object_perm"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">test_pperm</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/tests.html#TestLockfuncs.test_pperm"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.locks.tests.TestLockfuncs.test_pperm"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">test_puppet_perm</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/tests.html#TestLockfuncs.test_puppet_perm"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.locks.tests.TestLockfuncs.test_puppet_perm"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">test_quell_above_perm</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/tests.html#TestLockfuncs.test_quell_above_perm"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.locks.tests.TestLockfuncs.test_quell_above_perm"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">test_quell_perm</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/tests.html#TestLockfuncs.test_quell_perm"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.locks.tests.TestLockfuncs.test_quell_perm"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">test_serversetting</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/tests.html#TestLockfuncs.test_serversetting"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.locks.tests.TestLockfuncs.test_serversetting"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">test_tag</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/tests.html#TestLockfuncs.test_tag"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.locks.tests.TestLockfuncs.test_tag"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">test_traverse_taglock</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/tests.html#TestLockfuncs.test_traverse_taglock"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.locks.tests.TestLockfuncs.test_traverse_taglock"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">test_traverse_taglock_fail</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/locks/tests.html#TestLockfuncs.test_traverse_taglock_fail"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.locks.tests.TestLockfuncs.test_traverse_taglock_fail"title="Permalink to this definition">¶</a></dt>