Commit 81ba8c23375b10b76baf23f0b351fd21084eba45

Authored by Benjamin Renard
1 parent 698c7971

Fix time restrictions when an user is not in any group (#5768)

Showing 1 changed file with 12 additions and 13 deletions   Show diff stats
php/classes/UserMgr.php
... ... @@ -704,9 +704,6 @@ class UserMgr
704 704  
705 705 protected function updateTreeForGrpsAndTimeRestrictions($file)
706 706 {
707   - if (!isset($this->userGrps))
708   - return TRUE;
709   -
710 707 $xml = new DomDocument("1.0");
711 708  
712 709 if(!$xml->load($file))
... ... @@ -714,18 +711,20 @@ class UserMgr
714 711  
715 712 $xp = new domxpath($xml);
716 713  
717   - foreach ($this->userGrps as $grp) {
718   - $nodes = $xp->query("//*[@group='".$grp."']");
  714 + if (!empty($this->userGrps)) {
  715 + foreach ($this->userGrps as $grp) {
  716 + $nodes = $xp->query("//*[@group='".$grp."']");
719 717  
720   - if ($nodes->length > 0)
721   - foreach ($nodes as $node) {
722   - $node->removeAttribute('group');
723   - if ($node->hasAttribute('restriction')) {
724   - if ($node->getAttribute('restriction') != "plotOnly") {
725   - $node->removeAttribute('restriction');
  718 + if ($nodes->length > 0)
  719 + foreach ($nodes as $node) {
  720 + $node->removeAttribute('group');
  721 + if ($node->hasAttribute('restriction')) {
  722 + if ($node->getAttribute('restriction') != "plotOnly") {
  723 + $node->removeAttribute('restriction');
  724 + }
726 725 }
727   - }
728   - }
  726 + }
  727 + }
729 728 }
730 729  
731 730 if (!empty($this->datasetsTimeRestriction)) {
... ...