Commit 1b45305099da4a665bb1da110dc9de1286630c9b

Authored by rob
1 parent e63b7d41

Added new column to folders table that will allow user to break

folder permission


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@2733 c91229c3-7414-0410-bfa2-8a42b809f60b
lib/foldermanagement/Folder.inc
@@ -46,6 +46,8 @@ class Folder { @@ -46,6 +46,8 @@ class Folder {
46 var $sParentFolderIDs; 46 var $sParentFolderIDs;
47 /** forward slash deliminated path from file system root */ 47 /** forward slash deliminated path from file system root */
48 var $sFullPath; 48 var $sFullPath;
  49 + /** whether to inherit parent permissions or not */
  50 + var $bInheritParentPermission;
49 51
50 52
51 /** 53 /**
@@ -68,6 +70,7 @@ class Folder { @@ -68,6 +70,7 @@ class Folder {
68 $this->iCreatorID = $iNewCreatorID; 70 $this->iCreatorID = $iNewCreatorID;
69 $this->iUnitID = $iNewUnitID; 71 $this->iUnitID = $iNewUnitID;
70 $this->bIsPublic = $bNewIsPublic; 72 $this->bIsPublic = $bNewIsPublic;
  73 + $this->bInheritParentPermissions = true;
71 } 74 }
72 75
73 /** 76 /**
@@ -205,6 +208,14 @@ class Folder { @@ -205,6 +208,14 @@ class Folder {
205 return $this->sParentFolderIDs; 208 return $this->sParentFolderIDs;
206 } 209 }
207 210
  211 + function getInheritParentPermission() {
  212 + return $this->bInheritParentPermissions;
  213 + }
  214 +
  215 + function setInheritParentPermission($bNewValue) {
  216 + $this->bInheritParentPermissions = $bNewValue;
  217 + }
  218 +
208 /** 219 /**
209 * Recursive function to generate a comma delimited string containing 220 * Recursive function to generate a comma delimited string containing
210 * the parent folder ids 221 * the parent folder ids
@@ -273,8 +284,8 @@ class Folder { @@ -273,8 +284,8 @@ class Folder {
273 $this->sFullPath = $this->generateFolderPath($this->iParentID); 284 $this->sFullPath = $this->generateFolderPath($this->iParentID);
274 $this->sParentFolderIDs = $this->generateFolderIDs($this->iParentID); 285 $this->sParentFolderIDs = $this->generateFolderIDs($this->iParentID);
275 $sql = $default->db; 286 $sql = $default->db;
276 - $result = $sql->query("INSERT INTO " . $default->folders_table . " (name, description, parent_id, creator_id, unit_id, is_public, full_path, parent_folder_ids) " .  
277 - "VALUES ('$this->sName', '$this->sDescription', $this->iParentID, $this->iCreatorID, $this->iUnitID, " . ($this->bIsPublic ? 1 : 0) . ",'$this->sFullPath','$this->sParentFolderIDs')"); 287 + $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) " .
  288 + "VALUES ('$this->sName', '$this->sDescription', $this->iParentID, $this->iCreatorID, $this->iUnitID, " . ($this->bIsPublic ? 1 : 0) . ",'$this->sFullPath','$this->sParentFolderIDs'," . ($this->bInheritParentPermissions ? "1" : "0") . ")");
278 if ($result) { 289 if ($result) {
279 $this->iId = $sql->insert_id(); 290 $this->iId = $sql->insert_id();
280 return true; 291 return true;
@@ -302,7 +313,8 @@ class Folder { @@ -302,7 +313,8 @@ class Folder {
302 "description = '$this->sDescription', " . 313 "description = '$this->sDescription', " .
303 "parent_id = $this->iParentID, " . 314 "parent_id = $this->iParentID, " .
304 "creator_id = $this->iCreatorID, " . 315 "creator_id = $this->iCreatorID, " .
305 - "unit_id = $this->iUnitID, "; 316 + "unit_id = $this->iUnitID, " .
  317 + "inherit_parent_folder_permission = " . ($this->bInheritParentPermissions ? "1" : "0") . ", ";
306 if ($bPathChange) { 318 if ($bPathChange) {
307 $this->sFullPath = $this->generateFolderPath($this->iParentID); 319 $this->sFullPath = $this->generateFolderPath($this->iParentID);
308 $this->sParentFolderIDs = $this->generateFolderIDs($this->iParentID); 320 $this->sParentFolderIDs = $this->generateFolderIDs($this->iParentID);
sql/mysql/upgrade/1.2.0/1.2.0.sql
@@ -131,3 +131,6 @@ INSERT INTO help VALUES (95,'addUnitToOrg','addUnitToOrgHelp.html'); @@ -131,3 +131,6 @@ INSERT INTO help VALUES (95,'addUnitToOrg','addUnitToOrgHelp.html');
131 INSERT INTO help VALUES (96,'listUsers','listUsersHelp.html'); 131 INSERT INTO help VALUES (96,'listUsers','listUsersHelp.html');
132 INSERT INTO help VALUES (97,'editUserGroups','editUserGroupsHelp.html'); 132 INSERT INTO help VALUES (97,'editUserGroups','editUserGroupsHelp.html');
133 INSERT INTO help VALUES (98,'listWebsites','listWebsitesHelp.html'); 133 INSERT INTO help VALUES (98,'listWebsites','listWebsitesHelp.html');
  134 +
  135 +ALTER TABLE folders ADD COLUMN inherit_parent_folder_permission BIT;
  136 +UPDATE folders SET inherit_parent_folder_permission = 1;
134 \ No newline at end of file 137 \ No newline at end of file