Skip to content

Commit

Permalink
Merge branch 'feature/issue199-dept-perms-edit-file' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenlawrence committed Feb 14, 2015
2 parents 9206351 + 90bb31d commit a244cea
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
28 changes: 21 additions & 7 deletions edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,12 @@
$del_user_perms_stmt = $pdo->prepare($del_user_perms_query);
$del_user_perms_stmt->bindParam(':file_id', $fileId);
$del_user_perms_stmt->execute();

// clean out old permissions
$del_dept_perms_query = "DELETE FROM {$GLOBALS['CONFIG']['db_prefix']}dept_perms WHERE fid = :file_id";
$del_dept_perms_stmt = $pdo->prepare($del_dept_perms_query);
$del_dept_perms_stmt->bindParam(':file_id', $fileId);
$del_dept_perms_stmt->execute();

$result_array = array(); // init;

Expand Down Expand Up @@ -241,16 +247,24 @@
//UPDATE Department Rights into dept_perms
foreach ($_POST['department_permission'] as $dept_id => $dept_perm) {
$update_dept_perms_query = "
UPDATE
INSERT INTO
{$GLOBALS['CONFIG']['db_prefix']}dept_perms
SET
rights = :dept_perm
WHERE
fid={$filedata->getId()}
AND
{$GLOBALS['CONFIG']['db_prefix']}dept_perms.dept_id = $dept_id";
(
fid,
dept_id,
rights
)
VALUES
(
:file_id,
:dept_id,
:dept_perm
)
";
$update_dept_perms_stmt = $pdo->prepare($update_dept_perms_query);
$update_dept_perms_stmt->bindParam(':dept_perm', $dept_perm);
$update_dept_perms_stmt->bindParam(':dept_id', $dept_id);
$update_dept_perms_stmt->bindParam(':file_id', $filedata->getId());
$update_dept_perms_stmt->execute();
}

Expand Down
2 changes: 2 additions & 0 deletions templates_c/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
*.tpl.php

!.gitignore

0 comments on commit a244cea

Please sign in to comment.