Exemple #1
0
 /**
  * @see getAvailableUserGroupsSql
  * @see getManagedUserGroups
  * @return array Am_Protect_Databased_Usergroup
  */
 function getAvailableUserGroups()
 {
     $ret = array();
     if ($this->groupMode == self::GROUP_NONE) {
         $g = new Am_Protect_Databased_Usergroup(array('id' => 1, 'title' => 'Registered', 'isAdmin' => 0, 'isBanned' => 0));
         $ret[$g->getId()] = $g;
         return $ret;
     }
     foreach ($this->getDb()->select($this->getAvailableUserGroupsSql()) as $r) {
         try {
             $g = new Am_Protect_Databased_Usergroup($r);
         } catch (Am_Exception_PluginDb $e) {
             // to log errors with groups in integrated script
             $this->getDi()->errorLogTable->logException($e);
             throw $e;
         }
         $ret[$g->getId()] = $g;
     }
     return $ret;
 }
Exemple #2
0
 public function getAvailableUserGroups()
 {
     $ret = array();
     foreach ($this->getWP()->get_roles() as $rname => $r) {
         $g = new Am_Protect_Databased_Usergroup(array('id' => $rname, 'title' => $r['name'], 'is_banned' => null, 'is_admin' => in_array('level_10', array_keys($r['capabilities'])) ? $r['capabilities']['level_10'] : 0));
         if ($g->getId() == 'subscriber') {
             array_unshift($ret, $g);
         } else {
             $ret[$g->getId()] = $g;
         }
     }
     return $ret;
 }
Exemple #3
0
 function buildTree($parentID, $level)
 {
     $ret = array();
     if (empty($this->_gc)) {
         return array();
     }
     foreach ((array) $this->_gc[$parentID] as $item) {
         // Add value for item;
         $g = new Am_Protect_Databased_Usergroup(array('id' => $item['ID'], 'title' => str_repeat("--", $level) . " " . $item['Title']));
         $ret[$g->getId()] = $g;
         if (array_key_exists($item['ID'], $this->_gc)) {
             $ret = $ret + $this->buildTree($g->getId(), $level + 1);
         }
     }
     return $ret;
 }
 /**
  * @see getAvailableUserGroupsSql
  * @see getManagedUserGroups
  * @return array Am_Protect_Databased_Usergroup
  */
 function getAvailableUserGroups()
 {
     $ret = array();
     if ($this->groupMode == self::GROUP_NONE) {
         $g = new Am_Protect_Databased_Usergroup(array('id' => 1, 'title' => 'Registered', 'isAdmin' => 0, 'isBanned' => 0));
         $ret[$g->getId()] = $g;
         return $ret;
     }
     foreach ($this->getDb()->select($this->getAvailableUserGroupsSql()) as $r) {
         $g = new Am_Protect_Databased_Usergroup($r);
         $ret[$g->getId()] = $g;
     }
     return $ret;
 }