From 1b45305099da4a665bb1da110dc9de1286630c9b Mon Sep 17 00:00:00 2001 From: rob Date: Wed, 8 Oct 2003 08:18:17 +0000 Subject: [PATCH] Added new column to folders table that will allow user to break folder permission --- lib/foldermanagement/Folder.inc | 18 +++++++++++++++--- sql/mysql/upgrade/1.2.0/1.2.0.sql | 3 +++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/lib/foldermanagement/Folder.inc b/lib/foldermanagement/Folder.inc index 5cd87d7..6d5b5d3 100644 --- a/lib/foldermanagement/Folder.inc +++ b/lib/foldermanagement/Folder.inc @@ -46,6 +46,8 @@ class Folder { var $sParentFolderIDs; /** forward slash deliminated path from file system root */ var $sFullPath; + /** whether to inherit parent permissions or not */ + var $bInheritParentPermission; /** @@ -68,6 +70,7 @@ class Folder { $this->iCreatorID = $iNewCreatorID; $this->iUnitID = $iNewUnitID; $this->bIsPublic = $bNewIsPublic; + $this->bInheritParentPermissions = true; } /** @@ -205,6 +208,14 @@ class Folder { return $this->sParentFolderIDs; } + function getInheritParentPermission() { + return $this->bInheritParentPermissions; + } + + function setInheritParentPermission($bNewValue) { + $this->bInheritParentPermissions = $bNewValue; + } + /** * Recursive function to generate a comma delimited string containing * the parent folder ids @@ -273,8 +284,8 @@ class Folder { $this->sFullPath = $this->generateFolderPath($this->iParentID); $this->sParentFolderIDs = $this->generateFolderIDs($this->iParentID); $sql = $default->db; - $result = $sql->query("INSERT INTO " . $default->folders_table . " (name, description, parent_id, creator_id, unit_id, is_public, full_path, parent_folder_ids) " . - "VALUES ('$this->sName', '$this->sDescription', $this->iParentID, $this->iCreatorID, $this->iUnitID, " . ($this->bIsPublic ? 1 : 0) . ",'$this->sFullPath','$this->sParentFolderIDs')"); + $result = $sql->query("INSERT INTO " . $default->folders_table . " (name, description, parent_id, creator_id, unit_id, is_public, full_path, parent_folder_ids, inherit_parent_folder_permission) " . + "VALUES ('$this->sName', '$this->sDescription', $this->iParentID, $this->iCreatorID, $this->iUnitID, " . ($this->bIsPublic ? 1 : 0) . ",'$this->sFullPath','$this->sParentFolderIDs'," . ($this->bInheritParentPermissions ? "1" : "0") . ")"); if ($result) { $this->iId = $sql->insert_id(); return true; @@ -302,7 +313,8 @@ class Folder { "description = '$this->sDescription', " . "parent_id = $this->iParentID, " . "creator_id = $this->iCreatorID, " . - "unit_id = $this->iUnitID, "; + "unit_id = $this->iUnitID, " . + "inherit_parent_folder_permission = " . ($this->bInheritParentPermissions ? "1" : "0") . ", "; if ($bPathChange) { $this->sFullPath = $this->generateFolderPath($this->iParentID); $this->sParentFolderIDs = $this->generateFolderIDs($this->iParentID); diff --git a/sql/mysql/upgrade/1.2.0/1.2.0.sql b/sql/mysql/upgrade/1.2.0/1.2.0.sql index 954c2c0..83a7455 100644 --- a/sql/mysql/upgrade/1.2.0/1.2.0.sql +++ b/sql/mysql/upgrade/1.2.0/1.2.0.sql @@ -131,3 +131,6 @@ INSERT INTO help VALUES (95,'addUnitToOrg','addUnitToOrgHelp.html'); INSERT INTO help VALUES (96,'listUsers','listUsersHelp.html'); INSERT INTO help VALUES (97,'editUserGroups','editUserGroupsHelp.html'); INSERT INTO help VALUES (98,'listWebsites','listWebsitesHelp.html'); + +ALTER TABLE folders ADD COLUMN inherit_parent_folder_permission BIT; +UPDATE folders SET inherit_parent_folder_permission = 1; \ No newline at end of file -- libgit2 0.21.4