Commit 37961cf68ba832b02b6d69f2d772570638cbe23b

Authored by rob
1 parent 42b4e4c4

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 46 var $sParentFolderIDs;
47 47 /** forward slash deliminated path from file system root */
48 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 70 $this->iCreatorID = $iNewCreatorID;
69 71 $this->iUnitID = $iNewUnitID;
70 72 $this->bIsPublic = $bNewIsPublic;
  73 + $this->bInheritParentPermissions = true;
71 74 }
72 75  
73 76 /**
... ... @@ -205,6 +208,14 @@ class Folder {
205 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 220 * Recursive function to generate a comma delimited string containing
210 221 * the parent folder ids
... ... @@ -273,8 +284,8 @@ class Folder {
273 284 $this->sFullPath = $this->generateFolderPath($this->iParentID);
274 285 $this->sParentFolderIDs = $this->generateFolderIDs($this->iParentID);
275 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 289 if ($result) {
279 290 $this->iId = $sql->insert_id();
280 291 return true;
... ... @@ -302,7 +313,8 @@ class Folder {
302 313 "description = '$this->sDescription', " .
303 314 "parent_id = $this->iParentID, " .
304 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 318 if ($bPathChange) {
307 319 $this->sFullPath = $this->generateFolderPath($this->iParentID);
308 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 131 INSERT INTO help VALUES (96,'listUsers','listUsersHelp.html');
132 132 INSERT INTO help VALUES (97,'editUserGroups','editUserGroupsHelp.html');
133 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 137 \ No newline at end of file
... ...