Skip to content

Commit

Permalink
Fixed issue #14312: Importing participants from CSV is not possible f…
Browse files Browse the repository at this point in the history
…or user with survey/create global permission
  • Loading branch information
dominikvitt authored and olleharstedt committed Jan 8, 2019
1 parent f4eff57 commit bcae7a4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions application/controllers/admin/tokens.php
Expand Up @@ -1677,7 +1677,7 @@ public function importldap($iSurveyId)
$iSurveyId = (int) $iSurveyId;
$survey = Survey::model()->findByPk($iSurveyId);
$aData = array();
if (!Permission::model()->hasSurveyPermission($iSurveyId, 'tokens', 'import')) {
if (!(Permission::model()->hasSurveyPermission($iSurveyId, 'tokens', 'import') || Permission::model()->hasGlobalPermission('surveys', 'update'))) {
Yii::app()->session['flashmessage'] = gT("You do not have permission to access this page.");
$this->getController()->redirect(array("/admin/survey/sa/view/surveyid/{$iSurveyId}"));
}
Expand Down Expand Up @@ -1920,7 +1920,7 @@ public function import($iSurveyId)
$aData = array();
$iSurveyId = (int) $iSurveyId;
$survey = Survey::model()->findByPk($iSurveyId);
if (!Permission::model()->hasSurveyPermission($iSurveyId, 'tokens', 'import')) {
if (!(Permission::model()->hasSurveyPermission($iSurveyId, 'tokens', 'import') || Permission::model()->hasGlobalPermission('surveys', 'update'))) {
Yii::app()->session['flashmessage'] = gT("You do not have permission to access this page.");
$this->getController()->redirect(array("/admin/survey/sa/view/surveyid/{$iSurveyId}"));
}
Expand Down
6 changes: 3 additions & 3 deletions application/views/admin/token/token_bar.php
Expand Up @@ -14,7 +14,7 @@
<?php if( isset($token_bar['buttons']['view']) ): ?>

<!-- Display tokens -->
<?php if (Permission::model()->hasSurveyPermission($oSurvey->sid, 'tokens', 'read')): ?>
<?php if (Permission::model()->hasSurveyPermission($oSurvey->sid, 'tokens', 'read') || Permission::model()->hasGlobalPermission('surveys', 'update')): ?>
<a class="btn btn-default pjax" href='<?php echo $this->createUrl("admin/tokens/sa/browse/surveyid/$oSurvey->sid"); ?>' role="button">
<span class="fa fa-list-alt text-success"></span>
<?php eT("Display participants"); ?>
Expand All @@ -30,7 +30,7 @@

<!-- Add new token entry -->
<ul class="dropdown-menu">
<?php if (Permission::model()->hasSurveyPermission($oSurvey->sid, 'tokens', 'create')): ?>
<?php if (Permission::model()->hasSurveyPermission($oSurvey->sid, 'tokens', 'create') || Permission::model()->hasGlobalPermission('surveys', 'update')): ?>
<li>
<a class="pjax" href="<?php echo $this->createUrl("admin/tokens/sa/addnew/surveyid/$oSurvey->sid"); ?>" >
<span class="icon-add"></span>
Expand All @@ -48,7 +48,7 @@
<?php endif; ?>

<!-- Import tokens -->
<?php if (Permission::model()->hasSurveyPermission($oSurvey->sid, 'tokens', 'import')): ?>
<?php if (Permission::model()->hasSurveyPermission($oSurvey->sid, 'tokens', 'import') || Permission::model()->hasGlobalPermission('surveys', 'update')): ?>
<li role="separator" class="divider"></li>
<li>
<small><?php eT("Import participants from:"); ?></small>
Expand Down

0 comments on commit bcae7a4

Please sign in to comment.