mirror of
https://github.com/evennia/evennia.git
synced 2026-04-05 15:37:17 +02:00
Added a lock funcion self(), passing only if accessing_obj == accessed_obj. This is potentially useful for Objects who want to lock cmdsets and make them only available to themselves without having to know their id value in the lockstring.
This commit is contained in:
parent
d3ee5a565b
commit
dc67b6b87c
1 changed files with 13 additions and 0 deletions
|
|
@ -107,6 +107,19 @@ def false(*args, **kwargs):
|
|||
def none(*args, **kwargs):
|
||||
return False
|
||||
|
||||
def self(accessing_obj, accessed_obj, *args, **kwargs):
|
||||
"""
|
||||
Check if accessing_obj is the same as accessed_obj
|
||||
|
||||
Usage:
|
||||
self()
|
||||
|
||||
This can be used to lock specifically only to
|
||||
the same object that the lock is defined on.
|
||||
"""
|
||||
return accessing_obj == accessed_obj
|
||||
|
||||
|
||||
def perm(accessing_obj, accessed_obj, *args, **kwargs):
|
||||
"""
|
||||
The basic permission-checker. Ignores case.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue