Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions app/Controller/Component/RoleComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -501,9 +501,12 @@ public function calculateCMRoles() {

$authCoId = $this->Session->read('Auth.User.co_id');
$privd = $this->Session->read('Auth.User.privileged');

if($authCoId == 1) {
// API users in CO 1 are given platform privileges

$Co = ClassRegistry::init('Co');
$comanageCoId = $Co->getCOmanageCOID();

if($comanageCoId && ((int)$authCoId === (int)$comanageCoId)) {
// API users in the COmanage CO are given platform privileges
$ret['cmadmin'] = true;
} elseif(($coId == $authCoId) && $privd) {
// Privileged users in other COs are given CO privileges
Expand Down
5 changes: 3 additions & 2 deletions app/Controller/StandardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,9 @@ function beforeFilter() {
// Apply the rule only when the validateExtendedType function is used as a custom rule
$model = $this->modelClass;
if(!empty($this->$model->validate['type']['content']['rule'])
&& array_search('validateExtendedType', $this->$model->validate['type']['content']['rule'], true) !== null
&& !empty($this->cur_co['Co']['id'])) {
&& in_array('validateExtendedType', $this->$model->validate['type']['content']['rule'])
&& !empty($this->cur_co['Co']['id'])
) {
$vrule = $this->$model->validate['type']['content']['rule'];
$vrule[1]['coid'] = $this->cur_co['Co']['id'];
$this->$model->validator()->getField('type')->getRule('content')->rule = $vrule;
Expand Down