diff options
author | Malf Furious <m@lfurio.us> | 2016-06-08 23:36:35 -0400 |
---|---|---|
committer | Malf Furious <m@lfurio.us> | 2016-06-08 23:36:35 -0400 |
commit | 3f58919204a6d21111b6ff00ccec1e2a9dfac040 (patch) | |
tree | 907173d9b3bf1a50859ac8d0ee5375b956d835f1 /app/class | |
parent | d70f5ac0ddc976fff9a526996dca8ea6e69d9a16 (diff) | |
download | scrott-3f58919204a6d21111b6ff00ccec1e2a9dfac040.tar.gz scrott-3f58919204a6d21111b6ff00ccec1e2a9dfac040.zip |
Add function Object::getOwner()
Added object function to get the owner of an object. This base-class
function returns a User object, however a user might not always be the
kind of owner (eg: a group can own a pad). In these situations, Object
sub-classes should override this function and return the appropriate
type of object.
Diffstat (limited to 'app/class')
-rw-r--r-- | app/class/object.class.php | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/app/class/object.class.php b/app/class/object.class.php index a64bdfb..8a4b956 100644 --- a/app/class/object.class.php +++ b/app/class/object.class.php @@ -15,6 +15,7 @@ */ require_once "class/framework.class.php"; +require_once "class/user.class.php"; /* * Base class for Scrott database objects @@ -254,6 +255,17 @@ abstract class Object extends Framework } /* + * Get a user object for this object's owner + */ + function getOwner() + { + if (isset($this->owner)) + return new User($this->owner); + + return null; + } + + /* * Get an array of all members of this object */ function getMembers() |