public function getSearchResultFromQuery(Query $query)
 {
     $result = parent::getSearchResultFromQuery($query);
     $u = new \User();
     if (!$u->isSuperUser()) {
         $gIDs = array(-1);
         $gs = new GroupList();
         $groups = $gs->getResults();
         foreach ($groups as $g) {
             $gp = new \Permissions($g);
             if ($gp->canSearchUsersInGroup()) {
                 $gIDs[] = $g->getGroupID();
             }
         }
         $result->getItemListObject()->getQueryObject()->leftJoin("u", "UserGroups", "ugRequired", "ugRequired.uID = u.uID");
         $groups = 'ugRequired.gID in (' . implode(',', $gIDs) . ')';
         $gg = \Group::getByID(REGISTERED_GROUP_ID);
         $ggp = new \Permissions($gg);
         if ($ggp->canSearchUsersInGroup()) {
             $null = 'ugRequired.gID is null';
         }
         $result->getItemListObject()->getQueryObject()->select('distinct (u.uID)');
         $expr = $result->getItemListObject()->getQueryObject()->expr()->orX($groups, $null);
         $result->getItemListObject()->getQueryObject()->andwhere($expr);
     }
     return $result;
 }
 public function processQueueItem(ZendQueueMessage $msg)
 {
     $ux = User::getByUserID($msg->body);
     $groupControllers = Group::getAutomatedOnJobRunGroupControllers($ux);
     foreach ($groupControllers as $ga) {
         if ($ga->check($ux)) {
             $ux->enterGroup($ga->getGroupObject());
         }
     }
     $gl = new GroupList();
     $gl->filterByExpirable();
     $groups = $gl->getResults();
     foreach ($groups as $group) {
         if ($group->isUserExpired($ux)) {
             $ux->exitGroup($group);
         }
     }
 }
 public function renderSearchField()
 {
     $gl = new GroupList();
     $g1 = $gl->getResults();
     $html = '<select multiple name="gID[]" class="selectize-select">';
     foreach ($g1 as $g) {
         $gp = new \Permissions($g);
         if ($gp->canSearchUsersInGroup($g)) {
             $html .= '<option value="' . $g->getGroupID() . '" ';
             if (is_array($this->data['gID']) && in_array($g->getGroupID(), $this->data['gID'])) {
                 $html .= 'selected="selected" ';
             }
             $html .= '>' . $g->getGroupDisplayName() . '</option>';
         }
     }
     $html .= '</select>';
     return $html;
 }
Exemple #4
0
 public function getUserGroupObjects()
 {
     $gs = new GroupList();
     $gs->filterByUserID($this->uID);
     return $gs->getResults();
 }
Exemple #5
0
 public static function exportTranslations()
 {
     $translations = new Translations();
     $gl = new GroupList();
     $gl->includeAllGroups();
     $results = $gl->getResults();
     foreach ($results as $group) {
         $translations->insert('GroupName', $group->getGroupName());
         if ($group->getGroupDescription()) {
             $translations->insert('GroupDescription', $group->getGroupDescription());
         }
     }
     return $translations;
 }
Exemple #6
0
 public function getPackageItems(Package $package)
 {
     $gl = new GroupList();
     $gl->filterByPackage($package);
     return $gl->get();
 }
 /**
  * @deprecated
  */
 public function get()
 {
     return parent::get();
 }
 protected function getAutomationControllers($column, $excludeUser = false)
 {
     $gs = new GroupList();
     $gs->filter($column, 1);
     $excludeGIDs = array();
     if (is_object($excludeUser)) {
         $groups = $excludeUser->getUserGroups();
         $groupKeys = array_keys($groups);
         if (is_array($groupKeys)) {
             $gs->filter(false, 'gID not in (' . implode(',', $groupKeys) . ')');
         }
     }
     $results = $gs->get();
     $controllers = array();
     foreach ($results as $group) {
         $controller = $group->getGroupAutomationController();
         $controllers[] = $controller;
     }
     return $controllers;
 }