Commit c64fc0c9bd51b7fce8cfd2738d55de99cea976aa

Authored by Neil Blakey-Milner
1 parent 1a2407c5

Add Workflow State Permission Assignments, allowing permissions on

documents to be overridden by virtue of their workflow state.


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@4795 c91229c3-7414-0410-bfa2-8a42b809f60b
config/tableMappings.inc
@@ -149,4 +149,5 @@ $default->document_content_version_table = "document_content_version"; @@ -149,4 +149,5 @@ $default->document_content_version_table = "document_content_version";
149 $default->trigger_selection_table = "trigger_selection"; 149 $default->trigger_selection_table = "trigger_selection";
150 $default->type_workflow_map_table = "type_workflow_map"; 150 $default->type_workflow_map_table = "type_workflow_map";
151 $default->folder_workflow_map_table = "folder_workflow_map"; 151 $default->folder_workflow_map_table = "folder_workflow_map";
  152 +$default->workflow_state_permission_assignments_table = "workflow_state_permission_assignments";
152 ?> 153 ?>
lib/workflow/workflowstatepermissionsassignment.php 0 → 100644
  1 +<?php
  2 +/**
  3 + * $Id$
  4 + *
  5 + * Describes the permissions that apply to a document in a given
  6 + * workflow state.
  7 + *
  8 + * Copyright (c) 2006 Jam Warehouse http://www.jamwarehouse.com
  9 + *
  10 + * This program is free software; you can redistribute it and/or modify
  11 + * it under the terms of the GNU General Public License as published by
  12 + * the Free Software Foundation; either version 2 of the License, or
  13 + * (at your option) any later version.
  14 + *
  15 + * This program is distributed in the hope that it will be useful,
  16 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18 + * GNU General Public License for more details.
  19 + *
  20 + * You should have received a copy of the GNU General Public License
  21 + * along with this program; if not, write to the Free Software
  22 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  23 + *
  24 + * @version $Revision$
  25 + * @author Neil Blakey-Milner, Jam Warehouse (Pty) Ltd, South Africa
  26 + */
  27 +
  28 +require_once(KT_LIB_DIR . "/ktentity.inc");
  29 +
  30 +class KTWorkflowStatePermissionAssignment extends KTEntity {
  31 + var $iStateId;
  32 + var $iPermissionId;
  33 + var $iDescriptorId;
  34 +
  35 + var $_aFieldToSelect = array(
  36 + "iId" => "id",
  37 + "iStateId" => "workflow_state_id",
  38 + "iPermissionId" => "permission_id",
  39 + "iDescriptorId" => "permission_descriptor_id",
  40 + );
  41 +
  42 + var $_bUsePearError = true;
  43 +
  44 + function getStateId() { return $this->iStateId; }
  45 + function getPermissionId() { return $this->iPermissionId; }
  46 + function getDescriptorId() { return $this->iDescriptorId; }
  47 + function setStateId($mValue) { $this->iStateId = $mValue; }
  48 + function setPermissionId($mValue) { $this->iPermissionId = $mValue; }
  49 + function setDescriptorId($mValue) { $this->iDescriptorId = $mValue; }
  50 +
  51 + function _table () {
  52 + return KTUtil::getTableName('workflow_state_permission_assignments');
  53 + }
  54 +
  55 + // STATIC
  56 + function &get($iId) {
  57 + return KTEntityUtil::get('KTWorkflowStatePermissionAssignment', $iId);
  58 + }
  59 +
  60 + // STATIC
  61 + function &createFromArray($aOptions) {
  62 + return
  63 + KTEntityUtil::createFromArray('KTWorkflowStatePermissionAssignment', $aOptions);
  64 + }
  65 +
  66 + // STATIC
  67 + function &getList($sWhereClause = null) {
  68 + return
  69 + KTEntityUtil::getList2('KTWorkflowStatePermissionAssignment', $sWhereClause);
  70 + }
  71 +}
  72 +
  73 +?>
sql/mysql/upgrade/2.99.8/20-state_permission_assignments.sql 0 → 100644
  1 +CREATE TABLE `workflow_state_permission_assignments` (
  2 + `id` int(11) NOT NULL,
  3 + `workflow_state_id` int(11) NOT NULL,
  4 + `permission_id` int(11) NOT NULL,
  5 + `permission_descriptor_id` int(11) NOT NULL,
  6 + PRIMARY KEY (`id`),
  7 + KEY `permission_id` (`permission_id`),
  8 + KEY `permission_descriptor_id` (`permission_descriptor_id`),
  9 + KEY `workflow_state_id` (`workflow_state_id`),
  10 + CONSTRAINT `workflow_state_permission_assignments_ibfk_7` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`),
  11 + CONSTRAINT `workflow_state_permission_assignments_ibfk_8` FOREIGN KEY (`permission_descriptor_id`) REFERENCES `permission_descriptors` (`id`)
  12 +) TYPE=InnoDB;