summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMalf Furious <m@lfurio.us>2016-06-01 21:59:02 -0400
committerMalf Furious <m@lfurio.us>2016-06-01 21:59:02 -0400
commit9a0b71712bf79c22bb2b4c3f3afb2d34c38214c0 (patch)
tree01da8768e44c04e48fa0b91cfe4e709e5fb47182
parent567736d4d7a880b74bf86494cf43296b18ed40d1 (diff)
downloadscrott-9a0b71712bf79c22bb2b4c3f3afb2d34c38214c0.tar.gz
scrott-9a0b71712bf79c22bb2b4c3f3afb2d34c38214c0.zip
Add function Group::createNewGroup()
This function will initialize a new group object and write it to the database, with a given group name and owner user.
-rw-r--r--app/class/group.class.php15
-rw-r--r--app/class/object.class.php2
2 files changed, 17 insertions, 0 deletions
diff --git a/app/class/group.class.php b/app/class/group.class.php
index dfa7deb..246276a 100644
--- a/app/class/group.class.php
+++ b/app/class/group.class.php
@@ -29,6 +29,21 @@ class Group extends Object
parent::__construct();
$this->loadObj($guid);
}
+
+ /*
+ * Create a new user group object.
+ * On success, this object should be initialized as the new group (use only on new
+ * Group() objects)
+ */
+ function createNewGroup($name, $owner)
+ {
+ $this->perms = $this->DEFAULT_OBJECT_PERMISSIONS;
+ $this->owner = $owner->guid;
+ $this->name = $name;
+ $this->type = "group";
+
+ $this->saveObj();
+ }
}
?>
diff --git a/app/class/object.class.php b/app/class/object.class.php
index b73a54d..42c9355 100644
--- a/app/class/object.class.php
+++ b/app/class/object.class.php
@@ -21,6 +21,8 @@ require_once "class/framework.class.php";
*/
abstract class Object extends Framework
{
+ var $DEFAULT_OBJECT_PERMISSIONS = 120;
+
/*
* Constructor
*/