summaryrefslogtreecommitdiffstats
path: root/app/class
diff options
context:
space:
mode:
authorMalf Furious <m@lfurio.us>2016-06-08 23:36:35 -0400
committerMalf Furious <m@lfurio.us>2016-06-08 23:36:35 -0400
commit3f58919204a6d21111b6ff00ccec1e2a9dfac040 (patch)
tree907173d9b3bf1a50859ac8d0ee5375b956d835f1 /app/class
parentd70f5ac0ddc976fff9a526996dca8ea6e69d9a16 (diff)
downloadscrott-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.php12
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()