Permalink
Browse files

workflow permission bug fixes

  • Loading branch information...
1 parent e49629c commit 7e5bfcc952d02302f968237aa62134780af5ec1c @aembler aembler committed Apr 4, 2013
@@ -1,4 +1,4 @@
-<?
+<?php
defined('C5_EXECUTE') or die("Access Denied.");
/**
* @package Workflow
@@ -56,15 +56,18 @@ public function getWorkflowRequestAdditionalActions(WorkflowProgress $wp) {
$buttons = array();
$c = Page::getByID($this->cID, 'ACTIVE');
- $button = new WorkflowProgressAction();
- $button->setWorkflowProgressActionLabel(t('Compare Versions'));
- $button->addWorkflowProgressActionButtonParameter('dialog-title', t('Compare Versions'));
- $button->addWorkflowProgressActionButtonParameter('dialog-width', '90%');
- $button->addWorkflowProgressActionButtonParameter('dialog-height', '70%');
- $button->setWorkflowProgressActionStyleInnerButtonLeftHTML('<i class="icon-eye-open"></i>');
- $button->setWorkflowProgressActionURL(REL_DIR_FILES_TOOLS_REQUIRED . '/workflow/dialogs/approve_page_preview.php?wpID=' . $wp->getWorkflowProgressID());
- $button->setWorkflowProgressActionStyleClass('dialog-launch');
- $buttons[] = $button;
+ $cp = new Permissions($c);
+ if ($cp->canViewPageVersions()) {
+ $button = new WorkflowProgressAction();
+ $button->setWorkflowProgressActionLabel(t('Compare Versions'));
+ $button->addWorkflowProgressActionButtonParameter('dialog-title', t('Compare Versions'));
+ $button->addWorkflowProgressActionButtonParameter('dialog-width', '90%');
+ $button->addWorkflowProgressActionButtonParameter('dialog-height', '70%');
+ $button->setWorkflowProgressActionStyleInnerButtonLeftHTML('<i class="icon-eye-open"></i>');
+ $button->setWorkflowProgressActionURL(REL_DIR_FILES_TOOLS_REQUIRED . '/workflow/dialogs/approve_page_preview.php?wpID=' . $wp->getWorkflowProgressID());
+ $button->setWorkflowProgressActionStyleClass('dialog-launch');
+ $buttons[] = $button;
+ }
return $buttons;
}
@@ -1,51 +1,52 @@
-<?
+<?php
defined('C5_EXECUTE') or die("Access Denied.");
$wp = WorkflowProgress::getByID($_REQUEST['wpID']);
$ih = Loader::helper('concrete/interface');
$wf = $wp->getWorkflowObject();
$req = $wp->getWorkflowRequestObject();
if ($wp instanceof PageWorkflowProgress) {
-if ($wf->canApproveWorkflowProgressObject($wp)) {
$rvc = Page::getByID($req->getRequestedPageID(), $req->getRequestedVersionID());
- $rv = $rvc->getVersionObject();
- $rvl = Page::getByID($req->getRequestedPageID(), 'ACTIVE');
- $rvr = Page::getByID($req->getRequestedPageID(), 'RECENT');
- $liveCVID = $rvl->getVersionID();
- $recentCVID = $rvr->getVersionID();
-
- $tabs = array(
- array('requested-version', t('Requested Version: %s', $rv->getVersionComments()), true),
- array('live-version', t('Live Version'))
- );
-
- if ($liveCVID != $recentCVID) {
- $tabs[] = array('recent-version', t('Most Recent Version'));
- }
- ?>
-
- <div class="ccm-ui">
-
- <?=$ih->tabs($tabs); ?>
-
- <div style="display: block" id="ccm-tab-content-requested-version">
- <iframe border="0" id="v<?=time()?>r" frameborder="0" height="100%" width="100%" src="<?=BASE_URL . DIR_REL?>/<?=DISPATCHER_FILENAME?>?cvID=<?=$req->getRequestedVersionID()?>&cID=<?=$req->getRequestedPageID()?>&vtask=view_versions" />
- </div>
-
- <div style="display: none" id="ccm-tab-content-live-version">
- <iframe border="0" id="v<?=time()?>l" frameborder="0" height="100%" width="100%" src="<?=BASE_URL . DIR_REL?>/<?=DISPATCHER_FILENAME?>?cvID=<?=$liveCVID?>&cID=<?=$req->getRequestedPageID()?>&vtask=view_versions" />
- </div>
+ $rvcp = new Permissions($rvc);
+ if ($rvcp->canViewPageVersions()) {
+ $rv = $rvc->getVersionObject();
+ $rvl = Page::getByID($req->getRequestedPageID(), 'ACTIVE');
+ $rvr = Page::getByID($req->getRequestedPageID(), 'RECENT');
+ $liveCVID = $rvl->getVersionID();
+ $recentCVID = $rvr->getVersionID();
+
+ $tabs = array(
+ array('requested-version', t('Requested Version: %s', $rv->getVersionComments()), true),
+ array('live-version', t('Live Version'))
+ );
+
+ if ($liveCVID != $recentCVID) {
+ $tabs[] = array('recent-version', t('Most Recent Version'));
+ }
+ ?>
+
+ <div class="ccm-ui">
+
+ <?php echo $ih->tabs($tabs); ?>
+
+ <div style="display: block" id="ccm-tab-content-requested-version">
+ <iframe border="0" id="v<?php echo time()?>r" frameborder="0" height="100%" width="100%" src="<?php echo BASE_URL . DIR_REL?>/<?php echo DISPATCHER_FILENAME?>?cvID=<?php echo $req->getRequestedVersionID()?>&cID=<?php echo $req->getRequestedPageID()?>&vtask=view_versions" />
+ </div>
+
+ <div style="display: none" id="ccm-tab-content-live-version">
+ <iframe border="0" id="v<?php echo time()?>l" frameborder="0" height="100%" width="100%" src="<?php echo BASE_URL . DIR_REL?>/<?php echo DISPATCHER_FILENAME?>?cvID=<?php echo $liveCVID?>&cID=<?php echo $req->getRequestedPageID()?>&vtask=view_versions" />
+ </div>
-<? if ($liveCVID != $rvr->getVersionID()) { ?>
+ <?php if ($liveCVID != $rvr->getVersionID()) { ?>
- <div style="display: none" id="ccm-tab-content-recent-version">
- <iframe border="0" id="v<?=time()?>rec" frameborder="0" height="100%" width="100%" src="<?=BASE_URL . DIR_REL?>/<?=DISPATCHER_FILENAME?>?cvID=<?=$recentCVID?>&cID=<?=$req->getRequestedPageID()?>&vtask=view_versions" />
- </div>
-
-<? } ?>
-
- </div>
-
- <? } ?>
-
-<? } ?>
+ <div style="display: none" id="ccm-tab-content-recent-version">
+ <iframe border="0" id="v<?php echo time()?>rec" frameborder="0" height="100%" width="100%" src="<?php echo BASE_URL . DIR_REL?>/<?php echo DISPATCHER_FILENAME?>?cvID=<?php echo $recentCVID?>&cID=<?php echo $req->getRequestedPageID()?>&vtask=view_versions" />
+ </div>
+
+ <?php } ?>
+
+ </div>
+
+ <?php } ?>
+
+ <?php } ?>

0 comments on commit 7e5bfcc

Please sign in to comment.