Skip to content

Commit

Permalink
[Cand. Params] Users with cand param edit permission should be able …
Browse files Browse the repository at this point in the history
…to view module (#5373)

Previously only users with candidate_parameter_view could view the module. This allows users with candidate_parameter_edit to view it also.
  • Loading branch information
johnsaigle authored and driusan committed Oct 28, 2019
1 parent 4f0ef14 commit 4177841
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 25 deletions.
13 changes: 6 additions & 7 deletions modules/candidate_parameters/php/candidate_parameters.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ namespace LORIS\candidate_parameters;
*/
class Candidate_Parameters extends \NDB_Form
{
public $hasWritePermission = false;

/**
* Check user permissions
*
Expand All @@ -40,11 +38,12 @@ class Candidate_Parameters extends \NDB_Form
*/
function _hasAccess(\User $user) : bool
{
// Set global permission to control access
// to different modules of candidate_parameters page
$this->hasWritePermission = $user->hasPermission('candidate_parameter_edit');

return $user->hasPermission('candidate_parameter_view');
return $user->hasAnyPermission(
array(
'candidate_parameter_view',
'candidate_parameter_edit',
)
);
}

/**
Expand Down
17 changes: 7 additions & 10 deletions modules/quality_control/php/quality_control.class.inc
Original file line number Diff line number Diff line change
@@ -1,34 +1,32 @@
<?php
/**
* This file contains the NDB_Menu_Filter_media class
* This file contains the Quality_Control class
*
* PHP Version 7
*
* @category Module
* @package Quality_Control
* @author Liza Levitis <[email protected]>
* @license http://www.gnu.org/licenses/gpl-3.0.txt GPLv3
* @link https://www.github.com/aces/CCNA/
* @link https://www.github.com/aces/Loris
*/
namespace LORIS\quality_control;

/**
* Main class for quality control module corresponding to /quality_control/ URL
* Tools section of the LorisMenu.
* Main class for quality control module corresponding to /quality_control/
* endpoint.
*
* PHP Version 7
*
* @category Module
* @package Quality_Control
* @author Liza Levitis <[email protected]>
* @license http://www.gnu.org/licenses/gpl-3.0.txt GPLv3
* @link https://www.github.com/aces/CCNA/
* @link https://www.github.com/aces/Loris
*/
class Quality_Control extends \NDB_Menu_Filter
{
public $hasWritePermission = false;
public $AjaxModule = true;
public $hasHidePermission = false;
public $AjaxModule = true;
public $fieldOptions;

/**
Expand All @@ -41,8 +39,7 @@ class Quality_Control extends \NDB_Menu_Filter
*/
function _hasAccess(\User $user) : bool
{
//create user object
$this->hasHidePermission = $user->hasPermission("superuser");
// FIXME This module should have its own permission.
return $user->hasPermission('data_team_helper');
}

Expand Down
14 changes: 6 additions & 8 deletions modules/quality_control/php/quality_control_behavioral.class.inc
Original file line number Diff line number Diff line change
@@ -1,33 +1,31 @@
<?php
/**
* This file contains the NDB_Menu_Filter_media class
* This file contains the Quality_Control_Behavioral class.
*
* PHP Version 7
*
* @category Module
* @package Quality_Control
* @author Liza Levitis <[email protected]>
* @license http://www.gnu.org/licenses/gpl-3.0.txt GPLv3
* @link https://www.github.com/aces/CCNA/
* @link https://www.github.com/aces/Loris
*/
namespace LORIS\quality_control;

/**
* Main class for quality control module corresponding to /quality_control/ URL
* Tools section of the LorisMenu.
* Quality_Control_Behavioral class.
*
* PHP Version 7
*
* @category Module
* @package Quality_Control
* @author Liza Levitis <[email protected]>
* @license http://www.gnu.org/licenses/gpl-3.0.txt GPLv3
* @link https://www.github.com/aces/CCNA/
* @link https://www.github.com/aces/Loris
*/
class Quality_Control_Behavioral extends \NDB_Menu_Filter
{
public $hasWritePermission = false;
public $AjaxModule = true;
public $AjaxModule = true;
public $fieldOptions;

/**
Expand All @@ -40,7 +38,7 @@ class Quality_Control_Behavioral extends \NDB_Menu_Filter
*/
function _hasAccess(\User $user) : bool
{
//create user object
// FIXME This module should have its own permission
return $user->hasPermission('data_team_helper');
}

Expand Down

0 comments on commit 4177841

Please sign in to comment.