Exemplo n.º 1
0
 public static function hasCredential($groupid, $cred)
 {
     $g = new groupsModel();
     $rs = $g->get($groupid);
     if (is_string($groupid)) {
         return in_array($cred, $rs->credentials);
     }
     foreach ($rs->credentials as $name) {
         $c = new credentialModel();
         $c->name = $name;
         $rc = $c->get(array('name'));
         if ($rc->id == $cred) {
             return true;
         }
     }
     return false;
 }
Exemplo n.º 2
0
 public function get($userid = null)
 {
     if (empty($userid)) {
         $userid = $this->id;
     }
     $grm = new groupsModel();
     $sql = 'SELECT groupid FROM pfmuser_group WHERE userid=' . $userid;
     if ($GLOBALS['conf']->db_debug) {
         print $sql . '<br />';
     }
     $ds = $grm->rawQuery($sql);
     $resp = array();
     while ($row = mysqli_fetch_object($ds)) {
         $resp[] = $this->groups[] = $grm->get($row->groupid);
     }
     $user = parent::get($userid);
     $user->groups = $this->groups;
     return $user;
 }